Muffinresearch Labs by Stuart Colville

Mark all mail as read in mail.app | Comments (2)

Posted in Apple, Code on 25th May 2007, 7:51 am by Stuart

quicksilver prefs

Being a habitual user of NetNewsWire I find it quite annoying that mail.app 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"
	activate
	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 mail.app (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).

Post Tools

Comments: Add yours

1. On August 30th, 2007 at 9:10 pm macaddict89 said:

One elegant way of running the script is mail act-on from indev software. Set a button and run the applescript

2. On August 30th, 2007 at 9:13 pm macaddict89 said:

also, if theres a way to make this script dive into sub directories of imap folders (so it would be a one click wonder), I’d really like to know. My stupid college uses exchange, and the public folders always refresh as unread. A big pain that really pisses me off







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Ubuntu: add-apt-repository: command not found|(2)

When you’re using a minimal Ubuntu install if you find the ‘add-apt-repository’ command is missing (it’s useful for adding PPAs and other repositories), then simply run:

sudo apt-get install python-software-properties

Photos on Flickr

© Copyright 2004-12 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.499s.