Palettes - A couple of requests

That's how I do it too. It's the default solution. But what if the front app is Photoshop and you want to launch Safari? For that you would have to set up the macro "open Safari" in every app. You can do that, but it works much easier with "Global Palette".

In my case, I have a Global Macro Group called Applications that is just Macros that launch Applications and use (in my case) ⌃P (for Photoshop) ⌃F for Final Cut Pro etc. And I don't worry about doubling up on shortcuts as that is where the Conflict Palette comes in. My Macro to launch Photos is called ":leftwards_arrow_with_hook:Photos" meaning I hit ⌃P and Return and Photos launches. But to launch Photoshop I hit ⌃P and click on Photoshop in the Conflict Palette.

And... thinking about it, I mostly use the doc icons to launch my most used Applications... probably due to long habit.

1 Like

@Zabobon This is certainly a good solution. But you need different palettes and shortcuts for it.

@noisneil wanted to use a shortcut to display a palette that shows app specific macros and others dynamically. I think this is only possible with the Global Palette. :man_shrugging:

1 Like

Not sure how far you'll want to go with this, but...

The list of macros in the palette looks to be just an array of macro UUIDs in the action's XML:


You can get a selected action's XML via AppleScript:

tell application "Keyboard Maestro"
	xml of first item of (get the selection)
end tell

...and you can set it:

tell application "Keyboard Maestro"
	set xml of first item of (get the selection) to newXML
end tell

So "all" you have to do is find a way to get the UUIDs of the macros you want to include in the order you want to to display them in and edit the XML to suit.

Then home in time for tea and crumpets...



I've got an idea of how to use this, but what I'd need to be able to do is get the UUIDs of multiple selected macros and append them all to a variable.

Do you think your AppleScript might be able to do that with some adjustments?

The idea is...

Select a bunch of macros, and hit a hotkey. All the UUIDs will be written to a variable. Each line of the variable will be prepended with <string> and appended with </string>.

These lines will now be included in the XML (between <array> and </array>) of a new macro, programatically created in the same group, containing a single action, Show Palette of Macros.

I reckon I can do some of this, but I might need a bit of help mate. :pray:t3:

Dunno about all that, but perhaps this'll get you started...

Select the macros you want on the palette, hit the hotkey to trigger the macro, then when the dialog comes up select the "Show Palette" action you want to add them to and click "OK".

Create Macro Palette.kmmacros (4.3 KB)


Caveats: Only works on an empty "Show Palette" action, and adds macros in the order they are shown in the Editor list at time of choosing.

I guess you could refine this by bouncing the choices through a TextEdit window so you could set your own order by moving lines around and add methods to append to or replace an already existing list of macros.

What I didn't realise until starting this was that you can drag'n'drop from the Macro list to the "Show Palette" popups, but those popups have to be there in the first place. Which suggests another approach -- programmatically create a "Show Palette" action with a load of spoof entries that you then drop your desired macros onto, then delete what isn't needed. It would still be one-by-one, but IMO quicker than navigating the menu hierarchy...

1 Like

That's awesome @Nige_S!! Works great!

In case anyone fancies a tinker, the only way I can imagine this being better is if the it created the Show Palette of Macros macro from XML, named how you want, with the action populated and a hotkey assigned. Then all you'd have to do is select a bunch of macros, hit the hotkey and you're done. Not complaining though... this is terrific.

Edit: Took me about 10min to set up Palettes for all my groups! Happy days! :clap:t3::clap:t3::clap:t3:

Unless I misunderstand what @noisneil is asking for, it seems that KeyCue from Ergonis Software is the perfect solution. I've used it for years. It does many other things, but I have it configured with a press-release-press-hold-Cmd key to show all active keyboard shortcuts. Not only does it show all active KM macros for the current app, but all other active KM macros organized by group, all app-specific shortcuts and all system shortcuts.

I use this all the time as both a memory refresher for what's currently enabled and a help in picking an unused key combo for new macros.

1 Like

Thanks for the info, but that's not what I was after at all. I generally don't use keyboard shortcuts; I have a Stream Deck and trigger all my frequently-used macros from that. However, when I'm away from my desk and don't have the Stream Deck with me, I'd like to be able to access the macros available in each application. Some macros are triggered automatically and don't need to show up in palettes, so I was looking for a quicker way to populate a Show Palette of Macros action with those macros I do want to see. @Nige_S delivered (as he so often does!).

Another way to do this that might be simpler to maintain going forward is to make a new Group for the Actions you want to show on a Palette. Make this Group Active for the Application/s and set it to show/hide a Palette when you press a hotkey.

