Automator for travelers

Travel has a way of magnifying even the smallest mistakes. Forget that little VGA adapter, and your entire presentation could be sunk. Forget that extra battery, and your laptop could poop out at the least opportune time. The fewer details you have to remember (or, as the case may be, forget) before, during, and after your trip, the better off you’ll be.

This is why Automator, Tiger’s new automation tool, can be such a valuable traveler’s aid. It can help you take care of all sorts of little travel-related chores. Here are a couple of Automator workflows that take advantage of the iPod to help mobile Mac users. They’re also examples of the kinds of things Automator can do, so feel free to mix and match them and experiment further.

Copy documents to your iPod

It’s every traveler’s nightmare: losing your laptop. You can alleviate that anxiety a bit by saving backup copies of your most important documents (Keynote presentations, Google maps of your itinerary, and so on) on your iPod. The bonus is that you can also review those documents without firing up your laptop (as long as your documents are legible on the iPod’s screen).

To create the workflow, open Automator and then assemble the actions indicated in the order given. (If, for example, a step starts with “PDF: Render PDF Pages As Images,” find the PDF library of actions in Automator’s leftmost pane. Then find the Render PDF Pages As Images action in the middle pane and drag it over to the right.) Configure each action as specified.

PDFs on Your iPod This workflow lets you save PDFs as images and then loads those images on your iPod for easy carrying and later viewing.
(Click image to open full screenshot)

1. PDF: Render PDF Pages As Images This action takes PDF files as input (you’ll specify which ones later) and extracts their pages as image files. The default settings (for Color Model, Format, Resolution, and Compression) should work fine.

2. Finder: Rename Finder Items This action renames the image files that are created by the previous action, and adds a unique numeric suffix to each new name. When the warning box pops up, click on Don’t Add. In the topmost pop-up menu, select Make Sequential. Select New Name and enter a name—I used Doc Page—in the text field. Leave the Place Number menu set to After Name and the Start Numbers At setting at 1, and make sure Separated By is set to Dash. Then set the Make All Numbers box to 2 Digits Long.

3. Finder: Rename Finder Items Now you’re going to append the current date to the front of each image’s new name. Again, click on Don’t Add in the warning box. Select Add Date Or Time from the first pop-up menu, and set the Date/Time pop-up to Current, the Where pop-up to Before Name, and the two Separator pop-ups to Dash. Specify whatever you want for Format, and select the Use Leading Zeros option.

4. iPhoto: Import Photos Into iPhoto Your workflow is now going to import the images you’ve created and named in the previous three actions into an iPhoto album. Select New Album and enter a name—I used Doc Pages—in the text field. A new album will be created only if there isn’t already one with that name. Then select the Delete The Source Images After Importing Them option.

5. iTunes: Update iPod This action tells iTunes to update the connected iPod. You’ll get a warning to that effect; just click on Continue.

Running the Workflow Before you run this workflow, make sure you’ve configured iTunes to automatically synchronize photos from iPhoto albums: in the iPod tab of the iTunes preference pane, select Photos, select the Synchronize Photos From option, and choose iPhoto. Select the Copy Selected Albums Only option, and then choose Doc Pages (or whatever you called your album) from the list below.

As noted in the first action, you must tell this workflow which PDF files you want saved as images. You could save this workflow to your desktop, find each PDF you want converted in the Finder, and drop it onto the workflow. But there’s an easier way: save the workflow as a printing plug-in, which will make it an option in any application’s Print dialog box.

To do this, select Save As Plug-In from the File menu in Automator. Next, select Print Workflow from the Plug-in For pop-up menu, and enter a name. (I used Doc Page Images to iPod.) Click on the Save button to complete the process.

Once you’ve saved the workflow as a plug-in, you can trigger it in any application by selecting Print from the File menu, clicking on the PDF button at the bottom of the Print dialog box, and then locating and selecting your workflow. The document will be saved as a PDFfile, and that PDF will be sent to the workflow as input.

Listen to your e-mail

You can’t always sit down and read your e-mail if you’re on the run; however, you can listen to your messages, by first converting them to audio and then saving that audio on your iPod. Here’s a workflow that will do just that.

E-mail Out Loud Convert selected e-mail messages to audio files with this workflow, which also uploads them to a special playlist on your iPod.
(Click image to open full screenshot)

Before You Start You’ll need to create a folder to hold your e-mail messages; I put a folder named Audio E-mail Messages on my desktop. Next, you’ll need to create a playlist in iTunes to hold the audio version of those messages; I named that Audio e-mail messages. Then you’ll need to plug in your iPod and configure it to include the playlist you just created when it gets updated (by either selecting Automatically Update All Songs And Playlists in the iPod tab of the iTunes preference pane, or selecting Automatically Update Selected Playlists Only and choosing the playlist you just made).

1. Automator: Run AppleScript Automator doesn’t include an action for retrieving the contents of an e-mail message. But since Apple’s Mail is scriptable and there’s an Automator action that triggers AppleScript code, it’s doable. After you’ve dragged the Run AppleScript action into Automator’s Workflow pane, replace the default AppleScript code in it with the following:

	on run {input, parameters}
	tell application "Mail"
	set theSelection to selection
	if theSelection ≠ {} then return content  of item 1 of theSelection
	end tell
	error "Please select a message in Mail to save as an iPod note."
	end run
	

2. TextEdit: Text To Audio File This saves the e-mail text as an audio file in a specified folder. Choose a system voice (if you want), and enter a name— say, Audio E-mail Message—into the Save As field. In the Where pop-up menu, select Other; then, when prompted, select the folder you created before building the workflow (Audio E-mail Messages, in this case).

3. iTunes: Add Files To Playlist This adds the audio file you just generated to a specified playlist in iTunes. Select Existing Playlist; then choose the playlist you created (Audio e-mail messages, in my example) from the pop-up menu.

4. iTunes: Update iPod This action adds that playlist to your iPod. Just click on Continue when the warning box pops up.

Running the Workflow Once your workflow is complete, you could trigger it from within Automator. However, you might want a way to trigger it quickly from within Mail. To do this, save the workflow as a plug-in for OS X’s Script menu. Select Save As Plug-In from the File menu in Automator. Next, select Script Menu from the Plug-in For pop-up menu, and enter a name—Save Selected Message as Audio File to iPod, for example. Click on the Save button to complete the process.

Once you’ve saved the workflow as a Script menu plug-in, you should see a script icon in your menu bar. To trigger the workflow, bring Mail to the front, select a message, and then choose the workflow from the Script menu.

[ Ben Waldie is the author of Mac OS X Technology Guide to Automator (Spiderworks, 2005) and the president of Automated Workflows, a company offering AppleScript, Automator, and workflow-automation consulting to Mac-based businesses. ]

Subscribe to the Best of Macworld Newsletter

Comments