On or near 5/20/02 11:47 AM, Dan Frakes at [EMAIL PROTECTED] observed:
> If I run the script on a new message that hasn't been saved, I get the prompt
> asking me what I want before the @ symbol; when I enter it, and hit return, I
> get the following error:
>
> Can't get item 1 of {}
Okay, the thing is a draft window that hasn't been saved does not have a
message ID yet. So "current messages" returns the empty set. You have to
force the window to be saved first, like this:
if class of the front window is draft window then
try
save the front window
end try
end if
Put that code right before the line, "set theMsg to item 1 of (get current
messages)".
>
> When I run the script on a message that has been saved first, I get the prompt
> asking me what I want before the @ symbol; when I enter it, and hit return, it
> changes the return address in the MISC account (I checked) but it doesn't
> change the account in the current message.
>
> Did I miss something obvious? ;)
>
I don't think so. Couple of questions. Are you absolutely sure the account
did not change? One thing that is bizarre about draft messages is that the
display of the window does not always change when you change something by
script. Try this (after adding the above code to handle saving
automatically): start a message, run the script, and then close the message
without saving. Now, in the Drafts folder, open it again. I think you will
see that the account HAD changed. It works for me.
Notice this, too. If you make alterations to the message after running the
script and then save the message, you will OVERWRITE the message with the
changed account.
In other words, you've got a copy saved on disk and one in memory, which is
what is displayed in the window.
The safest thing, something I do with similar scripts that work with drafts,
is this:
After you have the message id, "close the front window".
Make the change to the account.
Now "open theMsg" to display the changed message.
--
My web page: <http://home.earthlink.net/~allenwatson/>
My scripts page: <http:homepage.mac.com/allenwatson>
Microsoft MVP for Mac Entourage/Word--<[EMAIL PROTECTED]>
--
To unsubscribe:
<mailto:[EMAIL PROTECTED]>
archives:
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>