Publishers of technology books, eBooks, and videos for creative people

Home > Blogs > Five Automator Services Tips in Five Days: Read Summary of Selected Text

Five Automator Services Tips in Five Days: Read Summary of Selected Text

Each day this week, I'll be providing tips for creating Service workflows with Automator in Mac OS X 10.6.x Snow Leopard.  Today’s workflow will receive selected text in an application, summarize it as a single sentence, and speak the summary aloud for you to hear.

PLEASE NOTE: Services are a new feature of Automator in Snow Leopard.  If you're using an older version of Mac OS X, you can still try to follow along. However, you'll need to save your workflow as an application or plugin, rather than as a Service.

To build the workflow:

1. Launch Automator and create a new workflow.
2. Choose Service from the template selection panel and click Choose.

3. At the top of the workflow, configure the Service to receive selected text in any application.  Leave the Replaces selected text checkbox deselected.

4. Automator doesn't include an action for summarizing text, so we'll use AppleScript to perform this part of the workflow.  Click the Utilities category in Automator's action library, locate the Run AppleScript action, and drag it to the workflow area.
5. In the Run AppleScript action, enter the following:
on run {input, parameters}
     repeat with a from 1 to length of input
          set item a of input to (summarize item a of input)
     end repeat
     return input
end run

6. From the Text category in the action library, drag the Speak Text action to the workflow area.
7. Choose File > Save to display Automator's Save panel.
8. Name the Service Read Summary of Selected Text, and click Save.

To test the workflow:

1. Select some text in a TextEdit document, Mail message, or Safari window.
2. While pressing the Control key, click on the selected text to display the contextual menu.
3. From the bottom of the contextual menu, choose Read Summary of Selected Text.

The workflow should receive the selected text as input, summarize it as a single sentence, and read it aloud.

If you encounter any problems, you can download today's completed workflow here.  Just download it, decompress it, and copy it into the ~/Library/Services folder within your home folder.  If a Services folder doesn't exist in your ~/Library folder, go ahead and create it.

Don't forget to check back each day this week for a new Service workflow tip.  For more on Automator, check out my book  Automator for Mac OS X 10.6 Snow Leopard: Visual QuickStart Guide, as well as my video podcast series Mac Automation Made Simple.