AppleScript with Mail

Discussion in 'Mac Programming' started by JordanJ, Nov 29, 2012.

  1. macrumors member

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

    My situation is this:

    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).

  2. macrumors 6502a

    Mar 17, 2012
    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.

      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 Files:

Share This Page