I’ve been spending a lot of time lately working with Shortcuts. I have some thoughts about them.
Adding Shortcut support to Zavala
One of the early requirements for Zavala was that it should be able to be automated or scripted. Since Zavala works on both iOS and macOS, these scripts should be able to be shared.
Prior to WWDC21 there wasn’t a shared scripting environment common between iOS and macOS. AppleScript was macOS only and Shortcuts was iOS only. I eventually decided that I would embed a Python runtime and editor to get cross-platform scripting to work.
When Shortcuts for macOS was announced at WWDC21 this year, I now had a different option. My only concern was if Shortcuts would be powerful enough to script a full outliner.
I had briefly worked on Shortcut support a couple years ago for NetNewsWire but we ran into some roadblocks. These have since been removed. Still, because of them we didn’t get the full Shortcuts support we would have wanted and I didn’t fully learn how to use Shortcuts.
Cut to a couple years later and I wanted to do some really powerful automation with Zavala. For example, I wanted to post outlines as blog posts on both Micro.blog and a Jekyll blog. I wanted to dynamically create outlines.
I’m happy to say that with some enhancements to Zavala to support Shortcuts, I’ve been able to do everything (thus far) that I’ve set out to do. I’ve written over a dozen Shortcuts, some of them fairly complicated. I was surprised at what I could accomplish with a graphical programming language.
Shortcuts are Very Capable
I’ve come to think of Shortcuts as the graphical programming equivalent of Unix shell scripts. You are expected to piece together a lot of small Shortcut actions to make a full Shortcut. Each of the Shortcut actions take an input and provide an output.
One of the big differences between Shortcuts and shell scripts is that you can define the type of data that you are using for input and output. Shortcuts has something called The Content Graph engine which can convert data to different types on the fly, so using typed data isn’t as verbose as it could be. For example, you could pass an array of URL’s to an action that only accepts a single URL. Shortcuts will automatically pick the first (usually the only) item in the array without having to specify it. Or you could pass a URL to an action that takes a Text input and Shortcuts will change it to a text input.
In iOS 15 and macOS 12, the Shortcut editor is buggy. Embarrassingly buggy. The delete button for actions almost never works. Yes, something as simple as a button not doing the simplest of tasks, doesn’t work. And it crashes a lot. Fortunately, the execution engine for Shortcuts seems to be stable and work well.
One thing I would like to see is the ability to add a Shortcut to the Share menu on macOS. You can already add it to the Share menu on iOS. You can add a Shortcut to the Services menu on macOS, so maybe that is the more appropriate location. I do think users are going to expect Shortcuts to be able to be available in the macOS Share menu since it shares an icon with the iOS equivalent.
The biggest thing I think is missing is an API to execute Shortcuts directly from within your application. Say, I write a Shortcut that moves all completed items in an outline to a row called “Done” at the bottom of the outline. I would like to be able to execute this Shortcut without leaving the application and without focus being given to the Shortcuts app. Right now that isn’t possible to the best of my knowledge.
It is pretty clear to me that Shortcuts are the future of Apple platform automation. It is powerful while still being accessible to non-programmers. I hope that this year’s quality problems are a short-term setback, because I’m all in for automating Zavala using Shortcuts.