Mark all as read in Mail via AppleScript

Oct 05, '09 07:30:04AM

Contributed by: ptone

I've always been annoyed that the only way to mark all as read for a mailbox in Mail was with a contextual menu in the sidebar. So I wrote a simple AppleScript to do the job:

tell application "Mail"
  activate
  get message viewer 1's selected mailboxes
  repeat with thisBox in result
    set read status of (messages of thisBox whose read status is false) to true
  end repeat
end tell
I use Butler (but any such tool capable of creating macros would work) as my quick launch keyboard macro tool, and I've assigned the above script to run when I press Command-K (to match my NetNewsWire usage).

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20090916094154541