※ veridical.net
  • About
  • Publications
  • 3 Questions
  • Top N
  • Tags
  • Archives

Title Case Scripting

I have a long history of inconsistently using title case. I never effectively internalized the rules and basically just did whatever felt right. That meant putting anything that felt like a minor word in lower case, but I’d always waffle over what felt like borderline cases: capitalizing with,1 words after colons,2 follow-up words in hyphenated phrases,3, etc.

In Episode 173: Fork the Universe of The Talk Show, Gruber and Snell talk extensively about title case, and John was good enough to link to an eight-year-old post about a Perl script to properly title case a snippet of text.

I figured this would be a good exercise in learning how to bind a Perl script to a keyboard command and then use it to clean up all the title case usage on this site.


  1. Fire up Automator.4
  2. Create a new Service. new-service
  3. Search for Run Shell Script and drag it into the window.
  4. Copy John’s Title Case Perl script and paste it into the automator window.
  5. Change the shell to /usr/bin/perl, set up the script to run on selected text in any application, and save. settings
  6. Now for key binding. Go to System Preferences → Keyboard → Shortcuts → Services. Scroll down to the Text group then select the new TitleCase service. Double click on none to bind it to a keyboard combo.5 key-binding

Now I can ensure a uniform application of title case across all my posts by selecting the title in a text editor and mashing some very specific keys.


  1. Previously There’s Nothing Wrong with the Electoral College ↩

  2. Was PowerPoint: ubiquitous and terrible ↩

  3. At first Minimum-velocity Throw ↩

  4. This is where a real how-to site would describe where to find Automator. I almost always use Spotlight to launch apps — exclusively so when not permanently pinned to my dock. ↩

  5. John’s default is ⌘-⇧-T, but that was already bound to something else in my text editor, so I used the more complicated ⌥-⌘-⇧-T instead. ↩


  • « Systems Engineering is a Thing
  • Cheeseburgers »

Published

Nov 19, 2016

by Adam Wuerl

Tags

  • automation 3

Contact

Twitter
RSS
Mastodon
LinkedIn
Stack Exchange
Micro.blog
  • Powered by Pelican. Theme: Elegant by Talha Mansoor