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. 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 features of the macro itself:
- Ability to use the same macro to for multiple sets by assigning multiple triggers.
- Searches your specified Typinator set to see if the misspelled word already exists (if it does, it is automatically replaced with the existing rule's expansion and you are notified [version 4.0.0+]).
- Automatically captures and filters any trailing spaces and punctuation and restores them upon pasting into front document (version 4.0.1+).
- Uses Aspell to provide a list of spelling suggestions.
- Option to set case handling.
- Option to set format to plain text or HTML.
- Option to add a description (by default it is a timestamp so you can sort by date added in Typinator.
- Option to set the expansion as a "Whole Word" expansion.
- Option to show the results at the end of the macro to confirm what you added.
- Option to paste the new expansion into your front document to replace the misspelled word.
- Option to open Typinator to the newly added expansion at the end of the macro.
Attached are several screen recordings of it in action.
I have been using this macro extensively since August 2021, 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: v5.6.0 (Sunday, May 07, 2023)==
Version History (click to expand/collapse)
v5.6.0 Sunday, May 07, 2023
I added a step that upon pasting in a misspelled word that already exists in a Typinator set, retains the original word’s case.
This way you don’t end up with lowercase words at the beginning of a sentence, or uppercase words in the middle if that was the way they were originall added to Typinator.
NOTE: The way I have my sets configured, this will not change capitalization of names.
v5.5.0 Wednesday, March 01, 2023
- Added loop and error handling inside of AppleScripts to ensure they fully execute.
- Removed looping from Keyboard Maestro actions.
- Added notification of newly added entry
v5.3.0 Tuesday, January 17, 2023
- Added alert in case word is potentially spelled correctly.
- Modified AppleScripts to ensure Typinator is running.
- Added loop action to AppleScript actions to ensure the AppleScript finishes executing before proceeding.
v5.2.0 Thursday, November 17, 2022 (not posted publicly)
- Simplifed/eliminated some superfluous actions.
- Simplified RegEx to separate word from leading and trailing non-alpha characters
- Corrected an issue where in certain cases the original unfiltered named clipboard was being used for insertions.
v5.1.0 Friday, September 30, 2022 (not posted publicly)
- Used a switch action to move to end of work upon cancelling if it is already spelled correctly, otherwise leave it highlighted.
- Added deleting system clipboard (since I discovered that copying to named clipboard still makes use of the system clipboard)
- Added replacing straight apostrophes with curly apostrophes
- Added an action to retry the loop if the initial selection does not copy any alpha-characters (this can be handy if there is punctuation after the word you want to add since ⇧⌥← sometimes captures only the trailing punctuation, and not the word behind it).
v5.0.1 Monday, August 29, 2022
Improved RegEx to capture compound words before trailing punctuation as well as filtering out any leading non-alpha characters (in case the word is the first in a list) within one action.
Switched to named clipboard (Typinator) to prevent interference with system clipboard from Alfred's Clipboard Merging Powerpack feature.
v4.1.0 Friday, August 19, 2022
Added an option to manually type in the abbreviation in case it's not captured correctly.
v4.0.2 Tuesday, August 09, 2022
Improved RegEx to capture trailing spaces and extra space and restore them when the word already exists in the chosen set and is pasted in the front document.
v4.0.1 Monday, August 01, 2022
Modified filtering RegEx to capture any trailing spaces and puncutation to restore those characters upon pasting into front document.
v4.0.0 Sunday, July 17, 2022
Improved one of the AppleScripts to not only determine if the misspelled word already exists in the existing set, but in the case it does, to automatically repaced the misspelled word with the existing rule and alert the user to the replacement.
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!
- 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.
- Set case handling (case does not matter, case must match, case affects expansion).
- Set expansion format (plain text or HTML).
- 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.
Screenshots and screen recordings
Screen Recording: Entry already exists (version 4.0.0) (click to expand/collapse)
Screen Recording: Adding a new entry with 3.1.0 prompt (click to expand/collapse)
Screen Recording: Show results feature (click to expand/collapse)
Screen recording: Using the suggestion provided by Aspell (click to expand/collapse)
Screen recording: Typing in a manual entry and description (click to expand/collapse)
Screen recording: Version 3.2.0 features: case handling and time stamp (click to expand/collapse)
01)[AS-TYP] Create autocorrection expansion.kmmacros (150 KB)