Solved

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

Posted on 2011-02-13
2
1,195 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

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…
CocoaPods is the best way to manage library dependencies in iOS and OS X projects. By using cocoa pods there is no need of downloading the code from github and copying to your project. There are plenty of open source libraries now available with C…
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 …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

810 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