Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

AppleScript failing on getting mailbox

I'm working on an Automator action to find all messages in a particular Mail folder (named ". Do"), create Reminders for each, and then move the messages from the ". Do" folder to a separate folder (named ". Do Later")


The first portion is working fine. That is, using Automator, I can find the relevant messages by using the Get Specified Mail Items action linked to a Filter Mail Messages action. The Get Specified Mail Items looks at <mailbox ". Do" of account "Exchange"> . These two actions work fine. I see all relevant messages in the Automator results window for my Filter Mail Messages action.


I then launch an applescript to process the found messages, move them to Reminders and then move the messages from the ". Do" folder to my suspense folder (". Do Later"). The first part of the script works fine. The messages are found and new Reminders are created with all of the meta data I've created. However, I can't get the last step to work to move the messages to a new folder.


The script continues to abort with the error "Can't get mailbox ". Do Later" of account "Exchange". See below for the relevant portion of the script. I'm an AppleScript novice (clearly!). It seems i'm not forming the correct reference to the ". Do Later" folder. I can't figure out how to troubleshoot any further to either debug the script failure or to inspect the Mail folder structure to insure I'm usring the right reference.


Any tips? thanks -- jay


# theMessage contains current message being processed


# Move message out of . Do

set theMoveToMailbox to ". Do Later"

tell application "Mail"

move the theMessage to mailbox theMoveToMailbox of account "Exchange"

end tell



Mountain Lion


Message was edited by: jayelevy

Posted on Mar 25, 2013 8:28 PM

Reply
3 replies

Apr 21, 2013 10:43 AM in response to pjdube

pjdube - thanks for the offer of assistance.


I finally solved my problem. I did have an incorrect mailbox reference. FWIW, the corrected reference needed to be:


set theMoveToMailbox "Inbox/. Do Later"


Simple omission of "Inbox"!!


I also stumbled my way through and got rid of the Automator dependency... now all applescript. Problems solved now and the script works like a charm!

AppleScript failing on getting mailbox

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.