Keyboard Maestro Macro — Title Case With Brett Terpstra’s API

·

I have used Keyboard Maestro’s function to convert text to title case for a few months now and unfortunately it’s far from perfect. I didn’t time to sort out a better solution, so I just let it be. I recently found about Brett Terpstra’s Title Case API however…

Title-Case-Keyboard-Maestro-macro-01

I created a new macro called ‘Title Case’ and assigned the ⇧⌥⌘T shortcut to it. I use it after already writing my title, hence all the macro does it cut the selected text, run it through Brett’s API, and then pastes it back to where it was cut from. The trick was getting the shell script to work and I finally just asked Brett for a working solution — mine sucked.

input=$(pbpaste|/usr/bin/env ruby -r cgi -e 'print %Q{#{CGI.escape(STDIN.read.strip)}}')
curl -sS "http://brettterpstra.com/titlecase/?title=$input"

You can download the ‘Title Case’ macro here.

Chcesz zwrócić mi na coś uwagę lub skomentować? Zapraszam na @morid1n.

Comments are closed.