Hints & Tips

Hints & Tips

Quick Look Automator Workflows

OS X Leopard's [Quick Look](http://www.apple.com/macosx/features/quicklook.html) feature is great—select any file(s), jam on the spacebar, and the contents of the file are revealed. This works with Automator as well.

Quick Look an Automator workflow, and a HUD pops up revealing the entire workflow content. In a nice touch, resizing the QL window dynamically scales the content (saving bitmaps). Note that QL only works on [Automator 2.0](/archives/automator-20-review/) workflows; older workflows will need to be opened and resaved.

Hints & Tips

Creating a Text File…With Automator!

[Systems Boy](http://systemsboy.blogspot.com/2007/03/scripts-part-7-contextual-menus-with.html) has posted a few Automator workflows that achieve the [dork-meme](http://www.tuaw.com/2007/03/28/last-post-ever-about-creating-new-files-from-finder/) of the week, *creating text files via the contextual menu*. I'm not sure why this is all the rage, but far be it from me not to get on the band wagon. It is certainly a handy function for the obsessive text-file-creating types (via [Daring Fireball](http://daringfireball.net/)).

Hints & Tips

Auto-Detect Mounted Volumes

Helping set up for the [AUPN](http://www.apertureprofessional.com/) launch party this weekend, I needed to load files onto 100 USB flash drives for the obligatory [swag](http://en.wikipedia.org/wiki/Swag) bag. To churn through it efficiently, we had an Automator workflow copy the files onto the drives. All I had to do was insert a drive, double-click the workflow app, wait until it copied the files and unmounted the drive, then unplug the drive.

After doing this a few times, it seemed silly having to manually run the workflow; I wanted it to run automatically when a drive was plugged in. Fortunately, the solution came to me in a flash (pun absolutely intended). More »

Hints & Tips

Auto-add MP3s in a folder to an iTunes playlist

From [Mac OS X Hints](http://www.macosxhints.com/article.php?story=20070301051316596): "If you'd like to automatically get songs from MP3 blogs (to discover new music without pain), and you'd like to automatically add those songs to a pre-defined playlist in iTunes when the download ends (so you have just to fire up iTunes and click Play), well, this tip is the right solution for you."

This is a nifty hack that uses Automator, Growl, and any number of downloading tools to add songs off the internet into iTunes.

Hints & Tips

System-Wide iPhoto Browser

From [MacOSXHints](http://www.macosxhints.com/article.php?story=20060429075843216) (by way of [Daring Fireball](http://daringfireball.net/)), a one-step Automator workflow that allows you to retrieve iPhoto images from within any application:

>1. Open Automator, and click iPhoto.
>2. From the list of actions, select Ask for Photos, and drag it to the right-hand pane.
>3. Save this as a plug-in, and select Script Menu (the script menu that displays in the menu bar) so it is accessible anywhere. (If this menu is not visible, launch the AppleScript Utility in /Applications/Applescript, and check 'Show Script Menu in menu bar.')

>Next time you need a picture from your iPhoto library, select this action from the AppleScript menu, and you'll have a media browser that lets you do so without opening iPhoto.

Hints & Tips

Scheduling Workflows with Energy Saver

[MacWorld](http://www.macworld.com) has a brief tutorial on how to ["Turn your Mac into a musical alarm clock"](http://www.macworld.com/weblogs/macosxhints/2006/05/automatoralarm/index.php?lsrc=mwrss). Aside from being a handy little workflow, it also illustrates how to schedule them to run when a sleeping Mac wakes up:

>"Save this workflow as an application, open the Accounts preference pane in System Preferences, click the Login Items tab and drag your workflow to the login items list.

>Open the Energy Saver preference pane, click the Schedule button, and choose the time to wake up your Mac. When it wakes up, the Automator workflow will run, telling your Mac to play the selected iTunes playlist."

Hints & Tips

Hide Running Automator Applications

From [MacOSXHints](http://www.macosxhints.com/article.php?story=20051113095905227): "...choose the Automator plugin that you want to remain hidden while it runs, control-click on it, and choose *Show Package Contents* from the pop-up menu. Inside the Contents folder, open up Info.plist, and change LSUIElement from No to Yes (if using Property List Editor) -- or change the line after the LSUIElement key line to (if using a text editor). Save Info.plist. More »

Hints & Tips

Troubleshooting Workflows

[Macworld](http://www.macworld.com/) has posted a brief article on steps to [troubleshoot](http://www.macworld.com/2005/11/features/automatortrouble/index.php?lsrc=mwrss) workflow creation. One helpful tip is to pause your workflow:

>"If one of your workflows takes its sweet time, you might want Automator to notify you when some part of it has completed. The trick is to insert the Automator: Ask For Confirmation action after the relevant part of the workflow, forcing Automator to pause the entire workflow at that point. (You can also use the Ask For Confirmation action to pause your workflow so you can make changes to whatever it’s working on.)”

Hints & Tips

10.4.3 Broken Shell Script Paths

[MacOSXHints](http://www.macosxhints.com/) has posted a [detailed look](http://www.macosxhints.com/article.php?story=20051101073100820) at an annoying problem that has cropped up in Automator 1.0.2:

> "...it appears that the 'Get Selected Finder Items' action has changed its behavior under 10.4.3, and not for the better...the problem is that the path returned by *Get Selected Finder Items* isn't usable by the *Run Shell Script* action.

> It turns out that if you take an action, any action, on the Finder selection, then the path will be correct. What's the best action to add? One that doesn't do much of anything -- Label Finder Items, with the label set to None."

Hints & Tips

Store and Retrieve Workflow Data

[J. Kevin Wolfe](mailto:jkevinwolfe@mac.com) has written a very concise [overview](http://homepage.mac.com/jkevinwolfe/otto/files/archive-0.html) of how Automator passes information from action to action, and how to "trick" it into storing data for later use:
>"To store references, use the Copy to Clipboard action from System Library. Place this after the results you need to store. Then to call it up, place a Run AppleScript action in the workflow with the following scriptlet before the action that needs the data from earlier in the workflow:

>

--Return Clipboard Contents to Data Flow 
return (the clipboard)

>This takes the information stored on the clipboard and puts it back in the Data Flow."

Hints & Tips

Adding Ruby to Run Shell Script Action

[Sean Long](www.hailstonesoftware.com) writes:
"Add this snip of XML to */System/Library/Automator/Run Shell Script.action/Contents/Resources/Shells.plist.* Now when Automator is restarted */usr/bin/ruby* will show up in the Shells: list." More »

Hints & Tips

Force Reloading the Action Library

If you develop or update your action library a lot, Automator's action cache can become "confused," leading to odd behavior. To force reload the actions, launch Automator while holding down the **option** key. Because workflows also store an action cache, misbehaving workflows should have their actions removed and replaced after the option launch has occured.

Hints & Tips

Make the Automator Action Installer Not Hide Apps

From [MacOSXHints](http://www.macosxhints.com/article.php?story=20050914121448472&lsrc=osxh): "Apple's Automator Action Installer template (available from Apple's [Installation Instructions for Developers](http://www.apple.com/downloads/macosx/submit/installers.html) page) is the recommended way to ship custom actions, and it works pretty well. However, one annoyance is its tendency to hide active apps when it runs. Luckily, the fix is easy." More »

Hints & Tips

Quick-Editing Automator Applications

Double-clicking workflows that appear in the *My Workflows* folder in the Automator Library opens the document; but double-clicked applications are launched, rather than opened (a bug report has been submitted). A workaround for this is to drag the application into the workflow pane of an empty Automator document. The workflow will appear, ready for editing. This works for .workflow files as well, of course.

Hints & Tips

Run Workflows when Connecting a Camera

Many Automator workflows involve copying photos from a digital camera or card reader. But what if you want the workflow to run automatically when you connect your camera or card? It's a simple trick using the Image Capture application.
More »