In Apple's Mail application, one can specify that an AppleScript script be run when a rule matches a message. However, when I write a script to take advantage of this ability, the script is passed the message previous to the new one in the list (or maybe the currently selected message - not sure). Searching around, I see other folks experiencing the same issue, such as here:
I'll file this as a bug with Apple, but in the mean time, does anyone have a workaround?
If you'd like to see this problem for yourself, just set up the sample script bundled with Snow Leopard. You'll find it at /Library/Scripts/Mail Scripts/Rule Actions/Sample Rule Action Script.scpt.