Toggler Macro (v9.2)

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.


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.


To add your own macros to the list, follow these three steps:

  1. Change the macro name to evaluate in the Condition of each If action

  2. Change the checked display to the macro name and what you want it to show

  3. 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.


For the lazy or easily confused or curious you should have included all the macros in your list even though that was not the point of your post. :slightly_smiling_face:

I should have but they aren't located in the same groups so they would be installed all over the place on your system, which seemed rude to me. That's one of the beauties of Toggler. It can control macros in other groups.

I thought these two were the most difficult and unaddressed problems but I'm surprised matching brackets and quotes is such a puzzle recently. My own solutions were based on what I had already found here.

Happy to add anything requested, though.

Thanks for the macro @mrpasini.

the HTML one mentions

See Global Macro Group > Toggle Selected Macros [^X] to enable or disable this macro.

Question: Do I need to move some/all of them to the Global macro group?

No, they can be in any group. When you install them in Toggler, you tell the macro where they are.

That's why I didn't include all the ones you see in the screen shot. But I just realized I can upload a Togglered group to distribute all of them. You can keep them together or distribute them to your liking.

Probably put that up a little later today. [done]


Togglered Macro Group

This is a collection of typed-string-tiggered-macros that can be enabled/disabled with Toggler.

Close HTML Tags: Closes HTML tags using different formats (inline, inline with return, block, return in block, etc.)

Double Caps Fix: Corrects a word that begins with a double cap, leaving two-letter acronyms alone and providing for a list of exceptions (like "CDs")

Double Space Fix: Changes two consecutive spaces into one

Match Brackets: Enter a closing bracket when the opening one is typed, recognizing four types

Match Markdown Codes: Enter a closing Markdown code when the opening one is typed, recognizing three types

Match Quotes: Enter a closing quote when the opening one is typed, avoiding apostrophes and recognizing a variety of quote types

Update 1: Replaced Double Caps Fix with a regex version to handle exceptions.

Update 2: Eliminated unused variable in Double Caps Fix and deleted action that notified when an exception was found (used for debugging).

Togglered Macro Group Macros.kmmacros (28.4 KB)

1 Like