Automator is a little used, and misunderstood application available to all Mac users. If you’ve used it before, then you might find this article interesting as it looks at setting up an automatic folder action for your workflow. If the previous sentence didn’t even make sense, then read on to find out what Automator could do for you. 🙂

OSX, like Windows, has a scripting utility built into the OS that allows you to automate common tasks. On the Mac that tool is AppleScript, and you can use it to instruct the OS or certain applications to carry out tasks. Not all applications can be directly controlled by AppleScript – but some of the most useful ones can be. In this post I’ll show you how to create a basic workflow to scale an image file down to a suitable size for uploading to a WordPress blog, and then convert that image to a PNG file. I’ll then attach that workflow to a specific folder, so that any files that are dropped into that folder are automatically converted by the workflow we setup.

The first hurdle is to learn how to write AppleScript. Luckily Apple have thought about this, and have created a tool that saves you having to write ANY code whatsoever. That tool is an app that ships with OSX called Automator. Search for it using Spotlight – or look for it in your Applications folder – and when it launches you’ll see this interface:

automator-ss1

We’re going to create a workflow for files in a particular folder, so select the ‘Folder Action’ template and press ‘Choose’.

Now you’ll see the automator interface where we can begin to build our workflow of actions. There a a large number of scripts, referred to as ‘Actions’, already defined in the Library. If you know what you’re looking for, you can just search using the text box at the top. Or you can select the various categories of scripts depending on the kind of workflow you want to build.

For this example I need to have any image I’ve dropped into a specific folder resized to a certain resolution, and then converted to a PNG file. So the first script I need is one that will scale or resize the image. Click on the ‘Photos’ category, and you’ll see a ‘Scale Images’ script. Just drag it across into the workflow area on the right. You may see this warning pop up when you do:

automator-ss3

This warning is important! What Automator is telling us is that if we don’t do anything at this point, these scripts or actions will be performed directly on the files we drop in the folder. In other words, the original files will be changed and overwritten. In this example, that’s ok. I want the workflow to operate like a dropbox. But in other workflows this will probably not be a good idea. If you click Add, it will add a ‘Copy Finder Items’ action which allows you to select a location to create copies of the files that this workflow produces. For now, click ‘Dont Add’, and continue.

Next we need to add an action that will convert the images to PNG files. This action is sometimes a little tricky to find as it’s named ‘Change Type of Images’. Look or search for it, and drag it into the workflow below the ‘Scale Images’ action.

automator-ss4

Now that we have the two actions we need to complete our workflow, make sure the paramaters are set correctly. For this example, I know I want to scale the images to ‘1024’ pixels, which will make sure the longest side of any image is scaled to this size. The image type needs setting to ‘PNG’ in this case.

Because we chose to attach this workflow to a folder, the top of the workflow pane asks us to select the desired folder:

automator-ss5

I simply created a folder in my Pictures folder called ‘Converted images for blog’.

Now simply select ‘Save’ from the File menu. Because this is a folder action, it wont ask you where to save the workflow – but simply ask you for a name for the action. I simply named it ‘Convert and overwrite images for WordPress blog’.

… and that’s it. You can quit Automator now, and try out your new folder action. Just drop an image file into the folder you created, and within a few seconds later you should see the image automatically resized, and converted to the PNG format. It’s that easy!

If you need to manage your folder actions, simply CMD-Click on the folder in question, and choose ‘Folder Actions Setup…’. Here you can see what actions are already in use, and even select from some common built-in folder actions. You can also select an action to edit from this window, so if the workflow needs tweaking that’s easy too!

This is just the beginning, of course. Automator gives you a very quick and easy way to build workflows to process files. You can attach them to folders, as we have done in this example – but you can also run the scripts directly from within Automator, which is handy for one-off batch conversions. You can also create standalone applications from your workflows, which you can use to drop any file onto to begin processing.

Take the time to explore what Automator can do for you. The number of features available increases if you have compatible applications installed – and there are plenty of free and commercial actions you can download from Apple’s Automator website. Automator workflows can be as simple or as complex are you like, and if you want to take the next step you can even insert AppleScript code directly into your workflow.

If you ever find yourself repeatedly doing some common task on your Mac, take a few minutes out of your day and see if Automator can help you work that little bit smarter. Automator’s workflows are completely portable, so anything that works for you can easily be shared with your team or friends.

Go automate yourself! 😀


5 Comments

J.D. · 28 February 2011 at 7:41 pm

Thank you for the post… I’ve had a lot of fun in the last week automating some basic tasks.

I’ve run into a question. I’ve created folder actions that are set to convert large movie files to mp4 for adding to itunes. When I add single files I see that the folder action is working from the tray icon.

However, often I like to add several files at once, and I usually end up shutting down or restarting before all the files are converted.

How do I resume a folder action when the files have already been added, but the conversion has stopped?

Timothy · 6 April 2011 at 7:19 pm

My setup:
xServe with several mounted volumes from attached Promise RAID.

When I attach a folder action to a folder within one of the shares, my Folder Action does not execute (logged in to server as admin). When the same action is run on a folder local to the server, it executes just fine. What up?

1) Filter Images by Orientation
2) Scale Images
3) Change TYpe of Images

?? Any suggestions appreciated.

/timothy

Oliver · 6 April 2011 at 8:45 pm

Hi Timothy,

First question: Are you using XSan, or any other kind of SAN to manage your storage? The reason I ask is that I’ve had problems using SAN storage for dropboxes on Final Cut Server and Episode Pro before now, and wonder if the same problem might affect Folder Actions?

Oli.

Timothy · 6 April 2011 at 8:52 pm

Nope, straight attached storage with LUNs and volumes presenting. Its weird, the same Automator set of tasks perform locally on the server and locally on my desktop. They just won’t run when attached to a folder inside one of the shares.

Robert Stott · 30 September 2014 at 3:37 pm

If you want to create an Automator workflow to work with Adobe Illustrator then Ai Actions is pretty useful. http://www.ghostotter.com/illustrator-automator-actions/

Leave a Reply

Avatar placeholder

Your email address will not be published.