Automating the Keyboard Maestro Editor with AppleScript


RENAME THE SELECTED ACTION


Hey Folks,

Here’s how to automate the [Rename] contextual-menu item for the selected action.

If more than one action is selected then the contextual-menu pops open to allow you to type-select.

Run it from an Execute an AppleScript action.

-Chris

------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2017/05/22 14:45
# dMod: 2017/05/22 14:53 
# Appl: Keyboard Maestro Editor
# Task: Select Rename in the contextual menu of the selected action.
#     : If more than 1 action is selected bring up the contextual menu.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Keyboard_Maestro, @System_Events, @Select, @Rename, @Contextual_Menu, @Menu, @Selected, @Action
------------------------------------------------------------------------------

tell application "System Events"
   tell application process "Keyboard Maestro"
      tell window "Keyboard Maestro Editor"
         tell group 1
            tell splitter group 1
               tell scroll area 3
                  set selectedGroups to groups whose selected is true
                  if selectedGroups ≠ {} then
                     set theAction to item 1 of selectedGroups
                     tell theAction
                        perform action "AXShowMenu"
                        tell menu 1
                           tell menu item "Rename…"
                              perform action "AXPress"
                           end tell
                        end tell
                     end tell
                  end if
               end tell
            end tell
         end tell
      end tell
   end tell
end tell

------------------------------------------------------------------------------
2 Likes