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

05/04/2013 - Tips and Tricks Part Three (Sharing and Accounts)
05/03/2013 - Instacast for Mac - Tips and Tricks Part Two (System Functions)
05/02/2013 - Instacast for Mac - Tips and Tricks Part One (Playback)
05/01/2013 - Instacast for Mac - Public Beta Available
01/23/2013 - Poodle Search Engine - Update
01/18/2013 - Poodle - An Experimental Search Engine for Podcasts
12/15/2012 - Integrate with Instacast
12/12/2012 - Instacast's Automatic Download Management
12/09/2012 - More about our Cloud Sync
12/06/2012 - Instacast 3.0 Available
09/13/2012 - Instacast Memberships