Then go to your original App Group of Macros and just ⌥⌘drag any Macros you want to show on the Palette into this new Group. This will make an Alias for each of these Macros. You can even multiple select and drag lots of Macros in one go.

Anytime you want to add or remove Macros from the "Palette" Group you can just delete the Aliases or drag more Macros in. The good thing is you can see at a glance what Macros will show in the Palette.

And if you name these Groups with the same prefix (such as "Palette Logic" "Palette Photoshop" etc they will all be bunched together in the list of Groups, again making them easy to maintain - or even delete in the future if you decide you don't need them anymore.


How had I missed that? Thanks, @Zabobon!

The thought of another twenty-or-so groups in my already cluttered group list... Maybe if KM gets a sub-group feature, but until then, no thanks.

There are no drawbacks with @Nige_S's macro that I can think of. Each group has a macro called "- Show Palette of Macros" at the top, containing all the macros I want to see for that app, and I can see them at a glance.

Demo Video

CleanShot 2022-08-26 at 09.58.13

I've adapted @Nige_S's macro a bit to automate the process even further.

- Show Palette of Macros - Create.kmmacros (78 KB)

Macro screenshot

Demo Video

CleanShot 2022-08-26 at 12.13.20

Setup: Set your preferred hotkey for showing the palette in the green action.


  • Select macros you want to show in a palette.
  • Trigger this macro.

In theory, I think the macro creation could be done in the same AppleScript as the action population so it just appears like magic, but that's a bit beyond my ability at this point.

My problem was where to put the action. Not an issue if you're making a single-action macro that just pops/hides the palette, but I was also thinking of palette actions in the middle of macros -- as a replacement for a pick-list, for example. It seemed sensible to maintain a consistent UX -- add palette manually, populate palette -- than do different things in different situations.

Or it may have been sheer laziness on my part :wink:

Totally. Your macro wasn't incomplete in any way; I just have a preferred way to use it.

I managed to generate a macro that included the action, but the sticking point was getting it to appear in the same group as the currently selected macros. I got as far as it generating in a new group (with the wrong icon). For the sake of my own education, I might try again later.

Look away now if you'd rather try yourself. Otherwise:

Sneak a Peek!

Here's making a new macro in the same Group as a selected macro:

tell application "Keyboard Maestro"
	set theGroup to macro group of item 1 of (get selection)
	tell theGroup
		make new macro with properties {name:"Created by AppleScript"}
	end tell
end tell

Correct me if I'm wrong but isn't that the same as just hitting ⌘N?

What I was trying to do was create a new macro in the current group with a pre-populated Show Palette of Macros action and a designated hotkey trigger, named "- Show Palette", with a custom icon.

I got awfully stuck and confused. I did actually get it to import a macro at one point, albeit in a new group with the wrong icon... but I deleted all that work this afternoon, tried to recreate it (after four G&T's) just now, and failed. :woozy_face:

- Show Palette of Macros - Create.kmmacros (67 KB)

Macro screenshot

Here's one of my Show Palette macros in case you fancy having a go:

- Show Palette.kmmacros (50.4 KB)

Well, you said that...

..which is what that AppleScript snippet does. One sticking point at a time!

I'm an AS busker, so I have no idea whether that can be used to create a macro with specific XML, or just a blank macro... Hopefully the former! :grimacing:

If you look at the KM AppleScript dictionary, you'll see that for macro the xml property is read-only -- so not the former. But a macro contains actions and when you look at action you'll see that the xml property is editable. So the route appears to be:

  1. Make a new macro in the Group where your selection is
  2. Make a new action in that macro
  3. Set the xml of the action

It's the XML that sets the action "type", which gives it the appropriate icon etc. So if we get the XML from an empty "Show Palette of Macros" we can use that as our template.

Putting the above together:

set theXML to "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"\">
<plist version=\"1.0\">

tell application "Keyboard Maestro"
	set theGroup to macro group of item 1 of (get selection)
	tell theGroup to set theMacro to make new macro with properties {name:"Created by AppleScript"}
	tell theMacro to make new action with properties {name:"Created by AppleScript", xml:theXML}
end tell

Luckily KM is smarter than me and knows that the action UID is read-only and unique -- when we pump in the XML above the value we pass as "ActionUID" is ignored/replaced with the new action's UID.

So all we have to do now is populate the palette as we did previously, except using AppleScript's text manipulators instead of KM's. One for tomorrow, I think...