Use Variable as Checkbox Prompt Label [2 Solutions]

I know similar questions have been asked in the past (I found them by searching) but maybe things have changed recently.

I'm trying to find a nicer way to accomplish this:

The names of the Finder Windows are Variables which will change. I have accomplished the above (which works but feels ugly) using this Action:

But it would be much nicer if my Prompt For User Input looked like this:

Any ideas? Or is it the dreaded Custom HTML Prompt (which I have never tried because it looks really hard to do)?

See Prompt for User Input for deploying check boxes with a label representing the variable. But the short version is to use A__Untitled Folder and B__Icons, etc.

1 Like

But you can’t use variables containing for example “A__Untitled Folder” to create those prompts, which is how I understood the OP’s question.

1 Like

Ah, I missed that. Thanks for pointing it out.

In that case, I'd use a popup menu listing the windows to restore.


Thanks @tiffle and @mrpasini - You have confirmed what I thought.

The thing is, I would like to be able to select more than one option each time the Prompt opens.

So, I will stick with my "ugly" solution as it allows me to do that (by checking or unchecking which Finder Windows I want to open before hitting the Okay button).

But maybe I could ask @peternlewis to put it on the List to allow Variables as Labels in Checkbox Prompts for some time in the future? :grinning:

Well, as you originally suspected, the solution to that is the Custom HTML Promp. Here's a basic framework to get you rolling:

Check Boxes with Variables Macro (v9.2)


Check Boxes with Variables.kmmacros (8.1 KB)


Oh wow! That is amazing @mrpasini . I wasn't expecting you to write me an actual User Prompt Dialog.

I can easily adapt this to my needs. Thank you so much.

Glad to help.

I would use the KM Prompt With List action, with the option for selecting multiple items checked.

Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.

Of course you will need to add KM Actions to process your selection from the Prompt.
You can also use the technique of Displayed Value__Returned Value to just show the folder name but return the full path.

Please let us know if it meets your needs.

Example Output



MACRO:   Select Finder Windows to Activate [Example]

-~~~ VER: 1.0    2021-05-10 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Select Finder Windows to Activate [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


And thanks to you too @JMichaelTX

This looks very interesting and I will play with it tomorrow (it’s late evening now in the UK).

The amazing thing about Keyboard Maestro is that there is always a solution. I love that I can build workflows, Action by Action in discrete blocks and tinker until they work and solve everyday needs. And this Forum is so friendly and helpful. I try to give back and help when I can.

Once this set of Macros (for on-the-fly saving and restoring of Finder Windows and their positions/sizes) is working well I will upload them to the Macro Library in case others find them useful.

1 Like

Hi @JMichaelTX and @mrpasini

I have implemented JMichaelTX's suggestion to use a Prompt With List (as I found it easier to adapt the Native Keyboard Maestro Actions).

But that means there are two equally good Solutions to my original request here and I can't find a way to mark both as "Solution" - so, thanks again to you both.

For your interest here is a Screenshot of the Macro as it stands. It calls Sub Macros which means if I were to upload the Macro here I'd have to upload all those Sub Macros as well. But from the Screenshot you can probably see how the Prompt With List has allowed me to choose which of the Sub Macros to run. (I am planning on adding the Macros to the Forum Macro Library and will add in a link here to this Thread as I think other people would find this useful.)

In the Gear Settings for the Prompt With List I checked "Allow Multiple Selections" and unchecked "Sort Entries" (when Sort Entries was checked it messed things up in terms of Restore1__ Restore2__ Restore3__ Restore4__ in front of each entry).

I also unchecked "Notify on Failure" so that I can close the Prompt Window by clicking away from it or pressing Esc without the Macro Failure Notification popping up.


The Prompt With List returns a text string of all the selected entries to the Variable Choice

Then a series of IF Then Else Actions checks if the Variable Choice contains some or all of the selections and fires off specific Sub Macros to reopen the Finder Windows and restore their saved sizes and positions.

Selecting just one Finder Folder to reopen:

or with multiple Selection:

The purpose of all this?

Quite often, at the start of a task, I open a few Finder Folders as Windows and position/size them carefully as I want. But often these Finder Windows get closed or moved or resized and lost and my Desktop becomes a mess again.

The idea I had was to be able to:

  1. Position the Windows nicely at the start of a task. Select any open Finder Window, tap a Shortcut Key Combination and have a Macro save its path and also how it was currently sized/positioned to one of four "slots" (1, 2, 3 or 4). And repeat this with up to three other open Finder Windows.

  2. Then call up a second Macro with another Shortcut Key Combination and from a Prompt choose any/all of the four saved Folders to reopen and get back to the nice position/size I had saved.

The Macros are working well now, but I will keep refining them over the next few days before uploading them as a package.

I know there are special Apps that accomplish similar things (BetterTouchTool can grab and restore the current layout of windows) but I wanted the flexibly to be able to choose which Folders to open again rather than just the whole lot.

Also... I can see a way of having more than one saved Session of Windows to call up in the future for different tasks (just by using different Variable names). Pressing a Shortcut Key Combination to save the Window Path/Postion/Size could give me an option of what Session to save it to and generate a slightly different Variable.

This is what makes Keyboard Maestro so useful - these Macros can always be adapted and refined during use.