Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

amityweb

macrumors member
Original poster
Oct 5, 2010
40
1
Wales
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
 

amityweb

macrumors member
Original poster
Oct 5, 2010
40
1
Wales
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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.