Last active
October 27, 2018 07:08
-
-
Save poritsky/5272217 to your computer and use it in GitHub Desktop.
A work-in-progress script to add MailTags keywords to messages in Mail based on sender. Uses GUI scripting and you'll have to jump through some hoops to add this to a workflow, but it may be of use. Toughest part is adding new addresses to it. Also note: the tags in the script must "Preferred Keywords" to be in your menubar.
This file contains hidden or 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
# Automate MailTags Tagging | |
# by Jonathan Poritsky | |
# http://candlerblog.com | |
# | |
# Instructions for editing inline. | |
tell application "Mail" | |
activate | |
set m to (selection) | |
set s to (extract address from sender of item 1 of m) | |
if (s contains "@gmail.com") or (s contains "[email protected]") then --edit email addresses in quotes. To add more addresses add another "or (s contains...)" before "then". | |
tell application "System Events" | |
tell menu "Add MailTags Keyword" of menu item "Add MailTags Keyword" of menu "MailTags" of menu item "MailTags" of menu "Message" of menu bar item "Message" of menu bar 1 of application process "Mail" | |
click menu item "@tag" --pick your tag name here | |
end tell | |
end tell | |
else if (s contains "[email protected]") then --Same as above | |
tell application "System Events" | |
tell menu "Add MailTags Keyword" of menu item "Add MailTags Keyword" of menu "MailTags" of menu item "MailTags" of menu "Message" of menu bar item "Message" of menu bar 1 of application process "Mail" | |
click menu item "@othertag" --Here's the next tag | |
end tell | |
end tell | |
-- Copy and paste from previous "else if" to here to add more rules for tags. | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment