Apple’s Automator for Mac is where many get their first taste of programming. Before Workflow, before IFTTT, there was Automator for Mac. A little bit of patience and creativity are all you need to start automating your Mac — you don’t need to know a single line of code.
These are some example actions you can build that should get you familiar with the various types of things you can build using Automator. With these blueprints, you should be able to get started building your own.
Getting Started With Automator
When you open a new document in Automator, it presents you a few different choices for the file type:
- Workflow — This is the simplest way to use Automator. You set up your actions, and run them from within an Automator window.
- Application — You can run these stand alone. Either processing some data passed to it, or simply kicking off an action.
- Service — Services run in other applications. They can be set up to take a specific kind of input. You then run it from the Services menu in the Application or right click context menus.
- Print Plugins — These are actions that run from the print dialog. They take a PDF document from the print menu and perform your actions.
- Folder Actions — Use these to run an action automatically when you add a file to a folder. This action works similarly to Apple’s Automatically add to iTunes folder.
- Calendar Alarms — This is a poor man’s cron job. You could go through and make a complex set of recurring tasks for the Mac using the command line. However, Calendar Tasks allow you to use the native Calendar.app to schedule tasks.
- Image Capture Plugin — Photographers using professional cameras need more than the built in Photos app. When you use Image Capture to import a picture from a camera or scanner, you can set up an action to perform as it copies to your Mac.
- Dictation Command — This option uses Accessibility’s enhanced Dictation for voice driven workflows. This dictation is not the same as Siri and requires a separate download to enable.
When you open Automator, you’ll default to the application’s iCloud drive folder. Your Workflows and Applications live here, while Services, Plugins, and Folder Actions stay local to your Mac.
We are not going to go through every document type, but will show some easy examples for you to get started with automation.
1. Service: Speak Selected Text
This action is more for practice than practicality. This build is a simple one shot action you are going to use as a system-wide service. You can use this to have your Mac read any text you select aloud. It’s also an easy way to do a second proofread of an email before you send it.
Open Automator and select New Document in the file select window. Select the Service type. The Automator window has a three pane layout. On the left, you have the action picker. On the right, you have your workflow actions and at the bottom your variables. Select the Text category to filter the list, and drag Speak Text into the main area.
Then because this is a service, you need to select what input it takes. Make sure that the Service receives selected drop-down is set to text, and the in drop-down is set to Any Application.
Save your new service as Speak Text. Now you can select text in any application right click and go to the Services entry, and you should see your action. Select it, and the Alex voice reads the text to you.
Next Steps — You can play with different voices to change the way this sounds.
2. Calendar Alarm: Get a Weekly Schedule Summary
In this example, Automator is going to set a Calendar event that gives you an alert with your upcoming weekly Calendar Events. When opening a new document, choose Calendar Alarm for your workflow type.
Select the Calendar category. Drag Find Calendar Events into your workflow. Leave Events and All set, but change Any Content to Date Starting. Then, the second box should change to a drop-down. For this example, choose weekly. However, when putting this into practice, you may want a daily summary if you have a busy calendar.
Next, drag over Event Summary. You should see an arrow connecting your two actions. As you make Automator actions, this is your visual clue that your actions connect to each other and produce your intended result.
Now, click on the Utility category. In this list drag over Set Variable, which defaults to New Variable. In the dialog, name your variable: Event Text. Then drag in Display Notification. In the title name it: Upcoming Events. Drag your Event Text variable from the bottom into the Messages: field.
Click run and a notification pops with your calendar events for this week. The notifications might be a bit tight for all your text. You may need to resize the window to see all your events. Once you’re happy, save the file and name it Upcoming Events in the dialog and click Save.
Calendar.app will open, showing an event with the name of workflow on Today’s entries. Edit the event to repeat each Monday when you start your day, or the time it is most convenient for you.
Next Steps — You can add a step to scrape all your upcoming Reminders for the week. Setting that to a second variable allows for you to display it in the same notification.
3. Application: Resize Photos and Export to Desktop
Resizing your Photos to export them is not a complex process. However, with Automator, you can shorten that to a few clicks.
This time when you click New Document, select Application. Click on the Photos category, and drag Ask For Photos into the workspace. Then, drag Scale Images over. Automator pops a warning that this action changes images, and wants to know if you want to add a step that saves the changes files to a new location. Click Add to continue. Under the Scale Images, click Options. Select the Show this action when the workflow runs.
When you run this Application, a window with a minimal version of your Photos library opens. Select a photo and click Choose, another window pops up asking for the width of the image. Enter the width and click Continue. There is now a copy of the file resized, saved to your Desktop. If you would rather resize to a percentage rather than pixels, you can select that in the drop-down in the final step.
Next Steps — There are plenty of actions that you can do with Photos. Experiment with changing the last action of this workflow to cropping, changing the file type, and adding a watermark.
4. Dictation Command: Record Screens With Your Voice
Quicktime has a built-in screen recording option. These recordings come in handy when making training documents for work, or helping friends out with their tech problems. Simplifying the process down to a voice command makes it very simple.
When choosing a new document select Dictation Command, then click Choose. In the Dictation Command field type, Start Screen Recording. Be sure to click the Command Enabled checkbox. Then go to the Movies category, and drag in New Screen Capture, Start Capture, and Stop Capture.
Click on Options for Stop Capture and check Show this action when the workflow runs.
Once you save the app, enable Enhanced Dictation by going to the Keyboard pane in System Preferences. Then click on the Dictation tab and turn on Dictation. Next, click the checkbox for Enhanced Dictation. After a brief wait (the download needs to complete), your action is now available. Press Fn twice to activate dictation. Say Start Screen Recording and Quicktime opens and starts recording. There is a dialog displayed to Stop the recording with Continue highlighted. Hide this and finish your recording.
When your video is complete, bring the dialog back to the front and click Continue. The action throws an error, but your recording is now available in Quicktime. Use the Trim option to shave off the beginning and the end of the video to hide the Stop dialog,
Next Steps — Enhanced Dictation enables you to set up a voice command for any Automator action.
5. Folder Action: Automatically Add ePubs to iBooks
Using the Automatically Add to iTunes folder is an easy way to add content to iTunes. Since iBooks broke out into a separate app, it has never had a simple of a way of adding files (on the Mac, at least). If you get an epub book outside of iBooks, adding it to the folder specified in the workflow below copies it to your library, and syncs it to iCloud.
Before you begin, create a new folder in your home folder named: Automatically Add to iBooks. When you open a new Automator document, select Folder Action. In the Folder Action receives files and folders added to drop-down, select Other. Go to the folder you created and highlight it. Then click Choose. Next, choose the Files & Folder category, and move the Get Folder Contents action into the main area. Check the Repeat for each subfolder added.
Then drag over the Move Finder Items over. In the To drop-down, select Other. The target is going to be: /Users/userprofile/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books, replacing userprofile with your username on the Mac.
If you do not see your Library folder, we have a tutorial on how to enable it. Finally, drag Open Finder Items into the main area, and in the Open With drop-down select iBooks.app. When you copy a PDF into the Folder, it now saves to your iBooks library and opens the iBooks Application.
Next Steps — Folder Action all the things. If you are digging two or three layers deep in Finder, create higher level folders to move items automatically. This Automator setup can save you tons of time.
6. Service: Send Webpage Text to iBooks
Now that we have a way to add ePub files from outside the iBooks store, what about other documents? Well if you want a PDF, you can go to the Print menu and save a PDF to iBooks. The problem there is that you end up wasting space on images. What if you want to save only the text of an article? Here is an action to let you do that.
Choose Service when opening Automator. At the top, change the Services Receives drop-down to No Input. Under the in drop-down, change it to Any Application. Select the internet category and then drag the Get Current Webpage action over. Then, grab the Get Text from Webpage as well.
Now switch to the Text category, and drag in New Text File. Change the File Format to Rich Text. Then in the Save As field name your file iBooksStopOff.rtf. In the Where field you can leave it as Desktop if you do not mind having the placeholder file visible. Otherwise, switch it in your Documents folder.
Finally, drag over the Text To ePub action. You can leave most of it at the defaults. Click Options and make sure to check Show this action when the workflow runs. To make sure your new ePub file gets added to your iBooks library, switch the Where drop-down to Other. In the file window, choose the folder we created in the last step: Automatically Add to iBooks.
When you run the service (from the right-click Services menu), it grabs the current page in Safari. If you have multiple tabs open it always takes the active tab. The action then scrapes the text and replaces the placeholder file. That converts to an ePub, and then it saves it to that folder, which moves it to your iBooks library and opens it in the app.
Next Steps — You can create a similar service to scrape the images and save them from a web page. You can convert this Service to work with selected text from any app rather than the current Safari page. Services are powerful ways to take in data from an app and process it in another app. Experiment with data types like text and images to find creative ways to save yourself time. Turn selected text into reminders or calendar events. You could grab a photo and save it right to your Photos library, or go a step further and move it to an album.
Making Your Mac Work for You
As you can see, Automator lets you do a lot without having to write a single line of code. You should explore the bible of Mac Automation, Mac OSX Automation. This site has more recipes and extensions.
If you want to bite the bullet and learn to code, Applescript by design is accessible to non-coders.
If you are proficient with automating your Mac, what is your favorite Automator hack? Did you start with Automator and move on to coding? Let us know in the comments.