Variable Inspector Prompt and Dictionary Editor v3.2a
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.)
PURPOSE
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.
FEATURES
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.
TRYING IT OUT
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
USAGE
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.
ADVANCED USAGE
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:
- Click the "Sort" button (#1 above) to sort the variables by size.
- 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.
- You can delete the variable if you want (#3).
- 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.
VERSION HISTORY
Click to expand
v3.2a - Fixed an issue that made resizing the window to a smaller height difficult, if not impossible.
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.
INSTALLATION
UPGRADE INSTRUCTIONS:
- Delete the old macros, or just delete the entire group.
- Install the new macros.
- 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 v3.2a.kmmacros.zip (90.9 KB)