Solved

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

Posted on 2011-02-13
2
1,200 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Suggested Solutions

If you are using Mac OS X and have a large number of login items set up in accounts, under system preferences, you may find that your computer is sluggish and unresponsive during startup until everything is done launching. Another problem that a…
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
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 …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

737 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