Create Text Expansions Macro

Thanks for the link. Gonna go through that if I have some spare time. Actually I bought typinator as well (and I do not understand everything, BUT the thing with regular expressions is HUGE).

A word of caution regarding Typinator. I used to use it, switched to TextExpander for a change in interface. Went back to Typinator today.

My OS went crazy. It seems that TotalSpaces2 conflicts withTypinator to the point that I had to disable TotalSpaces2. Use caution if you have both apps installed.

Hi, I'm a beginner to Keyboard Maestro, and am missing something simple about making OP's macro work. Can anybody offer some advice?

I'm not sure what OP means by

"simply fill in the text of the action with lines like:


where trigger is the Typed String trigger you want and text is the text you want to expand to."

I have tried to write in my trigger and text in different locations in the actions, but i'm not sure where in the actions it should go (i have tired the (.?):(.) area alot but not sure if i should be including the extra stufff). everytime i get a notification that says macro cancelled (pic below). Can anybody point me to exactly where i need to type the trigger and text? thanks so much!

This means, in the below Action, to replace the text of the Action with the text expansion trigger, and the text (snippet) that it will output, with your own, using the format of:

<trigger> is the typed string you will use to trigger the macro
<text> is the text snippet to be output

In the above Action, one of the macros to be created has
the <trigger> is "=em="
the <text> is ""

Make sense?

1 Like

Yes!! makes complete sense now, thanks so much!

1 Like

(Only just on topic but) What interested me (apart from the whole confecting XML thing) is the use of a terminating character in a trigger.

For example, the second ‘=‘ in ‘=em=‘. It hadn’t occurred to me to use a terminator to aid disambiguation.

It also got me to thinking the technique of using Keyboard Maestro to confect other XML is great. For example, for z/OSMF workflows. (And then there’s confecting HTML.)

1 Like

Would love to know more about this... I assume you have some kind of system for these that makes them easy to generate/recall?


Hey Jon,

Many of those are spelling corrections that I don't need to remember.

I do make extensive use of sub-searches in Typinator, and in some circumstances I use key word/codes to make things easy to find.

Here's an example of the latter:

"h" is the sub-search code which is a mnemonic for "handlers" (my AppleScript handlers).

The prefix code identifies which library the handler is in.

So "h flb perl" will find any handlers that use Perl in my AppleScript "Find" library.

I use categories and sub-searches whenever something is likely to be hard to find.

I have something over 80 categories:

The "Date Strings" example above uses "ds" as its sub-search ID:


So it's easy to get there and find what I'm looking for (if I forget my direct abbreviation):



Hey Chris, good to see you!
Great system! :+1:

1 Like

I'm populating the Expansions variable using the Read file to Variable action. This allows me to maintain and reference my list of text expansions in the text system of my choice -- currently Obsidian :tada:.

When I run the Create Text Expansions macro again I of course get duplicates created in my KM library. I'd be fine with automatically deleting all the expansions each time since the KM macro will add them back again, but I don't see any way to have a macro delete another macro.

Suggestions on the best way to handle this?

You can use AppleScript to delete all the macros within a specific macro group.

I suggest before running such a macro, you quit and relaunch the Keyboard Maestro editor, that way you have File ➤ Revert Macrs ➤ At Editor Launch available should you accidentally make a mess of your macros.

tell application "Keyboard Maestro"
	delete every macro of macro group "MACRO GROUP NAME"
end tell
1 Like

Perfect, thanks! Below is my working version of it all.

Create Text Expansions PUBLIC.kmmacros (6.3 KB)

1 Like