can't make {to recipient} from {get recipient of theMessage}
can't make {to recipient} from {get recipient of theMessage}
- Subject: can't make {to recipient} from {get recipient of theMessage}
- From: James Udo Ludtke <email@hidden>
- Date: Sun, 1 Nov 2009 01:18:46 -0400
I am trying to get an AppleScript to work in Mail.app.
1. From a message in my in-box, in which I am the cc recipient, I copy
the {to recipient}.
2. Next, I create a new email using <make new outgoing message with
properties {…..}>
3. Finally, I add the recipient to the new message with< make {to
recipient} with properties {address:..…}>
If I copy the sender in step 1, my script works OK.
If I set the addrVar variable using <copy "email@hidden" to addrVar>,
my script works OK.
But when I set addrVar to the {to recipient} in step 1, I get an error
"Mail got an error: Can’t make {to recipient} into type class." when
trying to set the recipient in the new message using <make {to
recipient} with properties {address:addrVar>
Here is the code:
tell application "Mail"
activate
set theSelection to selection
set theMessage to item 1 of theSelection
-- can't get this to work
copy {get recipients of theMessage} to allRecipients
copy item 1 of allRecipients to addrVar
-- copy allRecipients to addrVar -- alt version of previous line,
also does not work
-- using the sender of message 1 to set the new to address works
-- copy {get sender of theMessage} to allRecipients
-- copy item 1 of allRecipients to addrVar
-- using a literal string to set the new to address works
-- copy "email@hidden" to addrVar
set theNewMessage to make new outgoing message with properties
{subject:"My Subject", content:"Blah, blah,blah", visible:true}
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.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden