Dave Girard's 101 Autodesk® Maya® Tips is now available in Kindle, interactive iPad edition and DRM-free EPUB/PDF editions. Work faster, cry less. Read more about the ebook.




Follow cgbeige on Twitter

Topics by tag:



Recently published articles by Dave G:



Free downloads by Dave G:



Mac OS X-only downloads:

DoCommander: An Automator Workflow to Perform Any Command on a Selected File

So, I have this shell script “hammeroutimages” that sends an image to Nuke for batch processing with all my .cube LUTs for a quick image treatment gallery and I have been wanting to make it an Automator action. But then I thought “I have all these one-off shell things that I do on files—why not just make the command itself a variable with input?” So I found out how to do that with a combination of existing Automator know-how with this handy tip, which shows how to pass multiple variables to an Automator workflow for use in a shell script. And I made this bad boy:

What does it do? Anything you throw at it, actually:

Download the DoCommander Automator workflow.

If you want an explanation of how it works, read the linked post above. Basically, it takes your text input and assigns it to variable $1 (this is the command) and variable $2 is your file so it sends those to echo and makes a shell script that the Terminal then opens it in Terminal.app. I could have it do it sans file but I like to see the output for some commands in a window.

Open the Automator file and change the default command to something you do often and you’ll also probably want to change the script file path to something other than your desktop.

You could probably edit the Automator workflow to use selected text as an input so that you could use something like awk in your text or HTML editor. That might get a little hairy with encapsulation of stuff though, so I’m not positive how well it would work for deep text scripting. Anyway, I hope you get some use out of it.

0 notes | Permalink