How does one select the Archive folder in Mail using Applescript?

Discussion in 'Mac Programming' started by amityweb, Nov 13, 2012.

  1. macrumors newbie

    Joined:
    Oct 5, 2010
    Location:
    Wales
    #1
    Does anyone know how to select the Mail Archive folder in Mail using Applescript?

    This code does not work, BUT if I change Archive to any other folder it works fine. It is only the Archive folder which is not working!
    Code:
    tell application "Mail"
        set selected mailboxes of message viewer 1 to {mailbox "Archive"} of account "My Email"
    end tell
    Thanks
     
  2. thread starter macrumors newbie

    Joined:
    Oct 5, 2010
    Location:
    Wales
    #2
    Hi. I am using this in a script to process emails in a "Follow Up" folder to create a task in Omnifocus. I found that when I move mesages to another folder, Mail still thinks that message is in there and keeps processing it. So selecting the destination folder (Archive) makes Mail not keep that message in the original folder.

    Anyway, this script on its own does not work (so nothing to do with the rest of my script). I just cannot see how to select the folder using Applescript. So I keep getting duplicate tasks created. I need to select the Archive folder in my automated applescript.

    Thanks
     

Share This Page