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: can't make {to recipient} from {get recipient of theMessage}



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


HTH,
Axel _______________________________________________
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
Archives: http://lists.apple.com/archives/applescript-users

This email sent to 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.