Re: scripting Apple Mail.app
Re: scripting Apple Mail.app
- Subject: Re: scripting Apple Mail.app
- From: email@hidden
- Date: Sun, 2 Oct 2005 22:04:45 -0400
You are absolutely correct.
I did not expect that this would to be placed in the Text Suit. I'll
need to look harder next time.
On Oct 2, 2005, at 7:41 PM, Neil Faiman wrote:
On Oct 2, 2005, at 12:20 PM, email@hidden wrote:
Using Mail 1.3 , I don't see a property or command for this in the
dictionary. That is surprising.
On Oct 2, 2005, at 5:07 AM, Bob Cuilla wrote:
I would like to tell "mail" to attach a desktop folder named
"folder".. I cant seem to figure this out. Can anyone help?
Remember that in an application with well-designed AppleScript
support, most of the interesting stuff will be in the "classes"
(nouns) part of the dictionary rather the "commands" (verbs). In the
case of Mail, if you look in the (standard) text suite, you will find
the "attachment" class.
Where to go from there is, admittedly, less than obvious. The
following code is from a handler that is called with a list of files
and a subject string, and creates a mail message to a known recipient,
with all the specified files attached. There may be better ways to do
a lot of this -- I wrote it back in OS X 10.0 or 10.1 days, and
haven't touched it since.
set theAttachments to {}
repeat with eachFile in theFiles
copy (alias (eachFile as Unicode text)) to the end of
theAttachments
end repeat
tell application "Mail"
make new outgoing message with properties ¬
{subject:theSubject, content:"", sender:"Neil Faiman
<email@hiddenn>"}
tell the result
make new recipient at the end of the to recipients with
properties ¬
{name:"John Doe", address:my getEmail("John Doe")}
repeat with eachAttachment in theAttachments
make new attachment with properties ¬
{file name:eachAttachment} at after the last
paragraph of the content
end repeat
set visible to true
end tell
end tell
on getEmail(theName)
tell application "Address Book" to set theAddress to the value
of the first email of person theName as Unicode text
return theAddress
end getEmail
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden