How to Create a Service in Snow Leopard


I'll walk you through the creation of a simple Service using Automator. Even if you're not a programmer, and you find the thought of AppleScript scarier than a root canal at the dentist, I promise you'll have nothing to fear by following this tutorial.

At the end, you'll have a functional Service, along with (hopefully) enough knowledge to venture into the creation of your own Services. If nothing else, though, you'll get a sense for just how easy it can be to create simple Services.


Obviously, this tutorial is only for those running OS X 10.6. You'll need to have some PDFs available to test with the Service, and enough extra drive space to save the text files you'll create--and trust me, if you don't have that much free space, you've got much larger issues than not being able to follow this how-to!

As an aside, I also created a video version of this tutorial [3:15, 11.6MB] as a learning exercise for Camtasia for Mac, which I'm in the process of reviewing. If you'd prefer to watch the video version of this tutorial, just click the above link. It differs slightly from this version, but creates the same text extraction Service.

Build the Service


This will open a (mostly) blank template, which will look familiar if you've used Automator in OS X 10.5. However, up at the top, you'll notice a thin section with two pop-up menus and a checkbox; this area is used to define what type of information your Service works with, which applications it works in, and whether the action it takes replaces the selected text or not.

Click the first pop-up menu, and set it to PDF Files, as that's the type of file we'll be working with. Click the second pop-up menu, and set it to Finder, as that's where the Service will be activated. The checkbox won't be clickable, as we're not working with a selection of text.

Now it's time to create the actual Service. Because the Service is only launched after selecting one or more files, we don't need to do any work to find the files we'll be working with; they're passed in when you launch the Service.


Set the options on this action as you prefer--I used Plain Text output, and added a page header. I left the destination set to Desktop (as the file will be moved later), and the output file name the same as the input name (but the extension will differ, so there's no conflict).


When you drop the workflow, a dialog will appear asking if you want to first copy the items before renaming. Since you'll be renaming a just-created file (which can be easily recreated), there's no point to make a copy, so click Don't Add.


After renaming, the final step is to move the file to its final destination. In my case, that's to a folder named _Extracted PDFs on my Desktop.

In the Files & Folders column in the Library, drag the Move Finder Items action to the bottom of your workflow. Click the To pop-up menu, and navigate to the folder where you'd like to save the files; select Other if it's not one of the predefined destinations. Click once on the target folder, then click the Choose button to set that folder as the destination.


Using the Service


Wait a second or two (or longer, if you've chosen a huge PDF), then navigate to your chosen folder. There you'll find one text file for each PDF you had selected, each containing the text from that PDF.

This is a very simple example, but I hope it gives you a sense for what's possible with Services in Snow Leopard.

The ability to create your own Services--or for others to create distributable Services--should lead to an abundance of available tools to help you with those tasks you do on a repetitive basis. Personally, I'm keeping my eyes peeled for the surely-in-development "Write weekly Macworld blog entries" Service. Until it arrives, though, I'll continue writing them myself.

Shop ▾

Subscribe to the Best of TechHive Newsletter