Skip to Content
Skip to Table of Contents

← Previous Article Next Article →

ATPM 12.08
August 2006

Columns

Segments

How To

Extras

Reviews

Download ATPM 12.08

Choose a format:

Segments: Slices from the Macintosh Life

by Sylvester Roque, sroque@atpm.com

My Life With Automator: How I Spent My Summer Vacation

Dear Teacher,

Sorry to disappoint you, but I didn’t do anything exciting on my vacation like go to the Grand Canyon or visit Yellowstone. I stayed home the entire time, but we did have a family reunion. That was a lot of fun. In my spare time, I wrote a few articles for About This Particular Macintosh. It’s an online magazine about Macintosh computers. The writers don’t get paid, but it’s fun anyway. If I’m really lucky, I get to help someone learn about his computer.

Last month, I wrote a How To article, “Maybe You Ought To Be Using Automator.” When it was published, I was attending a family reunion. Later that night, I received an e-mail informing me that comments had been added to the article. I read and responded to the first comment. Someone named Julia had posted a positive comment and a correction. Thanks, by the way, for keeping me on my toes. Despite the necessary correction, I was pretty excited. It usually takes several days for one of my articles to generate any comments. Some articles don’t generate a comment for months. The next day was a different matter entirely as a strange series of events started. By the time everything was over, someone named Sal Saghoian had taken up a lot of my vacation time. Well, technically, he didn’t. His program was the cause of all the trouble. If you want to find out how, read on.

On July 2nd came a flurry of e-mail activity bringing both good and bad news. On the one hand, I was flattered to discover that Sal Saghoian, Apple’s product manager for these computer programs called AppleScript and Automator, had read the article. I never dreamt someone of his stature would read my article. That was the good news. What would turn out to be not-so-good news came in the form of Willis Nash’s comment describing his desire to send automated birthday greetings to contacts in his Address Book.

Normally, I try to answer a reader’s question right there on the Web page. This time, I needed a little more information. A couple of e-mails later I was hooked on trying to make his idea work. I should be able to knock this idea out in no time, right? Besides, it gave me a good excuse to sharpen my budding Automator skills. After all, I knew iCal could schedule sending the e-mails at a convenient time. I also knew that iCal generated a “Birthdays” calendar based on entries in your address book. Unfortunately, it turned out not to be as easy as I thought. As far as I can tell, you cannot attach the necessary script to that calendar.

Somewhere around July 4th, I began working in earnest on a solution. In addition to Automator, I started using Address Book, which I had never used before. It didn’t take very long to cobble together a rough draft of a workflow that would e-mail birthday greetings to everyone in my Address Book with birthdays on any given day. Individuals with good sense would have stopped there, but my tendency to make things difficult took over.

The Downward Spiral Begins

Once the basics were worked out, I realized that among the few cards in my address book were people who didn’t have a current e-mail address. Sending greetings to them would require several days’ advance notice. Perhaps enough time to get a card and send it via snail mail. A week or two should do it. Maybe there was someone who needed a major party. That might take a month or two of advance notice. Enough time to buy a cake, hire a clown, or even decorate a bit. That might take even more notice. A month or two would be sufficient.

At this point, things became a sequence of get an idea, test for errors, try again. Lather, rinse, repeat. Oh wait, that’s a different problem. That’s how the next several days went with occasional breaks for trivial things such as eating and personal hygiene. I also took a brief detour to write the Keep It Simple With GarageBand review. At this point, I had a pretty good idea how to do each of the component tasks. I could send an e-mail on the right day, check for birthdays coming up in the next two weeks, and finally check birthdays coming up in the next two months. The problem was that I didn’t want all three components to run every day. That just wasn’t very efficient. In programmer speak I needed Automator to branch out and run different workflows depending on the circumstances. All of this should be done with little or no user intervention. The whole point was to create something the user didn’t have to remember to run.

I knew from my research for last month’s article that, left on its own, Automator does not deviate from its specified steps. It’s a little like the toy that keeps walking in a straight line until it hits the wall. Left to its own devices, Automator would just run right into the proverbial wall. Sometimes it tells you when it’s hit the wall, but it never tries to avoid running into the wall. You can make it deviate from its predetermined path by chaining a series of workflows together.

Sit Up and Pay Attention

