Surprisingly, few people use the OS X batch processing and automation app Automator even though it is an easy-to-use and powerful tool. You can just about automate any sequence of events in OS, actions linked to various software, and the presets saved as a “workflow.” It’s like an action in Photoshop, a batch process, but so much more sophisticated than that. It’s even more powerful if you combine the power of Automator with the power of Applescripts, OS X’s native scripting language.
In this article, we will show you four cool things you can do with Automator. Once you have done these, perhaps you’ll start to experiment yourself and use it more often to automate your frequently used processes.
1. Word Count
Curiously, not many apps have a built-in word count, which is odd as with a lot of situations you have a limited amount of words, or worse still characters, that you can use for your text. You would think more apps would have this feature, but since they don’t, let’s add it with Automator.
Open Automator and choose to create a Service workflow.
Add a “Run Applescript” action, leave the “Output replaces selected text” box unchecked, and type or cut and paste the following script into the action:
Save as “Word Counter MTE,” and the next time you want to count words in any app, select the words and go to the “Application -> Services” menu, and one of the selections will be “Word Counter MTE” (in supported apps).
Some apps don’t recognise the text is selected for various reasons, but many apps will. If they do, you will get something like the following output:
2. Make Desktop NASA Image of the Day
This is a great one if you get easily bored with your desktop image. Using RSS feeds and Automator, you can make an application that when you run it seeks out the RSS feed for NASA picture of the day, downloads all the pictures from the feed and sets the top one as your desktop image.
The desktop image settings you have will remain, so set the image to cycle through all the images in your new directory every thirty minutes for a background slideshow.
Do as you did just now and open Automator, but this time choose to create an Application workflow.
Add a “Get Specified URLs” action and give it the URL:
Next drag in a “Get Image URLs From Articles” action and select “linked from the articles” from the drop-down.
Choose a “Download URLs” action and drag that to the workflow. Choose a new directory, like for example Pictures -> NasaPictures.
And finally add a “Set Desktop Picture” action.
Save it to the desktop and run it. The folder will fill with fresh NASA pictures and begin cycling through them as you work.
3. Convert Graphics by Dropping Images onto an Icon
This is a really neat one. This creates an icon you can drop files onto and convert them to jpeg, even resize them.
Create an Application workflow.
Drag in a “New Folder” action and type in the name CONVERTED FILES (type a space after the words) and a location for the folder to be created when the app is run from the drop-down.
Now click the variables button on the left-hand side next to actions, and you get some variables to drag in. Select “Date & Time” and drag “Current Time” to the space after CONVERTED FILES. Type another space after it, then drag “Today’s Date” after it.
Use the drop-down on Today’s Date and select anything without / characters in it. This will not be tolerated by the file system.
Add a “Get Folder Contents” action and drag this under the last action. This prepares the file for processing.
Add a “Change Type of Images” action and select JPEG from the dropdown. You can at this point add conversion options, but for now we’ll skip that and save.
Save the Application to your Applications folder, then locate it in the finder and drag it to the Dock.
Now when you run it by dragging any kind of file to it, a folder will be created on the desktop, and a JPEG version of the file will be saved to it.
4. Batch Rename
And finally a trivial but laborious task, renaming multiple files. Obviously this is something that should be approached carefully, but with a bit of clever coding, we can make this job a lot easier than it has been before.
This time create a new Workflow workflow. Yes, there is a workflow called Workflow. This is to create workflows that can be saved for later editing.
Drag these two actions into the workflow: “Get Specified Finder Items,” and “Rename Finder Items.” If they are hard to find, search for them in the window at the top of the list.
Configure it per the above screenshot. Add the files you want to rename to the top window. On the bottom window choose the method you want to use to rename. Choose to rename the files sequentially, add a new name such as “bird pictures” and then place a number after the name in the drop-down menus. Choose to make the numbers all three digits long in case the number creeps over 100.
An example of the file names you will end up with is displayed at the bottom of the action.
Once you’re happy with the naming action, press the play button at the top right of the Automator window, and the actions will run. Before the action, they look like this:
And after, they look like this:
Save it as a Workflow. Now you can load the workflow, run it in Automator and change the files you want to rename each time. If you rename files in exactly the same way each time, then you can perhaps save it as an application.
Do you already use Automator to make common tasks easier? What are your favourite actions? Tell us in the comments below.
Our latest tutorials delivered straight to your inbox