Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 29, 2012, 06:49 PM   #1
JordanJ
macrumors member
 
Join Date: Mar 2012
Location: Australia
Send a message via Skype™ to JordanJ
AppleScript with Mail

I am a newbie to AppleScript (I really should say dummie!) but have worked with a few programming languages before.

My situation is this:

Quote:
"I have become REALLY lazy with my mail. I usually get a lot of email from the same people / companies. I would like to set up a mac mail rule so that:

Once email is received from "sender@example.com", and is read, move to "Folder 3"

I have tried to set this up in Mac Mail Rules, (Preferences > Rules) but I cannot see an option for "Mail is Read" in the conditions box."
I am aware there is an AppleScript "property" for Mail (read status) but I am not sure how to implement this and the syntax for the script.

Is there a basic syntax that I should follow when using Apple Script?

NB: I am currently running OS X 10.7.5, however I will move to 10.8 in the near future. (Before the end of the year).

Thanks!
__________________
MacBook Pro with Retina Display (15", 2.6GHz, 16GB RAM, 512GB SSD) - iPhone 5 (Black, 64GB)
@jcjanssen - Twitter
JordanJ is offline   0 Reply With Quote
Old Nov 30, 2012, 02:22 PM   #2
kryten2
macrumors 6502a
 
Join Date: Mar 2012
Location: Belgium
Try this :
  1. Create new mailbox named Folder 3 in Mail. See Attached Images.
  2. Create new rule in Mail. See Attached Thumbnails. In Perform the following actions : choose Run Applescript and select the script you saved in step 3.
  3. Paste code in Script Editor and save script.

    Code:
    using terms from application "Mail"
    	on perform mail action with messages theMessages for rule theRule
    		tell application "Mail"
    			repeat with eachMessage in theMessages
    				if eachMessage's read status is true then
    					move eachMessage to mailbox "Folder 3"
    				end if
    			end repeat
    		end tell
    	end perform mail action with messages
    end using terms from
Attached Thumbnails
Click image for larger version

Name:	Picture 1.png
Views:	6
Size:	53.5 KB
ID:	380740  
Attached Images
 
__________________
Space Corps Directive 34124
kryten2 is online now   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Tags
applescript, mac, mail, rules

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump


All times are GMT -5. The time now is 02:23 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC