MACRO: Variable Inspector Prompt and Dictionary Editor v3.2

Variable Inspector Prompt and Dictionary Editor v3.2

REQUIRES Keyboard Maestro version 10 and above

See "Version History" below for, well, a history of the versions.

(NOTE: The prompt is resizable, but I wanted to keep the images small-ish.)


Click to expand

The Variable Inspector Prompt is an incredibly useful way to view, edit and delete your variables and dictionaries from inside a running macro, including Local and Instance variables, Global variables, and Dictionaries. (See above image.)

And it's also really useful as a stand-alone dictionary editor, as well as a tool for cleaning up unwanted global variables.


Click to expand

Honestly, it's hard to even remember all the features I've put in this thing, but here's a partial list:

  • Add, edit, rename, and delete local, instance and global variables.
  • Full-featured Dictionary Editor, including:
    • Show all dictionaries, even if you can't remember their names.
    • Create new dictionaries, modify and delete existing dictionaries.
    • Add, change, and delete keys.
    • Sort by key or value.
    • Resizable columns.
  • Sort by the size of variables.
    • This allows you to work on cleaning up global variables that take up extra space.
    • You can click on a variable, and have the KM Editor search for it.
    • Other features are available to assist this process also (see "Advanced Features", below).
  • Unlimited Undo and Redo.
  • View and edit "pretty" JSON.
  • Fully resizable window with splitter.


Click to expand

When you first download and install the Inspector, select the macro 10)Introduction and click the "Run" button (in the Keyboard Maestro buttons at the top center of the Editor).

After checking that out, you can select and run these macros too:

  • 25)Inspect All Global Variables & Dictionaries
  • 30)Dictionary Editor


Click to expand

To debug a macro, just insert a special action group in your macro (the green one below), where you want to pause the macro and inspect the variables. I'll explain how to do that in just a moment, but here's an example:


A. Enter "1" in this field to take advantaged of KM 10's new %AccessedVariables%, to automatically show all variables your macro's accessed up to this point

B. Enter more variable names if you want, separated by commas or newlines, or "all" to inspect all global variables.

C. Enter dictionary names you want to see, separated by commas, or "all" to see them all.

When the macro gets to this point, it pauses while the prompt is displayed. Inspect or edit the variables, then click "OK" to continue with your macro, or "Cancel" to abort.

But how do I insert the action group into my macro?

Open this macro in the editor:


Select the green action, and right-click to add it to KM 10's Favorites, or use my KMFAM macro set.

Then either use Insert->Action->By Name (⌃⌘A), or KMFAM to select and insert the action group.


Click to expand

To edit all your global variables and dictionaries so you can clean up unwanted variables, you can use the macro Inspect All Global Variables & Dictionaries, which will bring up the prompt:


  1. Click the "Sort" button (#1 above) to sort the variables by size.
  2. If you want to see where a variable is used, click the "Keyboard Maestro" button (#2 above), and the KM Editor will search for the variable.
  3. You can delete the variable if you want (#3).
  4. If you decide you want to keep a variable, but you want to hide it from this list so you only see variables you haven't dealt with yet, click the "Hide" button (#4). The variable will be hidden from the list:

5. Use the "Sunglasses" button (#5) to cycle through the views.
6. Your "hidden variables" selections will be saved, so you can quit the Inspector and continue later.
7. If you run the inspector in such a way that the "Hide Variable" buttons aren't visible, then none of the variables will be hidden. But they're still remembered, so if you show the "Hide Variables" buttons again, they'll go back to being hidden.


Click to expand

v3.2 - "Ping" Internal Inspector Tasks macro to verify group and macro are enabled. Added numerous options. Changed some visual elements for better feedback.
v3.1 - Another Mojave fix, consolidated internal macros into one macro.
v3.0.1 - Mojave Fix.
v3.0 - Added a bunch of new features, including being able to hide variables, and some options.

v2.0.2 - Fixed a display/scrolling bug that occurred with large Dictionaries.
v2.0.1 - Fixed a bug in handling some shortcut keys.
v2.0 - Added a full-featured Dictionary Editor.

v1.0 (and minor versions) - Initial Release.



  1. Delete the old macros, or just delete the entire group.
  2. Install the new macros.
  3. Don't forget to enable the macros and the group!

Download the macros, unzip them, and double-click the .kmmacros file. It will import these macros:


I added prefix order numbers to each maco, so you could tell where to start. After you've become comfortable with the macros, you can remove the order numbers and the separators, if you want. Personally, I'm leaving them as is.

VIP - Variable Inspector Prompt (95.2 KB)


I don't know how you do it Dan, but this is amazing.

I barely finished reading your post and installing the macros and already I'm thinking of so many use cases, especially when building and debugging macros.

This needs to be put in the best macro list.


Thanks. I have to laugh - this started out as a relatively simple idea. Then I kept saying "Hey, I bet I could add ..." I had to stop and post the dang thing, or I'd never stop!

But boy was it fun. I did a lot of things I'd never done in HTML/CSS before.

I am nowhere near your level (and never will be) of programming, but I can relate in my own way to this sentiment :sweat_smile:

A question: running your "Inspect All Global Variables & Dictionaries" macro does not show all of the variables that my KM preferences pane shows. From a cursory inspection it appears that certain variables that are empty show up in the preferences pane but do not show up in the macro. Is this by design? Not a big deal either way...

No debug variables here...:point_down:

Debug variables (and others, all empty) do show up here... :point_down:

Hey Dan,

Holy Smokes! You've done it again...





Regarding the variables, I've noticed some inconsistencies there too. I think they're variables that have been set to "%Delete%", but I'm not sure. If we really care, we can ask Peter, but as long as it's only missing variables with empty values, I figure it's no big deal.

And for anyone who cares, I'm not using "document.kmvar" to get the names of all the variables, because KM might exclude some of the larger variables from that list.

So before I launch the prompt, I ask the KM Engine for the names of all the variables. When the prompt runs, it gets that list of variable names, and then uses window.KeyboardMaestro.GetVariable to get the values of each variable.

No biggie. That makes sense because that's what I do with global variables I no longer need at the end of a macro.

I'll post a more detailed question for Peter in a while.

1 Like

Excellent Dan! Again!! Thanks very much

1 Like

Just uploaded version 2.0, which includes a full-featured Dictionary Editor. You can download it from the first post.

I'll appreciate any feedback you might want to share. Thanks!


Just uploaded version 2.0.1, which fixes a bug in handling some keyboard shortcuts.

1 Like

Thanks for this Dan, as always. But I think I've mentioned before how no good deed ever goes unpunished..

I'm seeing some issues with scrolling the panes. Everything works well until I view a dictionary with a lot of entries in the grid view. Then both panes freeze and will not scroll.

Changing the entry pane to JSON restores scrolling to both panes, but changing back to grid freeze them again.


When I enlarge the window so that I can see the entire dictionary (and the Reload & Done) buttons, the variable list can scroll again. Reduce the window size (and lose the bottom of the list and the Reload & Done buttons) the variable pane continues to scroll but the dictionary values will not.

Sorry to be the bearer!

Don't be - I want the feedback. But this one has me stumped a little. I tested it with a dictionary with 1,000 entries, and it still scrolls fine.

Wait, the bottom buttons disappear? They shouldn't move at all with the scrolling - they should be stationary at the bottom of the window. Like this:

What OS version are you using?

I am possibly the entire staff of your Monterey Q&A department Chief!

Well, the good news is (I suppose) that I can recreate the issue in my Monterey Parallels virtual machine. WTF is wrong with it, I don't know, but I'll see what I can figure out.

Delete the macro "40)[VIP] Setup Variable Inspector Prompt - Advanced (Subroutine)".

Then install this:

40)[VIP] Setup Variable Inspector Prompt - Advanced (Subroutine) (50.7 KB)

Test it, and let me know if it fixed this problem.

I don't doubt you'll find other problems, and in fact I'm trying to hunt down some odd behavior on my machine, but one thing at a time.

It's late and loud here Dan, but I did a quick test and this DOES seem to fix all of the problems I encountered.

Thanks very much (as usual)! And I'll let you know if I enconter any other issues.

Good to hear. I have no idea how I managed to guess the solution, but at least it works. And not only that, it fixed the other problem I was trying to hunt down. Two birds with one stone. Not bad, for a WAG (wild-ass-guess). :grinning_face_with_smiling_eyes:


New version 2.0.2, available in the first post.

Fixes a display/scrolling bug with large dictionaries. If you don't have any of those, you can skip this version if you want.


Hey Dan, I've finally had a chance to actually use your macro set beyond a cursory inspection and it's amazing as usual.

I have however seen what may be a bug... the reload button doesn’t appear to do anything.

While I was recording this, I was toggling my microphone, so this muteStatus variable should have been changing back and forth between Disabled and Enabled.

Is it a bug or is it simply a PEBCAK? :sweat_smile:

VIP Reload button glitch