Email Flags

Hey Mike,

Here it is all in AppleScript.

NOTE — To get the properties to save you MUST save the AppleScript as a compiled script using the Applescript Editor.app and run it from Keyboard Maestro as a compiled script.

-Chris

------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/11/10 22:30
# dMod: 2017/11/10 22:43
# Appl: Mail
# Task: Set selected email's flag to Red — increment though flags on successive activation of macro.
#     : Reset after moving to a new message.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Mail, @Macro @Set, @Selected, @Email, @Flag, @Red, @Increment, @Flags, @Successive, @Activation
------------------------------------------------------------------------------
property lastFlag : 0
property messageID : 0
------------------------------------------------------------------------------

tell application "Mail"
   set msg to item 1 of (get selection)
   
   tell msg
      
      if messageID ≠ id then
         
         set messageID to id
         set flag index to 0
         
      else
         
         if flag index = -1 then
            set flag index to 0
         else if flag index < 6 then
            set flag index to (flag index) + 1
         else
            set flag index to -1
         end if
         
      end if
   end tell
   
end tell

------------------------------------------------------------------------------
1 Like