Copy HotKey triggers?

Is it possible to copy just hotkeys as text?

I'm trying to index all my macros, and it would be helpful to copy/paste the macro names, then copy/paste the macro triggers.

Not really, no.

You could do it via AppleScript, or you could select all the macros and choose Copy as ➤ Copy as Text, and then do a bit of processing on the text to find all the Hot Key triggers.

Here's an AppleScript to help get you started. It is a bit slow, taking ~6 sec to process ~3,000 macros. But it should be good enough. :wink:

==UPDATED==: 2020-08-05 11:29 GMT-5

How To Use

courtesy of @MikeMcC

property ptyScriptName : "Get List of Macros and Their Hot Key Triggers of Selected Macros"
property ptyScriptVer : "1.0"
property ptyScriptDate : "2020-08-04"
property ptyScriptAuthor : "JMichaelTX"


tell application "Keyboard Maestro"
  set macroList to selected macros
  set trigList to {}
  
  set OTID to AppleScript's text item delimiters
  set AppleScript's text item delimiters to {"Key ", " is"}
  
  repeat with oMacro in macroList
    set macroName to name of oMacro
    
    set macroTrigList to description of (triggers of oMacro whose description contains "Hot Key")
    
    repeat with oTrig in macroTrigList
      set trigParts to text items of oTrig
      set trigStr to item 2 of trigParts
      
      --- Set Output of Trig List ---
      set end of trigList to trigStr & tab & macroName
      
    end repeat
    
  end repeat
end tell

set AppleScript's text item delimiters to linefeed

return trigList as text

It returns a text list, one line per Hot Key - Macro pair, tab delimited.
Looks something like this:

⌃V	Trim First & PASTE with Option to Delete Clipboard from History
F1	Trim First & PASTE with Option to Delete Clipboard from History
⌃T	[BRW] Choose Select  Activate Tab From List of Front Window Tabs in Chrome, BB, or Safari
F2	[BRW] Choose Select  Activate Tab From List of Front Window Tabs in Chrome, BB, or Safari
⌃⌥L	LINK - E -- Evernote - Paste FILE Hyperlink from SELECTION in Finder or PF into EN Note @EN
⌃⌥L	LINK - M -- Link to Edit KM MACRO  @KM
⌃⇧E	NOTE - Create New Note(s) From Finder or PF Selection @EN
F12	[KMFAM] Select or Switch to Insert Action by Name
⌘R	RUN Current Macro Shown in KM Editor @KM
⌃⇧Z	Move and Set Window Size Per App & @Win Name
⌃⇧A	Get Alert Comments in TOS
⌃⌥⌘C	Auto-Select Forum Post or Script and Copy to Selected App @DEV @Brave

Have fun!

4 Likes

Holy Moly. Above and beyond.

Thanks!

Thanks again - It works!

Just FYI for anyone else:
The script will find the name and Hot Keys for selected macros
i.e. First select some/all macros in the Macros column of KM editor.
Then run the script.
Then find something to do with all your new found spare time.

1 Like

This is awesome! I sure miss JMichaelTX.

3 Likes