How to Display a List of Triggers

Howdy folks, been a while. Mostly because I have Keyboard Maestro working pretty much just how I want it these days.

However, I just recently got a programmable USB keyboard that is dedicated to triggering macros. But I'm having a hard time remembering which keys trigger which macros.

What I'd like to do is create a macro that shows a list of the keyboard's keys and their corresponding macros. I came across several threads about exporting in one way or another lists of macros and their triggers but they were all several years old.

So my question is: what's the easiest way to show a list of macro triggers, and is there a way to have this list update automatically as I add new macros and/or change their triggers?

Thanks for any suggestions!

Have you tried the built-in Macro panel (center panel)?
It shows the Macro name and triggers, and you can sort by triggers by clicking on the down triangle at the top, or by menu/shortcut View > Sort macros by >

To see ALL macros, just select the "All Macros" Macro SmartGroup at the top.

Yea I use that extensively for certain things. But what I'm trying to accomplish is just to open a window that shows the triggers for only certain macros that are scattered throughout a variety of macro groups.

Right now I have them saved in a PDF that I open with Preview and position in the top right corner of the screen. It works pretty good, I just was wondering if there's any way to show something that updates dynamically.

have you looked into using palettes? I use them for macros that are application specific so that I don't have any possibility of accidentally triggering them in other applications and I don't need to remember anything (except to glance at the palette and actually use them!).

Thanks for the suggestion! But, yes I use palettes quite extensively. My situation is there are certain macros that I use universally and want them accesible from any app even though they're organized into different macro groups. So I don't want to have to have them all lumped together in one macro group just to use a palette.

Hey Chris,

KeyCue is a possibility.

This too might be worth a look as it can be customized quite a lot:

Export Names of all Macros in the Selected Group to CSV or Excel - #11 by ccstone


This AppleScript might get you started:

use framework "Foundation"
use scripting additions

property this : a reference to the current application
property nil : a reference to missing value
property _1 : a reference to specifier

property NSArray : a reference to NSArray of this
property NSMutableArray : a reference to NSMutableArray of this
property NSPredicate : a reference to NSPredicate of this
property NSSortDescriptor : a reference to NSSortDescriptor of this
property NSString : a reference to NSString of this

to getTriggers for triggerTypes as list
		property id : "com.stairways.keyboardmaestro.editor"
		property km : application id id
		property _M : a reference to every «class MKma» of km
		property _T : a reference to every «class MKmt» of _M
		property xml : a reference to «class MTxm» of _T
		property triggerType : "MacroTriggerType"
		property keyCode : "KeyCode"
		property modifiers : "|modifiers|"
		property notKeys : ["FireType", "ElementUsage", "TapCount", ¬
			"ElementDeviceUsage", "ElementDeviceUsagePage", ¬
			"UseModifiers", "ElementVendorID", "ElementCookie", ¬
			"ElementProductID", "ElementUsagePage"]
		to sortByKeys(keys as list)
			local key
			repeat with key in keys
				set key's contents to (NSSortDescriptor's ¬
					sortDescriptorWithKey:key ¬
						ascending:yes ¬
			end repeat
		end sortByKeys
	end script
	tell the result
		set xml to its xml's contents
		set xml to (NSArray's arrayWithArray:xml)'s ¬
		set xml to NSMutableArray's arrayWithArray:xml
		repeat with i from 0 to (|count|() of xml) - 1
			set plist to ((stringWithString_(xml's ¬
				objectAtIndex:i)) of NSString)'s ¬
			(plist's removeObjectsForKeys:(its notKeys))
			if (triggerTypes does not contain (plist's ¬
				objectForKey:(its triggerType))) ¬
				then set plist to ""
			(xml's replaceObjectAtIndex:i withObject:plist)
		end repeat

		set notNull to NSPredicate's predicateWithFormat:"self != ''"
		xml's filterUsingPredicate:notNull
		xml's sortUsingDescriptors:sortByKeys({keyCode, ¬
			triggerType, modifiers} of it)
		set its xml to xml as list
	end tell
end getTriggers

return getTriggers for "HotKey"

Presently, the output is a series of key codes and modifier flags:

   {keyCode: 1 , modifiers: 0 , MacroTriggerType:"HotKey"},
   {keyCode: 1 , modifiers: 0 , MacroTriggerType:"HotKey"}, 
   {keyCode: 1 , modifiers: 256 , MacroTriggerType:"HotKey"}, 
   {keyCode: 3 , modifiers: 0 , MacroTriggerType:"HotKey"}, 
   {keyCode: 3 , modifiers: 0 , MacroTriggerType:"HotKey"},
   {keyCode: 4 , modifiers: 256 , ... } , 
1 Like

what's the easiest way to show a list of macro triggers<

Chris, I hope you keep this forum updated re your search. I fopr one am interested. Since returning to KM, I've discovered, my primary interest is not too different from what you describe above.

Some months back, it seemd like I was trying everything to improve organization and accessibility to my macros. While nearly everyone else was focused on learning variables and such, my interest has been 'access.'

I tried one monster global palette with every macro and its hot key. THen, there was a period when I was using multiple palettes and gads of other methods. I eventually realized, my personal preference is to use the mouse (not the keyboard).

Have you come across Butler?

For me, Butler is the best software solution I can imagine for organizing, accessing and executing KM macros. I wish I had the time to make a short video. Over the last four to six months or so, I've spent countless hours integrating the two programs and it never stops getting deeper. Just recently, I figured out yet an entirely different approach with Butler and I'm getting read to implement it.

I rarely use hotkeys anymore (except for the tried and true, like command-c and command-v,). I no longer use any palettes. (At least from a subjective point of view), I have instantaneous access to the (more or less) thousand macros on my drive, with one click of the mouse. I don't know if it will convey very much but I can at least take some screenshots of what my monitor looks like and post it. This way, if you have an interest,I can tell you more at a later date. The screenshot below are of the perimeter of my monitor.

Btw, as excited as I am about this solution, I recognize, this is one area that's all about personal preference. There's no right or wrong way. Thx....







Howdy folks, thanks for the great suggestions! Unfortunately, some of them were out of my league.

BUT, I found two ways of doing it that work great and aren't too much trouble since it's likely that I will rarely if ever change the shortcuts so after the initial setup I probably won't have to do anything.

One simply consists of opening a PDF file and positioning it on the screen.

The other consists of displaying text in a window along with a plugin I downloaded that allows me to position the "Display Text" window so it's consistent every time. I added a variable to set whether the window is open or not that way I can use that variable to either open or close it when I hit the shortcut again.

I've included them here in case anybody wants to take a closer look.

Show USB keypad layout - Display Text Method.kmmacros (16.4 KB)

Show USB keypad layout - PDF File Method.kmmacros (16.4 KB)

Hi @cdthomer, thank you for sharing those macros. Can I request that you post screenshots of the macros and, if any of them contain scripts, that you would be kind enough to paste a code block with the scripts’ contents?

I think other forum users (myself included) find the screenshots in particular a very helpful way of helping to determine whether or not a macro is suitable for them, without having to go through the trouble of downloading and opening the file themselves.

1 Like

Of course @CJK ! I think I'm doing this right with the screenshots....

This is the way with the plug in I downloaded that allows you to resize the "Display Text" window. That can be downloaded here.

This is the way I do it with the PDF file I created. I blanked out the file path just for security purposes but you get the idea. It's certainly not elegant, but it works quite reliably.

1 Like