Solved

Problems with a list in AppleScript (selecting from a list of email adresses

Posted on 2011-02-13
2
1,196 Views
Last Modified: 2012-05-11
Hi

I want to make a list of email-adresses I frequently use in AppleScript, select one of them to create an email to the selected Address.

I've gotten pretty far, but I get this error message in the Script Editor.
Fehler in der AppleEvent-Routine." number -10000

What's wrong with my code?

Thanks!
tell application "Mail"
	set myList to {"email1@gmx.net", "email2@gmail.com", "email3@hotmail.com"}
	choose from list myList
	set theMessage to make new outgoing message with properties {visible:true}
	tell theMessage
		make new to recipient at end of to recipients with properties {address:myList}
	end tell
end tell

Open in new window

0
Comment
Question by:speechrec
2 Comments
 
LVL 6

Accepted Solution

by:
t-max earned 500 total points
ID: 34884236
tell application "Mail"
	set myList to {"email1@gmx.net", "email2@gmail.com", "email3@hotmail.com"}
	set toAddress to (choose from list myList) as string
	set theMessage to make new outgoing message with properties {visible:true}
	tell theMessage
		make new to recipient at end of to recipients with properties {address:toAddress}
	end tell
end tell

Open in new window

You need to save the value chosen from the list in a variable, as a string.
Then you just simply use it in the address property.
Good luck!
0
 

Author Comment

by:speechrec
ID: 34884256
set toAddress to (choose from list myList) as string

Open in new window


Thank you very much, works like a charm! That will teach me to declare my variables…
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In certain circumstances, a Microsoft Office mac application may fail to save a document to a network server, with the following error message: "There has been a network or file permission error. The network connection may be lost." An article at…
The error "There was an error performing the update" occurred on a Mac OS X client workstation running  Symantec AntiVirus for Mac (http://www.symantec.com/business/products/purchasing.jsp?pcid=pcat_security&pvid=825_1) - the Enterprise product vers…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question