Mac Automation: Looping Workflows
Sometimes when working with Automator, you might want a workflow to loop (or go back to the first step and continue to run through the workflow). Automator includes an easy-to-use "Loop" action, and in this Mac Automation post, I'm going to show you how to use it.Let's take a previous workflow that I wrote about: iCal to-dos. In this how-to, we got iCal to-dos sent to your mobile device via a simple workflow and e-mail. The method that I wrote about required you to send an email (and rely on mail rules) in order to retrieve your to-dos. However, with the looping action in Automator, you can easily automate this process.
Let's first build out the workflow by placing the following actions together (in the same order):
- Find Calendars In iCal
- New Mail Message
- Send Outgoing Messages
- Pause
In the "Find iCal Items" action, select "To Dos" from the "Find" drop-down menu. In the "Whose" section, select "Due Date" from the "From" box and "Today" from the second box. You can deviate from the instructions on this step and use the settings that allow you get the most use out of this workflow (for instance, you can select any interval of time you want, etc.).
In the "New Mail Message" action, enter your email address in the "To" field -- this is the address that your ToDo list will be sent to. Fill in a descriptive subject line like "My ToDo Items for Today" or something similar. Be sure to select an email account that your remote device can access.
Here's where we will differ from the original workflow -- instead of setting up mail rules, we will add the "Loop" action to the end of this workflow -- this will make the to-do process totally automatic.
When you add the Loop action, you'll notice that there are several options included to give you control on how the workflow will be looped. In the first drop-down box you will notice that there are two options: Ask to continue and Loop Automatically. The ask to continue option will prompt the user to accept a continuance of the workflow; the user will be asked to select either "Continue" or "Don't Continue" from a pop-up dialog.
We will be using the "Loop automatically" option for this workflow. When you select this option you will be asked to specify either how many times or how many minutes. This limitation keeps you from accidentally creating an infinite loop (not Apple's address, but a programming error known as an infinite loop).
This is where the Pause and Loop actions work together. If you wanted your to-do list to be sent 2 times a day, you could input "2 times" in the Loop action, and specify 43,200 seconds (half of 24 hours in seconds) for the Pause time. This would cause your to-do list to be sent twice a day, then stop.
As you can see, Automation on the Mac is powerful, and the loop action adds to that power. We'll be using the loop action more in future Mac Automation posts, so be sure to stay tuned. And if you want to read more about Automator then be sure to visit our Mac Automation page.
Share
Sometimes when working with Automator, you might want a workflow to loop (or go back to the first step and continue to run through the...
Add a Comment
Martin
5 replies to Martin's comment
I have yet to find a decent use for Automator outside of the kind of simple task I can do with Quicksilver, such as emailing selected/specified Finder items.
January 26 2009 at 11:35 AM Report abuse Permalink rate up rate down Reply
J
When I try and use the pause action it only lets me set a max of 59
seconds. Far less then the 43,200 in the example. What gives?
Hot Apps on TUAW
Deals of the Day
more deals- Used Apple iMac 17" Core 2 Duo 1.83GHz for $430 + $28 s&h
- Lounge Deluxe Stand for iPhone / iPod touch for $28 + $8 s&h
- Brookstone Surround-Sound Earbuds for $14 + $7 s&h
- Refurbished Skullcandy Tokidoki Smokin' Buds Mic'd Headset for $5 + $2 s&h
- Stitchway Backup Battery for iPod / iPhone for $5 + free shipping
- Used Apple MacBook Pro 2.4GHz 15" LED Laptop for $1,030 + $29 s&h
Software Updates
more updates- EFI Firmware Update brings Lion Internet Recovery to 2010-model Macs
- OS X Lion 10.7.3 released with Safari 5.1.3, Wi-Fi bug fix
- Aperture updated to 3.2.2, addresses Photo Stream issue
- Apple updates Keynote to address Lion issues
- Google Search app gets new look on iPad
- Apple releases Apple TV Software Update 4.4.3



7 Comments