Feb 08, '10 07:30:03AM • Contributed by: flip
The problem is that Mail's rules are intended to run automatically on incoming or outgoing emails, so such "manual" rules cannot easily coexist with automatic rules. The good news is that it's very easy to work around that conflict using AppleScript and Keyboard Maestro.
The trick is to group the "manual" rules at the top of the list, end each of them with with 'Stop evaluating rules,' and to keep them disabled so they won't interfere with automatic rules. To run one of these rules manually, you need a Keyboard Maestro macro that will enable that particular rule via AppleScript, tell Mail to 'Apply Rules' (which will run it on the selected messages), and then to disable the rule.
For example, let's make a rule that will move the selected messages to the mailbox named Important. From Mail's preferences, create a new rule named 'Move To Important' and set it like this:
If [any] of the following conditions are met:Click OK to save and close the rule. Then make sure to uncheck its "Active" checkbox and move it above any rule intended to run automatically. Don't skip this step!!
[every message]
Perform the following actions:
[Move Message] to mailbox [Important]
[Stop evaluating rules] (don't forget that one!)
Then create a new macro in Keyboard Maestro, in a group that makes it active when Mail is frontmost, and set its actions to:
Execute AppleScript:Give this macro a hotkey, and you're done!
tell application "Mail" to set enabled of rule "Move To Important" to true
Type the keystroke:
⌥⌘L (the shortcut for Mail's Message » Apply Rules menu item)
Execute AppleScript:
tell application "Mail" to set enabled of rule "Move To Important" to false
Alternatively, if you prefer to run those rules by clicking on buttons instead, you could use Keyboard Maestro's palette, or you could could save an AppleScript script that triggers this macro (Keyboard Maestro will give you the contents of that script) and drop it into a DragThing dock. The possibilities are almost infinite.
When I first got the idea to do this, I was afraid it could interfere with automatic rules if Mail happened to download mail at the same time I ran a manual rule, but I've used lots of such rules for more than a year, now, without any problem. Just don't trigger a manual rule while Mail is already downloading mail, and you shouldn't run into any problem either. Enjoy!
