New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Ľ Advice and insight from world-class Apple enthusiasts Ľ Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Apps and Games Discussion of applications and games available for Mac OS X.

An applescript to automagically mark message as "junk"

Post Reply New Thread Subscribe

Thread Tools

voiceofra's Avatar
Member Since: Mar 02, 2007
Location: St Helens, OR, USA
Posts: 250
voiceofra has a spectacular aura about
Mac Specs: MacBook CoreDuo 2Ghz 768M RAM

voiceofra is offline
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:
"I have severals rules that detect Junk messages which are not caught by 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?

What I came up with:
tell application "Mail" to activate
tell application "System Events"
	keystroke "j" using {command down, shift down}
end tell
After your 'junk' rule criteria are met, this script will automagically "press" command-shift j - the shortcut for selecting an item as junk mail.
Feel free to modify it, expand on it, etc.
QUOTE Thanks

Post Reply New Thread Subscribe

« Skype button for my mail signature | Mac getting older (poor thing) »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
[ANN] New comprehensive AppleScript book hanaan OS X - Development and Darwin 0 11-06-2004 07:28 PM
Looking for AppleScript help tommyabroad OS X - Operating System 2 04-14-2004 12:51 AM

All times are GMT -4. The time now is 04:58 PM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?