Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Go to next unread message in Mail via keyboard' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Go to next unread message in Mail via keyboard
Authored by: kevjava1 on Jun 08, '04 11:20:05AM
I've got an answer to the guy who wanted Thunderbird mode... I just built on top of the poster's script here to make it check to find the first mailbox with unread messages, then find the first unread message in that box.

The only issue is, it only searches the messages in "On My Mac". The others, however, have Cmd-1 through Cmd-5 hotkeys already assigned to them, though, so this doesn't distress me much. I have a bunch of filters set up, and I have one that just dumps everything else into On My Mac->Inbox if it doesn't match anything else.


try
	tell application "Mail"
		activate
		
		-- Find the first 'other' mailbox that has unread messages.
		set unreadMailboxes to (the mailboxes whose unread count > 0) as list
		if (count of unreadMailboxes) is not 0 then
			set selected mailboxes of the front message viewer to ¬
				{the first item of unreadMailboxes}
		else
			beep
		end if
		
		tell the front message viewer
			-- Find the first unread message in the current mailbox.
			set unreadMessages to (the messages whose read status is false) as list
			if (count of unreadMessages) is not 0 then
				set selected messages to {the first item of unreadMessages}
			else
				beep
			end if
		end tell
	end tell
on error error_message
	beep
	display dialog "Error looking for next unread message: " & ¬
		return & return & error_message buttons {"OK"} default button 1
end try



[ Reply to This | # ]