Re: Auto-naming folder
Re: Auto-naming folder
- Subject: Re: Auto-naming folder
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 20 Nov 2013 22:26:28 -0800
- Thread-topic: Auto-naming folder
Title: Re: Auto-naming folder
On 11/20/13 9:51 PM, I wrote:
> I don't believe you can do what you want with Address Book (Contacts) and
> Mail.
Well, you could, using AppleScript, but it would be a bit laborious.
You'd construct your form letter, then separate it into two parts, before and after the name(s) you want to insert. Set a variable to each part, and in AppleScript Editor, run the following script:
------------------------------
set firstPart to "My Home Address,
December 10, 2013
Dear "
set secondPart to ",
Merry Christmas
from Crazed Leper"
tell application "Address Book" -- "Contacts"
set num to (count every person)
end tell
repeat with i from 1 to num
repeat 1 times
tell application "Address Book" -- "Contacts"
set theName to name of person i
try
set eAddress to email 1 of person i
on error -- no email address
exit repeat -- go on to next contact
end try
set theLetter to firstPart & theName & secondPart
end tell
tell application "Mail"
set theMessage to make new outgoing message with properties {content:theLetter, to recipient:{name:theName, address:eAddress}}
send theMessage
end tell
end repeat
end repeat
-------------------------------------
This is for email messages. For actual cards to send in regular mail, you'd have to have a scriptable word processor app. I'm told that Pages is not scriptable in Mavericks, but would be in earlier OS's. I don't have it so can't help you script letters and (hopefully) envelopes: it may or may not be able to do this. (I also don't know whether there's a ready-made Automator workflow to do this in Pages, someone else might know.) It can be done in Microsoft Word, but there you wouldn't need a script, but could just use a Mail Merge, as described earlier. I don't think a scriptable text app would be up to it, though you could look into (free) Text Wrangler. TextEdit wouldn't be any good for this.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden