I, like many other people, spend a lot of time in Mail.app moving messages to different folders. This is really a waste of time; a keyboard command would be much faster. So, inspired by a post on Lessig’s blog, I finally figured out how to do it (mostly because of the great information there).

Note: This tip may only work on Mac OS X 10.3 Panther, which comes out soon.

First, open the Script Editor (/Applications/AppleScript/Script Editor). Then, copy this script into a new script, replacing target_mailbox and target_account with the names of the mailbox and account you want the script to move messages to:

property target_mailbox : "2003"
property target_account : "IMAP"
using terms from application "Mail"
	on perform mail action with messages the_selection
		if the_selection = {} then
		end if
		tell application "Mail"
			repeat with i from 1 to (count of the_selection)
				set mailbox of (item i of the_selection) to mailbox target_mailbox of account target_account
			end repeat
		end tell
	end perform mail action with messages
end using terms from
using terms from application "Mail"
	on run
		tell application "Mail" to set sel to selection
		tell me to perform mail action with messages (sel)
	end run
end using terms from

Now save the script with a name like MyMover___ctl-s.scpt (that thing in the middle is three underscores; make sure not to change ctl to ctrl). Go back to mail, select “Update Scripts Menu” from the scripts menu.

Now, whenever you type Ctrl-S, the selected message will be moved to target_mailbox.

I have it set up so that Ctrl-A moves the message to my archive folder, Ctrl-S moves it to the spam folder, and Ctrl-D deletes.

The only thing missing is I wish I didn’t have to hold down a modifier key (like Ctrl) to activate the script, but it seems to be a requirement.

originally posted October 10, 2003 04:20 PM (Technology) #


Comprehensive Reponse to All Arguments Against Gay Marriage
Meeting Justice Kennedy
Poison Dart Guns or Solving Politics with Technology
The Evening News
Shades of Gray
Mail.app Mutt