Toggler Macro (v9.2)
This is a set of three macros that demonstrate a way to display the status of each macro in a popup menu and toggle its enabled/disabled state. I find it handy for macros triggered by a typed string that I sometimes want active and sometimes don't.
Screenshot of my working version.
Two sample typed string macros are included: Close HTML Tags
and Prevent Double Caps
. There are included in the Toggler group but they could reside in any group.
HOW IT WORKS
There are three sections or steps to the macro.
The first section creates the popup list of macros. The second presents the list. And the third does the work.
In the first section, for each macro we want to include in the list, we ask if it is enabled or disabled and append a string to a local variable depending on the state.
For an enabled macro we append:
Match Brackets__[✓] Match These Brackets: [ { (
For a disabled macro we append:
Match Brackets__[✗] Match These Brackets: [ { (
The actual macro name is followed by two underscores and what we want the popup to display. In this case, the display is a bracketed status indication and the name of the macro plus the hint (if any).
In the second action, the popup, we make sure not to sort the list (using the gear menu) because the sort would follow the status indication rather than the name. We rely, instead, on the order we manually append the listings.
The AppleScript ( written by @gglick) does nothing more than change the status according to the macro name supplied by the popup list. This code, unlike the Keyboard Maestro action to enable/disable a macro, accepts a variable for the macro name.
ADDING YOUR OWN
To add your own macros to the list, follow these three steps:
-
Change the macro name to evaluate in the Condition of each If action
-
Change the checked display to the macro name and what you want it to show
-
Change the unchecked display to the macro name and what you want that to show
Do that for each macro you want to toggle in the popup.
Toggler Macros.kmmacros (14.6 KB)
Update (March 30, 2021): See below for a set of six typed-string macros to use with Toggler.