Something like this might already be up here somewhere, but it occurs to me that some of you might find this useful. This is a fairly simple macro that I wrote to ease the entry of variable names within the KM Editor. This should therefore be in the Keyboard Maestro macro group. A trigger of your choice (I use control-v) invokes a search box (Prompt with List) that searches a list of all KM Variables. Typing a few keystrokes will allow the user to quickly choose the variable of interest. Hitting return then types the variable notation for that variable. For example choosing ThisOne from the list results in a text entry of %Variable%ThisOne%. If no search keystrokes are entered in the search (i.e., if the default is used, which I have as NewVarName), then a Prompt for User Input dialog is invoked, allowing the user to type the new variable name. In the case of a new variable name, the variable notation is typed, plus the new variable's name is appended to the list of variables (and therefore will be searchable in future uses of the macro). Set up is very easy. Simply open the Variables window in KM (Preferences), select all of the variable names in the list, copy and paste into a txt document. Add NewVarName to the list (I have that at the top, but it doesn't really have to be). Be sure to add a carriage return (i.e. one blank line) at the bottom of the list. Then save the file as whatever you want it to be called (I use KMVariables.txt). Then open the macro in the KM Editor and choose your file in the three (yellow) actions of my macro that call for the file.
What I like about this is that:
It avoids the errors that can result from using KM's autocomplete (and it will restore a type of autocomplete functionality to those who have disabled autocomplete).
The list will remain current as you add new variables.
It's no problem to edit the text file, because it won't harm anything.
Even though the growing list could be sorted, the fact that it is not sorted is actually nice, because:
a. the search functionality of Prompt with List doesn't care about sorting of the list, and
b. keeping it unsorted gives you a record of the reverse oder in which you added variables (should that ever become useful).
Keyboard Maestro 8.2.4 “Variable-Name Input” Macro
Variable-Name Input.kmmacros (6.2 KB)