Hi everyone,
I am currently writing my first piece of Apple Script - so please be patient.
I want a script which activates Mail and then displays (within the message viewer) the most recently delivered mail messages. I plan to use this with a quicksilver trigger.
So far I have written:
tell application “Mail” to activate
tell application “System Events”
click menu item “Message Viewer” of ((process “Mail”)'s (menu bar 1)'s ¬
(menu bar item “Window”)'s (menu “Window”))
click menu item “Drafts” of ((process “Mail”)'s (menu bar 1)'s ¬
(menu bar item “Mailbox”)'s (menu “Mailbox”)'s ¬
(menu item “Go To”)'s (menu “Go To”))
click menu item “Inbox” of ((process “Mail”)'s (menu bar 1)'s ¬
(menu bar item “Mailbox”)'s (menu “Mailbox”)'s ¬
(menu item “Go To”)'s (menu “Go To”))
end tell
Which does the trick in a clunky way. The reason I go to Draft before going to Inbox is that this was the only way I could find to clear the search bar, since if the search bar is filled the jump to Inbox often fails.
Another problem with the script is that it only really takes you to the Inbox, and the new messages will only be displayed if Inbox has the correct sort order.
I would like a more elegant solution. Any tips?
Very grateful for any advice you guys can give.
Cheers,
Dan
Model: MacBook
Browser: Firefox 3.0
Operating System: Mac OS X (10.5)