- Joined
- Mar 2, 2007
- Messages
- 250
- Reaction score
- 18
- Points
- 18
- Location
- St Helens, OR, USA
- Your Mac's Specs
- MacBook CoreDuo 2Ghz 768M RAM
While trying to help someone over on another mac forum (because nobody else was offering anything useful to the topic originator) , I wrote my first useful Applescript (up until now, I'd modified existing scripts or done VERY basic things with it) and thought others here might find it of use.
What he was looking for:
After your 'junk' rule criteria are met, this script will automagically "press" command-shift j - the Mail.app shortcut for selecting an item as junk mail.
Feel free to modify it, expand on it, etc.
What he was looking for:
What I came up with:"I have severals rules that detect Junk messages which are not caught by Mail.app built-in Junk filter. My rules move this to the Junk folder. However, Mail doesn't mark them as Junk (obviously, since I haven't found a way to tell Mail -> "Mark this as Junk"). This means I have to go to my Junk mailbox, and manually mark all these messages as Junk.
Any ideas on how to avoid doing this manually and tell Mail to mark something as Junk?
Thanks!
Code:
tell application "Mail" to activate
tell application "System Events"
keystroke "j" using {command down, shift down}
end tell
Feel free to modify it, expand on it, etc.