Blog Posts

My Inbox Archiving Apple Script for Apple Mail

Like many other power users I am using a simple approach to email: Inbox Zero. The goal is to clean up your email inbox at the end of the day. Emails you've already processed are moved to an Archive folder. I've seen a lot of Apple Scripts in the wild to move emails to a local Archive folder or all emails to IMAP Archive folders for every account. But I did not came across a script that only moves selected emails to IMAP Archive folders. Hence being a nerd, I wrote my own:

tell application "Mail"
  set _sel to the selection

  repeat with _message in _sel
    set _mb to mailbox of _message
    set _acct to account of _mb

    try
      set _archive_box to _acct's mailbox "Archive"
    on error
      display alert "No “Archive” mailbox found for account “" & ¬
        _acct_name & "”."
      return
    end try

    move _message to _archive_box
  end repeat

end tell

The script above iterates over every selected email message, searches for an 'Archive' folder in the respective account and moves it to this folder. I am using FastScripts by Red Sweater Software to invoke the script using cmd+shift+A.

This work is derived from the 'Simple Inbox Archiving Script for Apple Mail' by John Gruber of Daring Fireball.

July 13th, 2011 • Permalink


More articles about Blog Posts

06/27/2014 - Instacast Cloud Memberships
06/06/2014 - Instacast 4.6 and Instacast Cloud
03/26/2014 - Sharebox adds Drag & Drop sharing to the Dropbox menubar icon
01/22/2014 - Instacast 4.2 adds News Mode
01/12/2014 - Hello 2014
11/07/2013 - Instacast Available on the Mac App Store
10/23/2013 - New Payment Option: Bitcoin
10/21/2013 - Spotlight... The Psych Files
10/02/2013 - Instacast Cloud Sync Outage
09/21/2013 - Quick Tips for Instacast 4
09/18/2013 - Instacast 4 Available for iOS 7