Hey Henry,
Welcome to the forum!
It's been done before a time or two, although I think this is the first JavaScript version on the forum.
I like the compactness of the code.
I've modified it a trifle:
- Uses the macOS Clipboard directly instead of a Keyboard Maestro variable.
- An example of Local / Instance variable use is embedded.
- Refactored the code slightly.
-Chris
Title Case Selected Text v1.00.kmmacros (8.2 KB)