Mark all mail as read in

quicksilver prefs

Being a habitual user of NetNewsWire I find it quite annoying that doesn't have a mark all as read button. However there is a context menu that you can use mark all mail in the selected mailbox as read. Trouble with that is that it's too clunky. I want to be able to mark a mailbox as read super-quickly. Because of that I hacked together this little applescript.

tell application "Mail"  
    get message viewer 1's selected mailboxes
    repeat with thisBox in result
        set read status of (every message of thisBox whose read status is false) to true
    end repeat
end tell

This simply loops through all message in the selected mailbox and marks them as read. Now I couldn't find a simple way to put this as a button so instead I opted to set this script to run as an applescript via a trigger in QuickSilver.

This is really straight forward. Load the script into Script Editor and save it as a script (not an app or it will be far slower). Next open Quicksilver's preferences and set-up a trigger pointing at the script. If Quicksilver can't find it try updating the catalogue to look at applescripts. Next set a hotkey of your choice and set the scope to mail so that this script will only run from within (type mail and hit tab).

Possible improvements:

I'm fairly new to Applescript so you might be able to write this more efficiently, if so, share your wisdom! I'd really like to add this as a button in the toolbar of mail (If anyone knows a way to do this please drop a link in the comments).

comments powered by Disqus