How List Active KM Macros With Their Keyboard-Triggers?

Is there a way in KM to collect the macro titles and their Keyboard-trigger as a list?

It just recently happened that I lost the (manually aggregated) database of all macros with their Keyboard-triggers due to Dropbox’ unreliability.

All the best,

Hey Omar,

You need at least the freeware version of BBEdit for this.

This is all macros not just active ones. I suppose I could filter out disabled macros if needed.


Download: Export Macro Group Names- Macro Names- and Macro Triggers to BBEdit v1.00.kmmacros (8.7 KB)


Keyboard Maestro Export

  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 10.14.6
  • Keyboard Maestro v10.2


Here's a modified script that will get only the ENABLED macros.

# Auth: Christopher Stone
# dCre: 2018/10/26 13:47
# dMod: 2023/03/22 17:56
# Appl: Keyboard Maestro Editor, Keyboard Maestro Engine, BBEdit
# Task: Export Names and Triggers of All ENABLED Keyboard Maestro Macros.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Keyboard_Maestro, @Keyboard_Maestro_Engine, @Display, @Names, @Triggers, @Keyboard_Maestro, @Macros
property LF : linefeed

set firstGroup to true
set macroCollatorList to {}
set AppleScript's text item delimiters to tab

tell application "Keyboard Maestro"
   set macroGroupList to macro groups
   repeat with macroGroup in macroGroupList
      set macroList to (macros of macroGroup whose enabled is true)
      if firstGroup is true then
         set end of macroCollatorList to "MACRO GROUP: " & name of macroGroup & LF
         set firstGroup to false
         set end of macroCollatorList to LF & "MACRO GROUP: " & name of macroGroup & LF
      end if
      repeat with theMacro in macroList
         tell theMacro
            set end of macroCollatorList to tab & name & tab & description of triggers as text
         end tell
      end repeat
   end repeat
end tell

set end of macroCollatorList to LF

set AppleScript's text item delimiters to linefeed
set macroCollatorList to macroCollatorList as text

set macroCollatorList to kmReplace("The Hot Key | is pressed", "", macroCollatorList, true, false, false)
set macroCollatorList to kmReplace(" +$", "", macroCollatorList, true, false, false)

bbeditNewDoc(macroCollatorList, true)

on bbeditNewDoc(_text, _activate)
   tell application "BBEdit"
      set newDoc to make new document with properties {text:_text, bounds:{0, 44, 1920, 1200}}
      tell newDoc
         select insertion point before its text
      end tell
      if _activate = true or _activate = 1 or _activate = "activate" then activate
   end tell
end bbeditNewDoc
on kmReplace(findPattern, replacePattern, dataStr, regExBool, caseBool, tokensBool)
   tell application "Keyboard Maestro Engine"
      set foundDataList to search dataStr for findPattern replace replacePattern ¬
         regex regExBool case sensitive caseBool process tokens tokensBool
   end tell
end kmReplace