Is It Possible to Create a Floating Palate With Buttons That Change Variables?

I'd like to have floating window with buttons on it that would change KM variables for me, like a simple toggle switch for different settings.

I'd like it to stay visible in any application, like the way the KM Value Inspector window does so it's floating above whatever I'm working on and can use it to easily adjust macro settings.

Is this within the capabilities of Keyboard Maestro?


See: manual:Palettes [Keyboard Maestro Wiki]

1 Like

Ok, thanks. I am aware of Palettes, and I am aware of the prompt for user input dialogue boxes. It's the possibility of combining the two that I was trying to figure out. I can make a user input prompt that lets me set check boxes and sliders, but then the prompt goes away once it has the input. My objective is about easily being able to see the status of the current settings for the different macros. The key part is seeing the status at a glance.

What I've done for now is created a new macro group, which is visible as a palate, which has a series of macros in it that basically don't do anything other than run the main macro - but the macros have different icons. In my main macros, when I change a variable, I am having that main macro also enable or disable those empty macros in the palate group. The end effect is that I have a floating palate that has a list of custom icons that change based on the macro states I'm trying to track. Each macro is a "toggle" macro, run it once it does one set of things, run it again and it does a different set.
The macro being enabled and the one being disabled are both named the same simply because I want them to show up with the same name and only the icon being different in my macro status palate. They are in fact different macros.

When creating the macros, I used the "mark macro" command to add the check mark, but that was only done once when setting up the icons. The mark is always there when that macro is enabled, and not there on the corresponding "red' icon version of that macro.

This works, at least for the binary states which is good enough for now. If anyone knows of a more elegant way to do this or a way to track more complex states than binary conditions, I'd definitely be interested to improve on this solution.

For anyone else who wants to do something like this, here's my "main" macro that does my macro things, and here is the two "empty" macros that are in their own palate group and get enabled/disabled to show the status.

Floating Macro Status Palatte

The Prompt doesn't have to go away. This is a trick I use quite often. You put your Prompt and whatever Actions you want it to perform inside an Until Engroup. This means that the Prompt persists until you tell it to go away. By having the Variables quote themselves as the default selection, whatever they were last set at is the Value shown and stored. The Until Engroup has to have a condition to end it. In this case the condition is until the Close Button is clicked.

Here is an Example that demonstrates the idea. It uses standard Variables so, the settings can persist between Macro runs

In the Example I have put an Action called "Clean Up Variables after Example Run" as the last Action in the Macro, to clean up these Variables at the end of each run. But if you disable that Action, the Variables will "remember" their settings.

EXAMPLE Persistent Prompt Dialog for Setting Variables Version1.kmmacros (11.1 KB)

Click to Show Image of Macro

EXAMPLE Persistent Prompt Dialog for Setting Variables Version1

Click to Show Gif Animation

Screen Recording 2022-03-21 at 10.09.28-Animated GIFF 640 12fps


Now that is fabulous, that is extremely helpful and much closer to how I had originally envisioned things working. Is there any way to include the "update" function with the checkbox, so that I don't have to click twice - once for the selection and again for the update?

Thanks for the excellent idea!

Not with the built-in Keyboard Maestro User Prompt. It has to have a confirmation to move forward. But hitting the Return key will also update the values.

If you use this technique, that is why it is good to quote the Variable values on the dialog itself as I did here so that you can see that they have been set. It is also why I changed the name of the "OK" button to "Update"

Click to Show Image


The good thing about this "trick" is that it is using inbuilt Keyboard Maestro Actions and can all be done in one Macro without needing to call other Macros, so it is relatively easy to set up and maintain.

Hey! Wow! Mark Macro Action - I never even knew that existed!!! :rofl:

And that leads to a very simple solution to your toggle switch Floating Palette (not the slider). You don't need to set up other Macros that get called -

Just use an If Then Action to toggle the Variable value from 0 to 1 and back to 0 each time it is run (or whatever two values you are using). And have one of those neat Mark Macro Actions that marks or unmarks matching the state of the Variable.

And the great thing is the Variable Values get changed as soon as you click the checkbox in the Palette.

Example Mark Macro

EXAMPLE Checkboxes in Floating Palette Macros.kmmacros (16.0 KB)

Click to Show Image of Macro

The "Test Variable Values" Macro in my Group is there for testing purposes - it just confirms the Variables have changed values.

Thanks for leading me to the Mark Macro Action! I will be making a lot of use of it!


Just for completeness and @chanpua you might have figured this out already - While it is not possible to have an actual "Slider" in the floating Palette it is possible to use the same Mark Macro Action to get something similar (i.e. to set from a list of values and see on the Palette itself, which one is set). Instead of the Macros being just Marked or Unmarked, all the unused Value Macros get unmarked when one Value is used.

Screen Recording 2022-03-30 at 16.42.12-Animated GIFF 640 12fps

EXAMPLE "Slider" in Floating Palette Macros.kmmacros (65.6 KB)

Click to Show Image of Macro


Thanks, that's a clever trick to emulate the slider idea and would work fine if I decide to revisit that. Frankly I gave up on the slider park and am still just hard-coding my values, I just have too many items on my list already. But the basic on/off functionality is working well, thanks.

1 Like