Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Nov 29, 2012, 07: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, 03: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:	15
Size:	53.5 KB
ID:	380740  
Attached Images
 
__________________
Space Corps Directive 34124
kryten2 is offline   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

Similar Threads
thread Thread Starter Forum Replies Last Post
Simple AppleScript for mail.app JosCiv OS X 0 Jul 26, 2013 12:32 PM
Bulk export Notes from Mail.app with Applescript? tails-4 Mac Programming 0 Dec 4, 2012 09:36 PM
[OS X 10.8.2] AppleScript Mail script help moonman239 Mac Programming 4 Nov 27, 2012 07:32 PM
How does one select the Archive folder in Mail using Applescript? amityweb Mac Programming 1 Nov 15, 2012 08:20 AM
Using applescript with ML mail andymac2210 OS X 10.8 Mountain Lion 6 Aug 30, 2012 02:35 PM

Forum Jump

All times are GMT -5. The time now is 06:21 PM.

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

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