Macro that would capitalize the first letter of whatever is selected

Hello,
I was wondering if anyone could help me to build a macro that would capitalize the first letter of whatever is selected?

I also need one that un-capitalise the first letter of the selection. :slightly_smiling_face:

That'd be awesome.

Thanks!

KM has a Filter action that'll do what you want. Check out its manual page in the KM wiki: manual:Filters [Keyboard Maestro Wiki]

To illustrate - here's an example macro that toggles the case of the first character in the currently-selected text for you to try:

Macro-Image

Keyboard Maestro Export

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 13.6.1
  • Keyboard Maestro v11.0.2

I've tested this in BBEdit. It should work in any text editor that permits copy/paste but I'm not sure it would preserve any text styles.

2 Likes

Even quicker -- KM has text case conversion, flagged by metacharacters. \u converts the next character to uppercase, \l to lower. So:

Cap 1st Letter.kmmacros (1.7 KB)

And:

Low 1st Letter.kmmacros (1.7 KB)

Quick bit of testing shows they keep at least simple formatting when used on styled text.

5 Likes

Beautiful.
Thank you so much stranger. you made my day
Have a good one,

thanks a lot for your help. :slightly_smiling_face:

Hi, @Martin_RAISON. Here's a variant that:

  1. toggles the case,
  2. provides feedback if nothing is selected,
  3. restores the clipboard, and
  4. restores the selection.

Download: Toggle Sentence Case of Selection.kmmacros (12 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 14.3.1 (23D60)
  • Keyboard Maestro v11.0.2

1 Like

I like it how you restore the selection.