Is it possible to capitalize each word WHEN TYPING

I already have a macro that prompts me to enter text and then pastes it, capitalized.

I’m just wondering if it’s possible to capitalize letters “as I type”.

For example, this is what I would like to happen:

  1. I press a hotkey
  2. Every subsequent word I type is capitalized
  3. I press the hotkey again
  4. Everything continues as normal

⇪ Caps Lock ?


Well… caps lock is all uppercase… not capitalized.
I’m talking about instances when I know every word should be capitalized. Intermittently hammering Shift is disruptive to typing.

I think I get it – you are using capitalized in distinction to upper-case in the sense of initial caps only ?

(or perhaps title case – with initial caps reserved for the key words ?)

The details of doing it live escape me, but if you are happy to select the typed text you could, of course, assign a key to something like:


I don't see an easy way to do this in the way you have described, though
others might have some ideas.

An alternative would be to do the typing in lower case, then activate a KM
macro that selects the text, (Command A), copies it to the clipboard,
processes it, then pastes it back into your application. The link below
isn't directly a KM solution for the processing, but might be of interest,
depending how complex your needs are:

Thanks Kevin and Complex.

I’m already filtering it this way; entering text into a temp variable box or passing it through a filter.
It works well but I guess I was just curious if there was a different way of doing it. Keyboard Maestro is both a simple and complex beast so I thought I may have missed something.

The problem with this is that people tend to type quite quickly, so its easy for the characters to get out of order because of the event queue processing.

But here is a possible way of doing this:

Macro Start/Stop
Trigger: some hot key
If macro "Watch Spaces" is enabled
  Disable Macro "Watch Spaces"
  Disable Macro "Capitalize"
  Enable Macro "Watch Spaces"
  Enable Macro "Capitalize"

Macro Watch Spaces
Trigger: USB Device Key trigger [space]
Enable Macro "Capitalize"

Macro Capitalize
Trigger: 26 triggers for unshifted letters (tedious to set up)
Disable Macro "Capitalize"
Insert Text by Typing "%TriggerValue%"

Luckily for you, %TriggerValue% for a trigger like "X" (unshifted) is capitalized, so that obviates some steps to capitalize %TriggerValue%.

Should work, whether its performance is sufficient for you, you would have to see. If so, post it as a macro to the forum.

This seems like the overall best solution to me.

You can choose whether or not to include the making the selection in the macro. For example, these are easy enough to do manually, and provide more flexibility:

  • CMD-A -- selects ALL of the text in the text area (as suggested above)
  • Triple-click -- selected the entire sentance, even if on multilpe line.
  • CMD-SHIFT-LeftArrow -- selects all of the text on the line to the left (use after typing)
  • OPT-SHIFT-LeftArrow -- Select one word at time to the left.

You probably already know all of these. I'm just suggesting that doing the selection outside of the macro gives you more flexibility without a lot of work.

Then call the macro to capitalize the selection.

OTOH, if you always have the same selection, then it makes sense to put that in the macro.

Thanks. You’re right — think that’s a bit tedious and not sure I could put up with the delay.
I’ll stick with copying and filtering! :blush:

Just an idea — why not use the hot-key to drop a marker in your text, and then the second press of the hot-key (or perforce a different hot-key) cuts all the text between the marker and the second-press insertion point, filters it to “Title Case”, and pastes it. (I think you might find you have to filter first to all lowercase, then to “Title Case”.)

If you type quickly and don’t want to be interrupted, you could likely leave the “start” and “stop” markers as you type, and process them all when you’re done typing.

1 Like

Are you referring to title case, in which the first letter of each word is capitalized, like this:
Convert a Line of Text to Title Case With Keyboard Maestro. If so, I wrote an article about how to do it while typing.

I think I would try to trigger this on the "space" key.
So for example when space is triggered copy last word (select whole line width keystroke [CMD]+[Arrowleft] and Regex filter last word ) then make it uppercase and paste it again. –maybe

Or an easy way would be to make typed string triggers like " a" and just paste " A" and make a macro for every letter.

Both of these are already supported.

Regex Typed String triggers are already available, and the TriggerValue token has the typed string.

1 Like

This is basic, but seems to work pretty well (OK, I’m not the fastest typer, so you might see hicups when typing really fast):


[test] Initial Caps.kmmacros (2.2 KB)

Maybe it’s even faster when using the System Clipboard instead of a variable, I don’t know.

It only converts uppercasable chars after a space (vertical or horizontal). So you may want to add other triggers, for example “-”, “–” or “—”.

For that, just create another macro that enables/disables the main macro, and assign your hotkey to the en/disabler macro.