Le 1 nov. 2009 à 06:18, James Udo Ludtke a écrit :
I am trying to get an AppleScript to work in Mail.app.
[...]
Here is the code:
tell application "Mail"
[...]
tell theNewMessage
make new to recipient at beginning of to recipients with
properties {address:addrVar}
end tell
end tell
I suspect the format of {get recipients of theMessage} is different
from what <make new to recipient> expects, but I can't figure out
what to do about it.
Hello James,
Indeed, a message's recipient is an object.
On the other hand, a "make new ... with properties ..." expects a
record whose items define some or all of the distinctive properties of
the object -here, a recipient- to be built.
Something along those lines is thus needed:
tell application "Mail"
set RcptProps to {name:name, address:address} of item 1 of to
recipients of item 1 of (get selection)
tell (make new outgoing message with properties {subject:"My
Subject", content:"Blah, blah,blah", visible:true})
make new to recipient at beginning of to recipients with properties
RcptProps
end tell
end tell