Hi, all,
I’m using the following script in conjunction with Quicksilver hot keys to move emails to an archive box (2009 Archives). When the email is moved, no messages are selected, so the last line of the script before the end tell (picked up from someone in these forums) selects the last message in my box. What I’m looking to do, however, is to, instead of showing the last message in the box, select the message after the message that had just been moved. I think one could get the message id of the last message in the selection, find that message in the list of messages in the selected mailbox, store an incremented index of that message, move the selected messages, and then select the “next message” via the stored index from the messages in the selected mailbox. Unfortunately, this seems to be beyond my ability in terms of working with applescript objects in lists, because I, for the life of my, cannot get it to work.
tell application "Mail"
set theMessages to selection
repeat with eachMessage in theMessages
move eachMessage to mailbox "2009 Archives"
end repeat
tell message viewer 1 to set selected messages to {first message of beginning of (get selected mailboxes)}
end tell
If someone can point me to or append that sort of code, I would be might grateful. Maybe there’s an easier way as well, but if there is, I’m not finding it.
Thanks!