How to make 1st letter of words in selection uppercase?

I’m looking for a smart way to make the first letter of all individual words in any selection uppercase.

Examples:

Apples, pears, nuts, grapes

Apples / pears / nuts / grapes

Apples;pears;nuts;grapes

All fruit should be initially capitalised: Apples Pears Nuts Grapes

I can only think of a not so smart way with 26 F/R actions ;).

Hey Hans,

Type the ⌘C Keystroke
Pause for 0.05 Seconds
Filter Clipboard with Lowercase
Filter Clipboard with Title Case
Pause for 0.05 Seconds
Type the ⌘V Keystroke

You can use a Filter Variable Action if that’s more appropriate for your workflow.

The only trouble with the Title-Case filter is that it actually does grammatically correct title-case, which means that words like “and”, “of”, and “the” will not be capitalized unless they are the first word.

You can get more control by splitting lines into words, using the case-filter-actions, and then transforming back into a line.

On my system I’d just use AppleScript and the Satimage.osax AppleScript Extension.

set _text to "Ä NÖW IS THE TIME FOR ALL GOOD MÈN TO ÇOME TO THE AID OF THEIR COUNTRY"
set newText to lowercase _text
set newText to change "\\b(.)" into "\\u\\1" in newText with regexp without case sensitive

Note that the accented characters are just for demonstration purposes. The Satimage.osax is Unicode savvy.


Best Regards,
Chris

You can use the Capitalize filter instead, which does a much simpler capitlization and capitalizes the first letter of every word. Also, with it there is no need to lowercase everything first, whereas the Title Case version does not lowercase capitalized words such as DNS (which Capitalize will cheerfully convert into Dns).

Thank you both, Chris and Peter. Great stuff. Will add it to my set of CafeTran macros, reducing the number of editing tasks that I have to do manually even further :).

I think I didn't even look at that, because I read Capitalize as synonymous with Upper-Case (which isn't true of course).

-ccs