Inspired by the Services overview on the Mac OS X Automation website (via John Gruber), I decided to take a crack at creating my own system-wide service for converting text to title case – utilizing, of course, John Gruber’s TitleCase script.
I’m not a programmer, and the little programming knowledge I do have is strictly front-end web development, so the thought of setting up a Service like this, where I can easily convert text to title case, was very appealing. Even more appealing was the fact that I could easily show how anyone could do this.
What you need
First, here’s what you need:
Creating the Service
The Mac OS X Automation website has a tutorial on how to create a Service in Snow Leopard, but you really only need to skim the photos to understand the process. Apple’s made it easier than saving 15% on your car insurance.
After downloading the TitleCase script, launch Automator. Choose ‘Service’ in the template manager, and you’ll be presented with an Automator workflow creator window.
Leave “text” and “any application” selected in the building pane, but check the “Replaces selected text” box.
Now search the actions library for “script”, and then drag the “Run Shell Script” action to the workflow pane. It should be the last item in the search results.
Now, open the TitleCase.pl script in a text editor (Text Edit works just fine), and copy the entire script.
Back in Automator, select “/usr/bin/perl” in the Run Shell Script action; in the ‘shell’ drop down menu. Select the entire sample
print script that shows up, and delete it. Now paste the TitleCase.pl script.
Save (File > Save), title, and enjoy! Your new Service will be saved in the “Text” category of the Keyboard Shortcuts Preference Pane. From there you can assign a global keyboard shortcut.
Update: John points to a new version of his script by Aristotle Pagaltzis, which, he says, is ‘better in every way’. (Thanks to Jordan Yee for the tip in the comments below.)