The Sorcerer’s Apprentice

At its best, automation seems like magic. Look no further than The Sorcerer’s Apprentice from Disney’s Fantasia. Just like Mickey is able to direct various cleaning implements to do his tedious physical chores, automation lets us direct our computers to do our tedious digital ones. I love automation, but I’ve come away frustrated nearly every time I’ve tried Siri Shortcuts. This most recently happened when I decided to try and rate the currently playing song in Music, thinking it would be great to casually rate music via the new Shortcuts homescreen widget. Rating songs is a fairly simple automation on the Mac. Here’s how to rate the currently playing song using AppleScript:

tell application "Music"
    set the rating of the current track to 80
end tell

And here’s how to do it using JavaScript for Automation:

function run() {
    Application("Music").currentTrack().rating = 80;
}

And hell, here’s how to do it in an Automator Workflow:

Automator Example Screenshot

As far as I can tell, rating a song isn’t possible using Siri Shortcuts. At first I figured that rating songs wasn’t supported because stars have been supplanted with “love” and “dislike”, but you can’t automate those properties either. Instead, there is only an action to “Get Details of Music” with no corresponding action to set them.

As a workaround, I opted to have Siri Shortcuts add the currently playing song to a playlist where I (or my Mac) could rate them in bulk later. Sure enough, slapping together the actions “Get Current Song” and “Add to playlist” added the currently playing song to my playlist… almost. The song that appeared in the iPad’s playlist never synced to my Mac. After going down a rabbit hole of trying to figure out why syncing was broken, I eventually tried manually adding a different song. The manually added song appeared on my Mac within seconds. I then noticed that the song added via Shortcuts was no longer in the iPad’s playlist. Repeating the steps proved that adding a song to a playlist via Siri Shortcuts doesn’t actually update the playlist. This was further confirmed when I tried again the following day only to notice the “updated” date in playlist remained unchanged when songs were added via Shortcuts.

“Add to Playlist” isn’t the first action failing at its sole stated purpose for being. Until iOS 14 the “Set Volume” didn’t work with a value of zero, meaning there was no way to automate muting1. Imagine if users couldn’t mute their iPhone using the volume in control center. People would be rightfully outraged.

Buggy actions are a bad, but they can at least be fixed. The inability to get, but not set details of a song betrays something fundamental about what Apple believes is the purpose of Siri Shortcuts.

Here’s an excerpt from Ari Weinstein and Willem Mattelaer’s Introduction to Shortcuts session at WWDC 2018:

So, before you define shortcuts, you’ll need to decide what exactly it is that you want to expose. And you should start by thinking through what are the most important things that people like to do with your apps? Because those are the things that you might want to consider exposing shortcuts for.

This statement gets to the nut of my real frustration with Siri Shortcuts. I couldn’t rate a song in Shortcuts because the developer, Apple in this case, didn’t see rating songs as one of “the most important things people like to do with” Music. Creating workflows based on popular actions is still useful, but limiting automation to only what the developer thinks are the “important things” is foolish. Not only does it encourage developers to offer limited capabilities, the very notion that the most important things done with user interaction will remain equally important with automated interaction is backwards. Important things are already streamlined in the app’s user interface. Just as an example, you know how many steps it takes to skip a song in Music? Typically one, because it’s an important thing. Skipping songs is so important that it can be done from anywhere in Music’s interface, from control center, and using most headphones as well as other hardware accessories. As you might expect, Siri Shortcuts offers a “Skip Forward” action. Conversely it takes at least four steps to rate songs in Music. I am not arguing that Apple should redo Music’s interface to make rating easier. I know rating songs is probably a niche feature, but it’s the niche features where automation can provide the most value. Developers necessarily have to streamline their app interfaces around the generally important things. Shortcuts should let users streamline their automations around things that are individually important to them.

You could argue that the reason developers are encouraged to automate only the important things is that creating pre-built actions for every niche feature is not tenable, and you’d be right. Here’s the thing though, it’s a problem that Apple already solved with AppleScript. Instead of asking developers to create actions, AppleScript asks them to build dictionaries. Here’s an excerpt from Technical Note TN2106 — Scripting Interface Guidelines:

Be object-oriented.

Being object-oriented means that your scripting is mostly organized around objects, not commands. Objects can respond to commands – documents can be printed, messages can be sent, and so on – but the focus is on the objects, not the commands. This has several benefits:

First, it matches how the rest of AppleScript, and to some extent the Macintosh as a whole, works. It is therefore more consistent and makes more sense to users.

Second, it lets you exploit various features of AppleScript, like tell blocks and whose clauses, so users can create more concise and powerful scripts.

Third, it lets you create a smaller, more comprehensible dictionary, because you can apply a multiplicative effect: n commands times m objects yields n×m actions, but using only n+m terms. Consider an application that defines a widget object with eight properties. To make getters and setters for all the properties using only commands, we would need 16 commands with distressingly repetitive names: GetWidgetName, SetWidgetName, GetWidgetColor, and so on. Being object-oriented, however, lets us define the same power using only 11 terms: widget, get, set, and one for each property, with the added bonus that get and set can be re-used.

Siri Shortcuts strongly favors actions, but actions alone make comprehensible automation needlessly difficult2. This would be true even with scripting in that “Get Details of Music” wouldn’t magically become more flexible if written out in code. Likewise, there’s nothing preventing Shortcuts from employing a more object-oriented approach like AppleScript. Developers could still offer more sophisticated actions for their “important things”3, but would be encouraged to offer a full dictionary of basic actions and objects so users could lego together whatever niche need.

Automation really does feel like magic to me, even Siri Shortcuts, but just as the sorcerer is forced to intervene after Mickey catastrophically loses control of his automatons, AppleScript will necessarily have to intervene if I want a ultimately rate a song.

That is of course assuming Apple fixes “Add to Playlist”.


  1. There is a work around that involves setting volume using a variable set to some small decimal like .00000000001. 
  2. Automator is also limited by primarily favoring actions. 
  3. Speaking of Automator, I was always surprised there wasn’t an easy way to build Automator Actions using AppleScript.