Segments: Slices from the Macintosh Life
My Life With Automator: How I Spent My Summer Vacation
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
- About My Particular Macintoshes · May 2012
- From the Darkest Hour · May 2012
- Shrinking Into an Expanding World · May 2012
- Growing Up With Apple · May 2012
- Recollections of ATPM by the Plucky Comic Relief · May 2012
- Making the Leap · March 2012
- Digital > Analog > Digital · February 2012
- An Achievable Dream · February 2012
- Smart Move? · February 2012
- Complete Archive
Reader Comments (6)
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?
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.
By the way, wasn't there a Rename command in the Finder at one point? Maybe with the keyboard equivalent Command-R.
Add A Comment