Autocorrect TWo-Letter CApitalized words

I’m constantly making the error of CApitalizing the first TWo letters of a word when I don’t want to. (I can’t remember ever wanting to, anyway.)

There’s a good discussion here of how to capitalize words when you’re typing, but does anyone think it would be possible for KM to look at every word as I type (triggered, say, when I hit ‘space’), and use a Regular Expression (maybe?) to detect this pattern – and if it happens take it away to a named clipboard, change the second letter to lower-case, and return it to the same spot?

Grateful for any advice, as ever.

yours
Michael

I have also been looking for exactly this macro, but do not know how to do this.

You could do it with a regular expression trigger like this:

\b[A-Z][A-Z][a-z]

You might find if you type sufficiently fast that you can type a fourth character before Keyboard Maestro can correct the second character. You can possibly improve the speed by turning off the simulated deletes, and only deleting two characters and adding the two lowercase characters.

Fix TWo.kmmacros (2.2 KB)

Manually delete version:

2 Likes

Thanks! You guys are the best. :slight_smile:

This is great thanks. Now I can ditch MS Word and use text editors like Byword etc.

The only amend I made for this was to change to title case as it was not workig on capitallise.

AS

Hi Peter,

I found a small problem about this macro. For example, I don’t want to autocorrect the word “TVs”, but this macro will do. By the way, the “filter variable with Capitalize” is better in this macro.

To solve that problem, I made two macros. One is the exclusion macro, and the other is the main macro.

The Regex I use here is \b[A-Z][A-Z][a-z]+[A-Za-z]*[^A-Za-z]. These two macros will trigger after a whole word is typed and a next key (not a-z) is pressed, because I want them to check exclusion words for me.

However, I have another problem here. If I type the word “APple”, and click somewhere with my mouse, these macros will not trigger.

Do you have any idea about this, like the string can be triggered after I type a whole word or anything else?

Thank you.

<img src="/uploads/default/original/2X/f/f98f9f8997e7fef7482ff0798809d35db42f7167.png" width=“603” height=“auto">

<img src="/uploads/default/original/2X/e/e5407b46c82e66445d463a8e05fccf4a939d7b18.png" width=“527” height="auto”>

To catch TVs, make some sort of exclusion list, like this:

\b(?!TVs)[A-Z][A-Z][a-z]

No. Keyboard Maestro has no ability to help in that sort of case - you have left the field or clicked somewhere else in it, either way Keyboard Maestro cannot affect the previous location.

In fact, Keyboard Maestro knows nothing about what you are doing or where you are doing it - all it sees is what you type. Various things like clicking or changing applications clear the buffer of what keys it is looking at.

I see. Many thanks for your help.

I would love it if this one was revisited. It is just not fast enough for rapid typing.

Yeah, I sympathize. My Double Caps in the Toggler Macro thread (at the bottom) works great (and has an exception list) in text editors but isn't quick enough in desktop publishing applications (generally speaking). I suppose Typinator is the solution to this.