Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variable for multiple recipients in Mail




On 20/02/2006, at 9:25 AM, Dan Doughtie wrote:

I have a script that automatically attaches an FTP link to an email and uses
the name of the file to determine who should get the email.


My challenge is I want to have one creation step with the variables changing
depending on the receiving location. I could use variables to set the name
and address but each location gets different number of recipients so that
doesn't work.


I have created a variable that consists of a string that mimics the hard
coded. Here is the hard code.



Tell new message
Set content of it to the_body
Make new to recipient at end with properties {name: "Jane Doe", address:
"email@hidden"}
Make new to recipent at end with properties {name: "John Roe", address:
"email@hidden"}


End tell


so I did

Set myRecips to "Make new to recipient at end with properties {name: \"Jane
Doe\", address: \"email@hidden\"}
Make new to recipent at end with properties {name: \"John Roe\", address:
\"email@hidden\"}"


Then tried
Tell new message
Set content of it to the_body

myRecips

End tell
-----
The variable matches the command but I guess I need some kind of statement
or such that says treat this string as a line of code and I can't find a
way to do it

You won't find a way to do that. Try something like this:


set newMsg to make new outgoing message
set the_body to "hello world"
set myRecips to {{name:"Jane Doe", address:"email@hidden"}, {name:"John Roe", address:"email@hidden"}}



tell newMsg set content of it to the_body repeat with i from 1 to length of myRecips make new to recipient at end with properties item i of myRecips end repeat end tell set visible of newMsg to true -- check to see if it is working


Malcolm

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden
References: 
 >Variable for multiple recipients in Mail (From: Dan Doughtie <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.