On Sep 26, 2011, at 11:50 AM, Shuba and Karthik wrote: How do I *select* a message in the message viewer of Apple Mail given the message ID?
Here's a snippet of code that I use ...
tell application "Mail" activate try set frontViewer to (some message viewer whose index is 1) on error my showInstruction("A message viewer window must be open and frontmost in Mail.") return end try set msgList to selected messages of frontViewer try if (count items of msgList) = 0 then error set selected messages of frontViewer to {item 1 of msgList} on error my showInstruction("You have not selected any messages to save.") return end try
In this snippet, item 1 of msgList is of class 'message' where msgList is a list of messages. I don't know if you can do the selection if all you know is the message id, however, at some point in your script you had to have a line of code like this ...
Keep msg around so you can select the message.
|