[Feature Request] Go to Macro in Execute a Macro

Hey Folks,

Okay, let’s build upon the “Extract Keyboard Maestro action or macro plist from the clipboard” script.

Open a macro that has an Execute a Macro action in it.

Select that action.

Copy it to the Clipboard.

Run the script.

Find yourself editing the macro called by the selected Execute a Macro action.

-Chris

---------------------------------------------------------------------------------
# Auth: Christopher Stone { Heavy Lifting by Shane Stanley }
# dCre: 2016/06/03 22:05
# dMod: 2016/06/04 01:16
# Appl: Keyboard Maestro
# Task: GO-TO macro of selected “Execute a Macro” action in the Keyboard Maestro Editor.
# Aojc: True
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @Extract, @Keyboard_Maestro, @Plist
---------------------------------------------------------------------------------
use AppleScript version "2.4"
use framework "Foundation"
use scripting additions
---------------------------------------------------------------------------------

set kmPlistStr to missing value
set actionUUID to missing value
set systemPasteBoard to current application's NSPasteboard's generalPasteboard()

if (systemPasteBoard's canReadItemWithDataConformingToTypes:{"com.stairways.keyboardmaestro.actionarray"}) as boolean then
  # Copied Action or Actions
  set kmPlistStr to systemPasteBoard's stringForType:"com.stairways.keyboardmaestro.actionarray"
end if

if kmPlistStr ≠ missing value then
  set kmPlistStr to kmPlistStr as text
  
  tell application "System Events"
    set actionPlistRecord to value of (make property list item with properties {text:kmPlistStr})
    set actionUUID to MacroUID of item 1 of actionPlistRecord
  end tell
  
  if actionUUID ≠ missing value then
    tell application "Keyboard Maestro"
      editMacro actionUUID
    end tell
  end if
  
else
  beep
end if

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