Re: New Entourage question
Re: New Entourage question
- Subject: Re: New Entourage question
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 23 May 2003 06:03:44 -0700
On 5/23/03 5:14 AM, "julifos" <email@hidden> wrote:
>
I'm working in a little "message editor", and I've found another wall in my
>
way. How can I append recipients to a message?
>
>
This doesn't work:
>
>
###########################################
>
make new cc recipient at message id 1000 with properties {recipient type:cc
>
recipient, address:{address:"email@hidden", display name:"Pepe"}}
>
###########################################
>
>
I've tried different variations and none of them seem to work...
You can't change recipients of saved, encoded messages. Neither make new nor
delete. There are two ways to do what you want:
1) If it's an unsent draft message, you can open it (on the screen) and edit
the 'to recipients', 'CC recipients' and 'BCC recipients' comma-delimited
strings of the 'draft window' object with no problem, save and close. It's
rather tacky (I advise against it). Like this:
tell application "Microsoft Entourage"
open message id 1000
set msgWindow to front window
set ccRecips to CC recipients of msgWindow
if ccRecips /= "" then set ccRecips to toRecips & ", "
set ccRecips to ccRecips & "Pepe <email@hidden>"
close msgWindow saving yes
end tell
(If Pepe has a middle initial, or any other punctuation in his name, you
need to do this:
set ccRecips to ccRecips & "\"Pepe J. Armblaster\" <email@hidden>"
so when generalizing you should include \"Display Name \" around the display
name if it's not an empty "". It never does any harm.)
2) For any type of saved message - incoming or outgoing including draft -
get the source, account and recipients of message, make a new message from
them and delete the old one. There are a few extra properties you need to
check to get an exact replica, but they won't exist for unsent messages so
I'll mention them later. Like this:
tell application "Microsoft Entourage"
set origMsg to message id 1000
set {msgClass, theAccount, theSource, theFolder, theRecipients} to
origMsg's {class, account, source, storage, (properties of every recipient)}
set end of theRecipients to {recipient type:cc recipient,
address:{address:"email@hidden", display name:"Pepe"}}
make new msgClass at theFolder with properties {account:theAccount,
source:theSource, recipient: theRecipients}
delete origMsg -- puts into Deleted Items
delete origMsg -- expunges
end tell
That's pretty neat, and I recommend it. If you ever are editing messages
post-hoc, you would also want to get 'time received', 'replied to'.
'forwarded, 'redirected' 'resent', 'category' and 'links' properties to
reproduce. (Yes, you can make new incoming messages and sent messages by
script, which is what what allows you to import messages from outside the
current identity by AppleScript.) 'source' is pretty amazing: you can do
almost anything when you've got the message source.
Again, with a generic script using variables, put \" \" around the display
name of new recipients unless its = "".
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.