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

Howdy folks, I am really excited about this new macro and wanted to share it with everybody.

It is based on one of my other macros: Quickly Create an Auto-Correction Expansion With Typinator. But this is a completely new version with a lot more features, and is a lot more stable since it uses Typinator's AppleScript dictionary instead of GUI scripting. Therefore I am posting it separately from the other macro so as to (hopefully) not cause confusion.

One caveat: to get the most out of this macro, you should also use Aspell to get a list of spelling suggestions. More info on Aspell can be found here: Use Aspell (Homebrew Package) to Spell Check a Word. You can however simply disable the Aspell portions of the macro if you don't need any spelling suggestions; the macro will work fine without them, but you'll just have to verify correct spelling yourself. :wink: If you DO use Aspell, be sure to setup your ENV_PATH variable by following the instructions in this link: Create a PATH Environment Variable for Keyboard Maestro and Add /usr/local/bin to the Default Path - Questions & Suggestions - Keyboard Maestro Discourse

On to the new features of the macro itself:

  1. Ability to use the same macro to for multiple sets by assigning multiple triggers.
  2. Searches your specified Typinator set to see if the misspelled word already exists (if it does, you are notified of such and the macro cancels).
  3. Uses Aspell to provide a list of spelling suggestions.
  4. Option to set case handling.
  5. Option to set format to plain text or HTML.
  6. Option to add a description (by default it is a timestamp so you can sort by date added in Typinator.
  7. Option to set the expansion as a "Whole Word" expansion.
  8. Option to show the results at the end of the macro to confirm what you added.
  9. Option to paste the new expansion into your front document to replace the misspelled word.
  10. Option to open Typinator to the newly added expansion at the end of the macro.

Attached are three screen recordings of it in action.

I have been using this new version quite extensively for about a week now, and it has been rock-solid on my machines. But as always there is a potential for incompatibility on other users machines. So if anybody downloads and tries this macro and runs into issues please don't hesitate to reach out and I will try and help troubleshoot the issue as best I can. I would also welcome any feedback as to how the macro can be improved!

-Chris

NOTE: This macro makes use of the following KM version 10 action(s):
Set Next Engine Window Position
If you are running a previous version of KM, simply disable or remove said action(s).

CURRENT VERSION: 3.2.0 (Thursday, February 17, 2022)

v3.2.0 Thursday, February 17, 2022
Finally figured out the proper syntax for case handling and expansion type.
AppleScript has been greatly simplified.

v3.1.0: Monday, February 14, 2022
Added 4 new features!

  1. Added the ability to use the same macro to add corrections to different sets by setting multiple triggers. The purple-colored variables need to be configured to meet the end-user's needs.
  2. Set case handling (case does not matter, case must match, case affects expansion).
  3. Set expansion format (plain text or HTML).
  4. Added a timestamp as the default description which allows the expansions to be sorted by date added in Typinator.

v3.0.0: Thursday, February 10, 2022
Completely redesigned macro.

Screen recording: Using the suggestion provided by Aspell (click to expand/collapse)

Typinator auto correction macro (Aspell and AppleScript part 1)

Screen recording: Typing in a manual entry and description (click to expand/collapse)

Typinator auto correction macro (Aspell and AppleScript part 2)

Screen recording: Version 3.2.0 features: case handling and time stamp (click to expand/collapse)

Typinator

Macro screenshot: Sorry it's all collapsed, expanded the image is too large (click to expand/collapse)

05)[AS-TYP] Create autocorrection expansion.kmmacros (109 KB)

1 Like

@cdthomer, this looks really cool; unfortunately I don't have Typinator. (I have an old version of Text Expander, but wasn't using it enough to justify the subscription.)

What's the elevator speech for Typinator? I use KM for text expansion, so my interest would be the advantages it provides vs KM for these tasks.

Hey Jim, I too used Keyboard Maestro for text expansion for several years (even though I had Typinator that whole time too), but this last year transitioned to Typinator for any kind of text expansion that didn't involve other KM actions (like variables).

The biggest advantage to me for using Typinator is keeping my KM library smaller, and dedicated to much more complex tasks. To give you an idea of why I like this, in just one of my 30 or so sets, I have over 3,000 expansions. I have two other sets that have over 2,000 expansions as well.

I also like that Typinator has RegEx sets that allow you to use complex RegEx to insert text (probably doable with KM but I learned on Typinator so I stick with it). Also, I like Typinator's ability to expand abbreviations using AppleScript (also doable with KM but for me it's easier with Typinator). I also like that Typinator handles text expansion much more smoothly than KM since that is literally it's only job.

Anyhoo, hopefully that helps some. Let me know if you have any other questions about it!

-Chris

1 Like

Thanks, @cdthomer, it does, and you got me to the fifth floor with that nice summary! :grinning:

1 Like

Version 3.1.0 is up with 4 new features! See post 1 for more details.

Version 3.2.0 is up. The only change is simplified AppleScript thanks to finally figuring out the proper syntax for case handling and expansion type. See post 1 for more details.

This macro is not doing anything for me. "blah blah...Macros cancelled"...

Hello there! I’d be more than happy to help troubleshoot the issue if you could provide some more context. Please verify the following:

  1. Do you have Aspell installed?
  2. Have you modified the macro in any way?
  3. Can you turn on debugging or otherwise specify at which point the macro is failing?

Screenshots/recordings are helpful if possible too.

Yesterday @_jims and I helped troubleshoot an issue with one of my other Typinator macros that ended up being a problem with the users ENV_PATH variable not containing the proper file path for his installation of Aspell. Likely your issue is something simple as well.

Report back and we’ll go from there! :grin:

-Chris

1 Like

Thank you for the fast reply.

1: yes, I have installed it via Homebrew
2: no modification
3: I don't know how to do that. It looks like no part of the macro has passed.

This forum is not uploading image for me.

No problem! Thanks for the info.

  1. Do you have an Intel or M1 Mac?
  2. Don't worry about the screenshot/recording.
  3. Did you set up the ENV_PATH variable?
  1. yes, I have Intel
  2. thanks
  3. No: is that the path for Aspell?

Ah that's the issue. And I now realize that my description in post 1 could have been clearer so I edited to include info about the ENV_PATH variable.

Check out this link to set it up. If you have any questions or run into issues let me know and I can walk you through it.

Create a PATH Environment Variable for Keyboard Maestro and Add /usr/local/bin to the Default Path - Questions & Suggestions - Keyboard Maestro Discourse

It doesn’t exist in the macro... it's a global variable that Keyboard Maestro uses to run Shell Scripts in the same way Terminal would run them.

Try this:

  1. Open Terminal
  2. Type Echo $PATH (or copy/paste from here)
  3. Press return :leftwards_arrow_with_hook:
  4. Copy the results into a KM variable called ENV_PATH
  5. Run the macro again.

To give you an idea of what the results would look like see the screenshot from my iMac with the results underlined in red:

Screenshot (click to expand/collapse)

Thank you for the clarification. It is working now.

Great! Glad you got it going. Let me know if you need any other help with it.

1 Like