Skip to content

Instantly share code, notes, and snippets.

@yanyaoer
Created March 10, 2015 07:18
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 yanyaoer/e175fbf38faa7ea288b2 to your computer and use it in GitHub Desktop.
Save yanyaoer/e175fbf38faa7ea288b2 to your computer and use it in GitHub Desktop.
-- ref: http://daringfireball.net/2007/07/simplgge_inbox_sweeper
-- gist: https://gist.github.com/gruber/1063605
set _desc to "archive all readed msg at inbox; then mark other msg as read"
tell application "Mail"
set _archive_box to mailbox "Archive"
set _msgs_to_move to (a reference to ¬
(every message of inbox ¬
whose flagged status is false and read status is true))
set _msg_list to contents of _msgs_to_move
if (_msg_list's length > 0) then
move _msgs_to_move to _archive_box
end if
set read status of every message of inbox to true
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment