Script is failing on on getting mailbox (Exchange)

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. Is it possible Automator can link into the Exchange folder structure, but AppleScript cannot? 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
 
 

any ideas?

Hi jayelevy,

I don’t have a solution, but is there some reason why you use the “.” in the name of the mailbox?

Editted: BTW, When references don’t work, I try to make the app give me the reference. Like:

tell app “Mail”
every mailbox
end tell

Then, I use one of those references and work my way down to the actual message.

gl,

Hi,

try this:


tell application "Mail"
	every message of inbox
end tell

It has been a while, so I’m experimenting also.

from the other example it grew to this: :slight_smile:


tell application "Mail"
	delete (every message of inbox whose sender is "gtracy@cs.wisc.edu")
end tell

Those apod emails really build up.

fwiw, I figured out what my problems was. . . incorrect reference to the subfolder.

New (and working! :D) portion of the script:


set theMoveToMailbox to "Inbox/. Do Later"
tell application "Mail"
move theMessage to mailbox theMoveToMailbox of account "Exchange"
end tell