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/09/2012 - New Specs on Podlove.org
05/09/2012 - Excellent Write-up of Instacast 2.0
05/07/2012 - Instacast 2.0 Available
05/06/2012 - Instacast HD Rejected over Flattr Integration
05/02/2012 - Multi-Format Podcast Feeds
04/26/2012 - Instacast 2.0 First Impressions
04/05/2012 - Patching iCloud Sync
03/29/2012 - The Podlove Initiative
03/28/2012 - Auphonic now Open for the Public
03/26/2012 - What's next with Instacast?
03/26/2012 - State of Support and iCloud