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

Howdy! Sorry to hear you're running into issues with this macro. I'll be glad to try and troubleshoot the issue for you.

First, can you verify that you set the following variables properly? For instance, you need to supply the name of your Typinator set to which you are trying to add the correction. In my case I have three different ones (English auto correction, Spanish auto correction and Names auto correction, thus three triggers and three sets of variables).

Variables screenshot (click to expand/collapse)

Verify that you have supplied the appropriate set names and we'll go from there.

-Chris

EDIT: And thank you for supplying the debugging screenshot; that helped to know where to start.

EDIT 2: Wait a minute... I messed up...

EDIT 3: Ok @A_A my apologies... like a bonehead I uploaded my personal copy which uses AppleScript files instead of AppleScript actions. Download the macro again please and either use the new version or simply replace the two actions that use AppleScript (they are colored red, one is the third from last action, and the other is the last action buried in the "See if word is already in the set and proceed" group) with the actions from the new version.

I also forgot to edit the variable so thank you.

No problem, is it working now?

Yeah It's awesome.

Woohoo! Glad it's working and you're enjoying it. If you have any feedback on it, don't hesitate to reach out.

2 Likes

Version 4.0.1 is up. Changes include capturing and filtering any trailing spaces and/or punctuation, and then restoring them upon pasting into front document. See post 1 for more details.

Version 4.0.2 is now up. The only difference from version 4.0.1 is an improved system to replace trailing punctuation and spaces when the word already exists in the chosen set and is pasted into the front document. See post 1 for more details.

1 Like

Hey there, quick question. I've used the old version in a palette with no issues and just tried doing the same with this version, but I'm having some trouble figuring out how to set it up since it requires a trigger in the setup. I don't have an actual global trigger I use for it, I just place my cursor in the right spot and open the palette where it's assigned to "T"

Is there a way to keep using it in the palette or should I just suck it up and and learn the hotkey

Yes this is very doable via a palette, but it takes some modification. The images below show just one way to modify it, but depending on your use case there are likely better ways of modifying it.

Expand this section to see the images and their explanation. :arrow_down:

Screenshot Series and Explanatory Information (click to expand/collapse)


In this section you will need to add this variable and place the name of the palette you wish to use.
For my purposes I am using The Global Macro Palette for everything past this point.
If you want to use a different palette, this variable and every subsequent action will need to be modified accordingly.


In this section you will need to add and if/else action to the otherwise portion of the switch action.
In it, place the variables to indicate the set name and case handling you would like to use for your Typinator set.


In this section add an otherwise portion to the switch action and copy the shell script action from the "English" section above.

A beta version of the macro containing these modifications is also supplied for you to test. In the beta version, everything is collapsed except what I changed for you.

01)[AS-TYP] Create autocorrection expansion (for testing with palettes).kmmacros (121 KB)

Macro screenshot (click to expand/collapse)

Let me know how you use the macro and I can give more specific advice. For instance:

  1. Do you use it for more than one Typinator set? (For example I use it for three sets, English, Spanish and Names)
  2. Do you want to use only a palette trigger?
  3. If so, will it be the Global Palette or some other palette?

Answer those questions and I can give more tailored advice. Because honestly if you are only going to use one Typinator set, this macro can be greatly simplified. The only reason there is so much setup is because I designed it to work for multiple sets based off the trigger. :wink:

-Chris

Ahh, that makes sense. I only use it for one set at the moment, "My Personal Autocorrects" is basically just my dump spot to keep the ones I added separate from the generic autocorrect sets you can import.

I didn't like the feel of using the actual global palette so I just use a group called #Global that's set to show the palette for 1 action when the hotkey is pressed. I have it set to a bunch of different triggers based on what I'm using at the time

  • "Caps (⌘+⇧+⌃+⌥ ) + S" on my mac keyboard
  • F2 on my external keyboard
  • F14 (reassigned play button on a bluetooth mouse/remote)
  • And a BTT trackpad gesture as the cherry on top lol

So in my case (using the test version you shared), I would just replace every instance of "The Global Macro Palette" with "#Global" right?
And is clicking on a open palette option equivalent to pressing the assigned hotkey (T in my case)? In that both would still fall under "activated by palette" as the trigger?

A quick and easy way to check what the trigger tokens are producing is by placing this action as the very first action in the macro.

Trigger Tokens Alert.kmactions (582 Bytes)

Action screenshot (click to expand/collapse)

That will give you the trigger information for the macro when you run it and give you the option to cancel it's execution. Very handy for verifying proper syntax while building/modifying a macro.

