If you've ever explored the possible actions offered by Mail's rules, you've probably wished that you could apply some of them to any message on command. For example, you might want to move the selected messages to one mailbox or another at the press of a hotkey, or to replicate Eudora's labels by changing the text color of messages in their mailboxes (Mail's GUI only allows changing their background color, which I dislike as much as OS X's Finder labels).
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!)
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
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100204220332317