Created
February 17, 2010 19:26
-
-
Save fortybillion/306931 to your computer and use it in GitHub Desktop.
Mail.app "Next Unread Message"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Mail" to try | |
set mailAccounts to every account | |
set messageFound to false | |
repeat with acc in mailAccounts | |
if not messageFound then | |
try | |
set unreadMessage to {last message of mailbox "INBOX" of acc whose read status is false} | |
set messageFound to true | |
set accountWithUnread to acc | |
end try | |
end if | |
end repeat | |
if accountWithUnread exists then | |
tell message viewer 1 | |
set selected mailboxes to {first mailbox of accountWithUnread whose name is "INBOX"} | |
delay 0.1 | |
set selected messages to unreadMessage | |
end tell | |
end if | |
activate | |
on error | |
beep | |
end try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment