Skip to content

Instantly share code, notes, and snippets.

@scottslowe
Created June 15, 2013 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottslowe/5788136 to your computer and use it in GitHub Desktop.
Save scottslowe/5788136 to your computer and use it in GitHub Desktop.
This AppleScript moves the selected messages to the specified archive mailbox. You must make sure the mailbox exists; the script doesn't check for its existence.
-- This script moves messages to a mailbox for the current year
-- Set some default values to be used later in the script
property theMailbox : "Archive"
-- Handler called when running script from script menu
on run
tell application "Mail"
set theSelectedMessages to selection
if ((count of theSelectedMessages) < 1) then
beep
return
end if
repeat with theMessage in theSelectedMessages
if (read status of theMessage) is false then
set read status of theMessage to true
end if
move theMessage to mailbox theMailbox
end repeat
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment