The personal website of Matt Henderson.
04 March 2005
Have a look at the following, which is the AppleScript code needed to move a selected message(s) in Apple Mail to another folder:
property target_mailbox : "@Waiting for..." property target_account : "Work" using terms from application "Mail" on perform mail action with messages the_selection if the_selection = {} then beep return end if tell application "Mail" repeat with i from 1 to (count of the_selection) set mailbox of (item i of the_selection) to mailbox target_mailbox of account target_account end repeat end tell end perform mail action with messages end using terms from using terms from application "Mail" on run tell application "Mail" to set sel to selection tell me to perform mail action with messages (sel) end run end using terms from
What is it with me and AppleScript? I can achieve just about anything I want in PHP, without having to refer much to examples. But in a million years I wouldn't have been able to write the above from scratch.
Enjoy this article? — You can find similar content via the category and tag links below.
Questions or comments? — Feel free to email me using the contact form below, or reach out on Twitter.