All the Ways I Automate

Scripting and automation have been in the conversation lately, owing to Apple's reported disbanding of the macOS team responsible for them and the departure of scripting advocate Sal Soghoian from the company last month.

They sounds like arcane, abstract concepts. And to be sure, scripting and automation are the sort of feature that's used by more like 5% of users rather than 50%. But in pondering Apple's possible shift in automation strategy, I began to consider all the ways I use it in my working life.

Why automate?

The first question is the biggest: Why is this stuff necessary? The short answer is that computers are really good at repetitive tasks, and humans aren't. We all know that our computers make our working life easier in innumerable ways, but when you come to a task that your computer just can't do because it requires a feature that your operating system or app of choice just doesn't offer, you're left with two options. One is to dive in and do that task by hand, and the other is to build something that will do that task for you.

The calculation with automation is always time saved versus time earned. If the task you're performing is a one-off that will take a half-hour, it's probably not worth spending an hour building a script to do it in seconds. But if you do that half-hour task every day or week, that investment of an hour suddenly becomes a no-brainer. You'll save far more time than you'll spend.

The calculation with automation is always time saved versus time earned.

It's still not quite that easy, though, since building automation usually requires some specialized learning; knowing AppleScript or shell scripting or command-line commands helps, and even getting up to speed on Automator can take time. Even the simplest automation systems, that let you build up actions block by block, are probably more than what most people will prefer to do. But for the people who do want to bother, they will find their investment in learning how to create automations rewarded.

Where I automate

I produce a whole lot of podcasts, and a lot of the work that goes into generating podcasts has to do with converting and processing audio files before the proper edit begins. I've built and acquired various Terminal commands and shell scripts that manage to do in one go what used to take me several stops in different apps.

For example, I've got a command that uses ffmpeg to extract track one from a QuickTime file generated by the Skype Call Recorder utility, and another that converts pretty much any file into a mono WAV. I use Marco Arment's as-yet-unreleased sidetrack command-line utility to sync up podcast audio files before editing, too.

Those three tasks, which previously required me to open Terminal and drag in a bunch of files in the right order, are all now available to me via keyboard shortcut or contextual menu in a Finder window. I do this by using Automator's Run Shell Script block to build a simple Automator Service. Services appear in the Services submenu in individual apps, and also show up in the contextual menu that pops up when you control-click on a Finder item. You can also bind these Services to keyboard shortcuts via the Keyboard pane of System Preferences.

When the Internet's Dr. Drang posted a script to process Southwest Airlines calendar downloads to make them more useful, I wrapped his script in an Automator Service, so now I can just control-click on a Southwest download and instantly transform it via his script.

And every time I post an image to Six Colors, I do it via a Service; I control-click on the image, select my service, and in the background the image is opened in Photoshop, resized to proper specifications, saved out as a JPEG with a specific quality setting, and then uploaded to my web server via the Transmit app. As a coup de grace, the proper HTML I need to paste into my story to display the image is placed on my clipboard. (That magic all happens via an AppleScript script I wrote a couple of years ago. It's still paying off every time I post an image.)

Automation is everywhere

Sometimes automation is about modifying files, but sometimes it's about connecting apps together in unplanned ways. This is generally where AppleScript comes in the most handy, though these days you can also use JavaScript to control Mac applications. (In my most optimistic moments, I envision a future where Swift becomes not just a great language for learning programming and writing applications, but for scripting Mac apps as well.)

Sometimes automation is about modifying files, but sometimes it's about connecting apps together in unplanned ways.

Of course, some apps can take advantage of scripting languages internally. I just added a perl text-processing script to BBEdit and attached it to a keyboard shortcut.

But automation doesn't have to be complicated scripts, command-line utilities, or even supplied by Apple. There are excellent Mac apps that can make your life easier without much programming. Hazel will process and organize your files. Keyboard Maestro lets you build complex automations of clicks, keyboard shortcuts, and logic--to be honest, it's what I had hoped Automator would be, but never was.

Even on iOS, a system that was never designed to support scripting and automation, life has found a way. Developers have taken advantage of the ability of iOS apps to pass URLs back and forth to create a system of inter-app communication. The app Workflow is the Automator that was never written for iOS. Launch Center Pro gives you shortcuts to specific tasks.

Even on iOS, a system that was never designed to support scripting and automation, life has found a way.

You can write code in Python using Pythonista, but you can also create powerful Python-based macros inside the Editorial text editor. I use 1Writer frequently on my iPad, which features a JavaScript-based Macro language of its own. And there are many others.

Life goes on

So while I'm sad to see Apple's commitment to AppleScript and Automator waver, the fact is that automation features are just too useful to vanish. Even if Apple didn't really care about these sorts of features, the users would find ways to make them work. The options available on iOS are proof of that. (Though with a little help from Apple, they could be much better.)

Either way, I will continue to use my Mac (and my iPad, for that matter) as a tool to get my work done, and I will keep building little bits of connective tissue to make it easier for me to do that work.

Jason Snell

Former lead editor at Macworld for more than a decade, wrote about Apple and other tech companies for two decades. Now I write at Six Colors and run The Incomparable podcast network, which is all about geeky pop culture, and host the Upgrade and Clockwise tech podcasts.