Quickly Create an Auto-Correction Expansion With Typinator

Howdy folks, there's a handful of Typinator macros on the forum but I wanted to share mine since it's a little different than the ones I've come across here.

Mine is designed to quickly add a misspelled word to a specific set. It requires virtually no user interaction, only triggering the macro, either selecting the correct word from the list of Typinator suggestions or simply correcting it in the Typinator window and then pressing the Return key (:leftwards_arrow_with_hook:). Even if your last quick entry was to a different set, this macro will automatically select the correct set. Something that took me awhile to figure out was how to position the Typinator window front and center of the front screen but that has been working reliably for me now for quite some time using a combination of KM tokens, variables and some lines embedded in the AppleScript. If you experience issues with the positioning of the window however, let me know and I can rewrite the AppleScript to not position it.

Initial setup is easy, in fact all you have to do is set the name of the set in either the purple-colored variable or directly in the AppleScript (instructions on this are in the comments in the macro itself).

Attached is a screenshot showing it in action.

This macro has worked incredibly well for me which is why I felt like sharing. Just since creating the first draft in August I've used it 3,436 times which equates to using it about 18 times a day! As always, however, I am always interested in how my macros can be improved so if anybody has any suggestions please feel free to share them! :grin:

-Chris

CURRENT VERSION: 1.2.0 (Tuesday, February 08, 2022)

v1.2.0: Tuesday, February 08, 2022
Added an AppleScript to close main Typinator window to ensure the final paste action does not paste into the Typinator window (since if it's open upon inserting a new expansion it will be brought to the front)

v1.1.0: Monday, January 31, 2022
If original word has a space in front of it, this space is now inserted after correction.

v1.0.0: Monday, August 23, 2021
Initial macro

Typinator auto correction macro

04)[AS-TYP] Create autocorrection expansion (English).kmmacros (59 KB)

Macro screenshot (click to expand/collapse)

2 Likes

That's excellent Chris, and I just installed Typinator yesterday! Thx

Thank you! Typinator has been a game changer for me. I don’t say that about many apps (only other one I can recall having said it about in fact is Keyboard Maestro) so this macro has been EXTREMELY useful for me. I actually have three autocorrection versions: one for English, one for Spanish and one for names.

I would LOVE some feedback too as you start to use it. So if you have any suggestions about how to make it more foolproof or anything else I’d welcome your comments. :grin:

Version 1.2.0 is up. See post 1 for more info.

Sorry Chris. It's been awhile and I've really leaned into it but I think I'm still scratching the surface. Some of my tips for any newbie:

  1. I wasted a lot of time trying to devise meaningful "sub-strings" to key expansions but meaningful keys that didn't conflict with other expansions became difficult. Then I found "magic keys"! So now almost all of my expansions are 1, 2 or 3 characters and usually followed by ⇧ (see? that was an expansion.)

  2. For word stems, you can pair expansions. For instance, "ig⇧" expands to "integrate" but if I follow with a single "n" a regex rule converts the whole thing to "integration" (it a term of art in my business and comes up a lot)

There's more, but I actually came to the forum right now to solve an unrelated problem. Take care.

1 Like

Hey man, long time, no see! If you’re interested... I ended up creating a completely redesigned version of this macro that is far superior to this one. ↓

KMF: Redesigned: Quickly Create an Auto-Correction Expansion With Typinator (Using Aspell and Typinator's AppleScript dictionary)

Thank you for creating this macro @cdthomer . I don't use Keyboard Maestro honestly (although I buy every version lol) as I use Alfred, BetterTouchTool and Typinator. But I just lurk around this forum to find new automations.

The Typinator AppleScript used in this macro for creation of the snippet is great and very helpful. May I ask how did you figure out the query language/syntax of the script that is supported by Typinator. I have been emailing them for quite sometime and every time they ask me to use keyboard shortcut to "Create a new item from selection...." (or clipboard) which I don't wanna do, so not that great customer service honestly, but a great product indeed.

Anyway, if you can point me to the approach you used to figure this out and any apps/IDEs you used to find the syntax, that'd be very helpful!

Hey Andy,

For this version of the macro, I used UI Browser since this one is based off of GUI scripting.

But for my updated, and far more advanced version, it was by looking at the Applescript Dictionary for Typinator. But I also spoke with Gru a couple of times and he clarified a couple of details as well. After that, it was just a lot of trial and error haha.

-Chris

1 Like

Thanks for responding! Could you share how did you figure out this exact script

tell application "Typinator"
	--create from selection
	create from clipboard
end tell

i tried using UI Browser and it doesn't show the "create from clipboard" thing. sorry about the lame question

UI Browser only shows you accessibility information about an application. It is used for GUI scripting only, thus the name, UI Browser. :wink:

Technically, I already pointed you in the right direction... :wink:

Take a look at the dictionary (and if you are using Script Editor, stop that, don’t do that, do and download Script Debugger... even the free version is far superior to Script Editor), and in the dictionary you will see things like the following:

AppleScript Dictionary Screenshot (click to expand/collapse)

Screenshot 2023-09-05 at 08.05.55

GUI scripting is handy... but it’s not near as efficient nor reliable as using an application’s AppleScript dictionary. That’s why I ended up building a newer version of this macro that doesn’t rely on the GUI. Let me know if you have more questions! :grin:

1 Like