I had already figured out how to remove people with no e-mail addresses into separate workflows. Automator didn’t know what to do if no one had a birthday on any given day. After looking at several AppleScript code samples, I solved that problem. With luck, maybe this would be done in time for a follow-up article for ATPM. The biggest problem was that sometimes sending e-mails just didn’t work. It was sending one e-mail but not sending the confirmation e-mail. Four days’ work figuring out that problem.

I know teachers are always telling students to pay attention while doing their work. Boy, were they right. If I had been paying attention, I would have realized that e-mails were indeed going to the right accounts. It looked wrong to me because I have Mail configured in such a way that I can see e-mails from all my accounts in the same Inbox. If I had paid closer attention, I would have noticed that before now. This reminds me of that time in junior high when I got five pages of arithmetic wrong because I didn’t pay close enough attention to the directions. You can’t add the whole numbers and subtract the fractions all in the same problem. I can’t quit now. This is the best toy I have played with in a long time. Besides, you can do some really useful stuff with Automator.

Under other circumstances I probably would have quit by now. Who am I kidding? I wouldn’t have even begun this task in anything other than Automator. I am not, I repeat not, a hard-coding programmer. Quit for a day or two and that urge to get back to work was just irresistible. I can’t help it: Automator is addictive. It was a little like a silicon version of good cop–bad cop. One chip telling me I was “this close” to finishing and one chip telling me to quit for my own sanity. In the end, I kept working. Thanks, Sal, for making such an addictive program.

What I Have Learned So Far

By now, three weeks have passed. I took time to create a few other small Automator projects. I can launch iTunes in one click and go to any genre of music in my library. I can launch iTunes with or without ever having to hear a podcast. It also lets me create a Finder command to rename a file without accidentally opening it by mistake. I do that all the time. Those things weren’t as exciting as the birthday greetings project, but they work. Projects like that reassure me that anyone could be having fun with Automator.

The three weeks weren’t a complete loss. I know more about Automator than I did a month ago. Not only can I make it do what Willis wanted, but I also know how to do a few other things. Maybe next year I’ll have a more normal vacation.

Also in This Series

Reader Comments (6)

Trivia Why's Guy · August 2, 2006 - 04:26 EST #1
"It also lets me create a Finder command to rename a file without accidentally opening it by mistake."

Yes, clicking on the file then clicking on the name is dangerous that way, but <CLICK> and <RETURN> works nicely. Or am I misunderstanding this?
Lee Bennett (ATPM Staff) · August 2, 2006 - 09:22 EST #2
I agree. Why over-complicate with an Automator action or script when the Return key will highlight the filename for editing?

And for those, like me, who use Cocoatech's Path Finder instead, I have my prefs set so that Return will, instead, launch the file, but the Enter key over on the numeric keypad will set me up to rename it.
Sylvester Roque (ATPM Staff) · August 2, 2006 - 10:38 EST #3
That workflow is kind of a kludge. I often forget about using the Return key. After reading your comments I thought to check my keyboard and mouse settings. Somewhere along the way I set my double-click rate to very slow. Changing it back to my usual setting seems to have resolved my problem without needing the workflow.

By the way, wasn't there a Rename command in the Finder at one point? Maybe with the keyboard equivalent Command-R.
Toby Taylor · September 26, 2007 - 22:14 EST #4
It seems that you enjoy working on something that is a little difficult to figure out. Well I have been trying to figure something out for a little while. Keep in mind I am new to Mac and even newer to Automator. Here's the thing, I imported my address book from the palm desktop since I used to have a palm treo and now have an iPhone. But all of my contacts that came from Palm desktop have a note on them that say x-palm category or something to that effect and so I started erasing them because they just annoy me. But then I noticed that there are so many of them that it would take me a very long time to do this. Then I stated thinking about the automator and trying to get it to do this task for me. I have not been able to figure out how to get it to remove the note from my contacts. If you can come up with something that would be awesome. Thanks
Sylvester Roque (ATPM Staff) · September 26, 2007 - 23:05 EST #5
I'm relatively new to Address Book as well. this was my first project to really put it to use. Give me a day or to to test an idea and I'll let you know.
Sylvester roque (ATPM Staff) · September 29, 2007 - 13:46 EST #6
I have found one possible solution for any readers who are also experiencing this problem. I found an Applescript that corrects this issue. You can find the script in the Apple Discussion Forum at http://discussions.apple.com/thread.jspa?messageID=1645258&%231645258 Thanks to bneely for that little tidbit. Although I haven't had any problems with this script I suggest backing up your Address Book data before proceeding.

Add A Comment





 E-mail me new comments on this article