Last active
December 19, 2015 17:19
-
-
Save stereoket/5990791 to your computer and use it in GitHub Desktop.
Applescript for Mail.app to manage a workflow for your INBOX Zero - its simply moves the mail and is the last in a chain of pre-existing rules (this script is designed to work with MailTags plugin for Mail by Indev)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using terms from application "Mail" | |
on perform mail action with messages these_messages for rule this_rule | |
tell application "Mail" | |
display dialog ¬ | |
"Choose a follow up action" buttons {"Review", "Archive", "Cancel"} ¬ | |
default button "Cancel" | |
--set userSelection to value of button returned of result | |
if result = {button returned:"Cancel"} then | |
else if result = {button returned:"Archive"} then | |
set archiveMBX to mailbox "Archives" of account "xxxx" | |
set theSelection to selection | |
set countVal to count of theSelection | |
--name of every account | |
using terms from application "MailTagsHelper" | |
repeat with i from 1 to countVal | |
set theMessage to item i of theSelection | |
--get priority of theMessage | |
set keywords of theMessage to "archived" | |
set priorityVal to count of priority of theMessage | |
set priority of theMessage to 2 | |
--get subject of theMessage | |
set mailbox of theMessage to archiveMBX | |
end repeat | |
end using terms from | |
else if result = {button returned:"Review"} then | |
set reviewMBX to mailbox "Review" of account "xxxx" | |
set theSelection to selection | |
set countVal to count of theSelection | |
using terms from application "MailTagsHelper" | |
repeat with i from 1 to countVal | |
set theMessage to item i of theSelection | |
--get priority of theMessage | |
set keywords of theMessage to "@Followup" | |
set priorityVal to count of priority of theMessage | |
if priorityVal is 0 then | |
set priority of theMessage to 3 | |
end if | |
--get subject of theMessage | |
set mailbox of theMessage to reviewMBX | |
end repeat | |
end using terms from | |
end if | |
end tell | |
end perform mail action with messages | |
end using terms from |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment