AppleScript Move Mail Message

August 8, 2011

I upgraded to OS X Lion and the AppleScript I was using to move a selected mail message to another mailbox broke. Here is the offending script:

tell application "Mail"
 move selection to mailbox "@action"
end tell

It looks simple enough, so I don’t understand exactly why it stopped working. I searched around and found something to try in the Mac OS X Hints section of Macworld.

I modified the script a little bit and came up with this:

tell application "Mail"
    set _msgs to selection
    set _mailbox to "@action"
    repeat with _msg in _msgs
        tell application "Mail"
            move the _msg to mailbox _mailbox
        end tell
    end repeat
end tell

I made two more like this one for my @reply and @waiting mailboxes. These all get processed with a keyboard shortcut via FastScripts.

blog comments powered by Disqus