Mac OS X 10.6 Automator Services: Awesome

I’ve been enjoying how Automator in Mac OS X 10.6 lets you easily create services for simple little annoying things.  I expect it’ll take about three times longer to write about what I just did than it did to actually do it.

I’m always writing emails containing computer hostnames, and sometimes I want to include the full DNS name and IP address in those emails.  That’s especially handy when you’re writing about firewall rules, as I just was.

I created this simple Automator Service workflow in about 60 seconds.

When I select some text in a text editor and run this Service (context click, select the Service name), this happens:

“foo” -> “foo.domain.com [192.168.1.200]”

A few notes:

  1. “Get Specific Text” is grayed out because it’s disabled.  As you’ll find when writing Automator Services, you have to have some dummy text available to substitute for the selected text when developing your workflow.  You just disable this when you save the Service.  Easy, but confusing if you don’t know what’s going on.
  2. Be sure to check “Replaces selected text” at the top.  That means whatever you have selected in your text editing window will be replaced with the output of this script.
  3. Be sure to change “Pass input” in the “Run Shell Script” task to “as arguments”.  That makes $1 become your selected text.
  4. There is zero error checking.  You will probably blow up your computer and the Internet.

It actually took much longer to write this post, especially because WordPress didn’t want to create an image link for me.  Thanks, WordPress!