For instance, see my Scratchpad macro... :arrow_down:

Scratchpad macro screenshot (click to expand/collapse)

When using the hotkey trigger ⌃⌥⇧⌘↩ it produces this alert window showing me all the relevant information... :arrow_down:

Alert screenshot for hotkey execution (click to expand/collapse)

When executing it via the Global Macro Palette it produces the following which is quite different and is even missing a trigger value... :arrow_down:

Alert screenshot for Global Macro Palette execution (click to expand/collapse)

When executing it via a Macro Group Palette it produces the following alert... :arrow_down:

Alert screenshot for macro group palette execution (click to expand/collapse)

As you can see, the trigger tokens produce wildly different results depending on how you trigger the macro.

All that being said... you really don't need to mess with trigger tokens at all because you are saving everything to one Typinator set. So you don't need to differentiate between anything according to your triggers. You can literally rip out everything related to triggers, and just have one set of local__Set Name and local__Case Handling variables and one shell script.

If you’re unsure of how to do that, just let me know and I will provide another beta version for you to test.

Ahh I didn't realize it varied so much. I've only used macros superficially so far, like for setting custom shortcuts and palettes. Haven't had a chance to really dive into making my own yet.

And I thought I'd be able to do it but I failed haha. I would greatly appreciate another test copy

Oh man you might be just scratching the surface. Keyboard Maestro is incredibly powerful. I've been using it daily for over 4 years now and still learn new things all the time.

Below is another beta version for you. I've done some minimal testing and it works without any problems for me, but let me know if you run into any problems.

On another note... you'll be the first to see a new feature that isn't in my public release yet... the ability to manually add the abbreviation for those rare occasions where the misspelled word is not copied properly. It's extremely rare that it happens, maybe 1 time out of 100, but it was enough to where I decided to do something about it. :sweat_smile:

01)[AS-TYP] Create autocorrection expansion (for testing with palettes).kmmacros (94 KB)

Macro screenshot (click to expand/collapse)

Version 5.0 is now up.

There are now two versions of the macro; one for multiple Typinator sets and a simpler one for a single Typinator set.

Also new is the ability to manually enter the abbreviation in the rare instance it is not captured properly. This was done in version 4.2.0 that I never posted. :sweat_smile:

See post 1 for more details.

Yeah I always say I'm going to start looking into it but my ADD kicks in and I never make it past the "research/look for cool examples to imitate" stage. But I'll get there one day.

And thank you so much!! Just tested it out and it worked perfectly. And yeah I see the manual entry fields at the bottom, honored to be first haha

1 Like

Glad to hear it works and you're enjoying it! :grin:

Version 5.0.1 is now up. There have been a variety of changes since the last public post.
Specifically versions 4.1.0 and 5.0.0 that I didn't post publicly.
All relevant notes are in the version history in post 1.

Awesome, I’ll be sure to check it out later! I actuallly had a question for you as well. Are you familiar with Popclip? It basically brings up a little pop up context menu when text is selected to quickly copy/paste/format etc without leaving your mouse/trackpad.

It has a basic typinator extension that uses the default add selection command (without all of the bells and whistles that got me using yours haha). I just found out that you can make your own buttons for popclip and that you can have them trigger macros by URL, which got me thinking about how nice it would be to make one for this macro. But I couldn’t seem to get it to work since the macro needs to be in front of the word versus popclip wanting the word selected.

I wanted to get your input on whether I could work around this. I think the popclip extensions have a simple “before” and “after” optional command to help set it up, like (Text selected, button pushed) -> ( Before: Copy) -> Add clipboard to Typinator -> (after: Enter).

So maybe I could have it start with a selection and add an Option+ :arrow_right: command ad my before running the macro. My other thought was just adding that one step to the macro itself lol

I don't use (and therefore am not familiar with) PopClip, but I imagine there is a simple solution.

It might be as simple as modifying the copy word to clipboard actions as seen in the screenshot below.

Actions Screenshot (click to expand/collapse)

Actions to Import (click to expand/collapse)

Copy word to clipboard.kmactions (2.2 KB)

In this example (which you can import via the attached file), the word is highlighted only if the macro is triggered via a hotkey action. If it is not triggered by a Hot Key action (aka, a URL accessed from PopClip) then whatever text is already selected is copied to the named clipboard.

Try that out and see if it works for you and let me know. I'll be happy to keep brainstorming if it doesn't work.

Lol I deleted my post by accident, but it worked! Thanks a bunch for the help. It's quite fun figuring these things out

1 Like

Not a problem, glad it's up and running for you!

1 Like