Automate macOS 12 with the Shortcuts app
Little Helpers
Organizing Shortcuts in Folders
The Sidebar pane of Preferences controls which subfolders you see under My Shortcuts . In addition to dynamic folders for recently changed or executed commands, the app provides folders for commands that work on the Apple Watch and commands for the share sheet (i.e., the share icon, but only on iOS and iPadOS). Although the Finder and Safari on macOS also offer a share icon, shortcuts from this category do not appear there. The Quick Actions options for the Finder and Services menu and the Menu Bar are particularly interesting on macOS. Alternatively, you can launch shortcuts from a Spotlight search or Siri.
If the basic actions of the shortcuts are not enough for you, the Advanced tab in Preferences will be useful. You can enable the Allow Running Scripts option to extend your shortcuts with AppleScript, JavaScript, and shell scripts. You can also let shortcuts delete without confirmation, as well as share and delete large volumes of data. However, Apple's documentation does not reveal the exact point at which a data volume is deemed to be large.
In the browser, you can structure your shortcuts by right-clicking in the free area to create individual files in Folders . Finally, I'll look at one difference between the mobile operating systems and macOS: On iOS and iPadOS you find the Automation icon, which lets you execute short commands locally on the iPhone and iPad, as well as with Apple HomeKit as a function of states or events, such as at a certain time of day, when entering or leaving a certain place, or even as the result of a system-related event (i.e., wireless or Bluetooth connections, the state of charge or connection to the mains, app-specific events, or changes to focus settings). Unfortunately, this whole concept is completely missing on macOS, but the desktop operating system does offer numerous additional actions that its mobile counterparts lack.
Loading Commands from the Gallery
Regardless of the platform, you will find the Gallery section, where you can download to your personal library ready-made shortcuts that are divided into different categories and either use them as is or customize them up front to suit your needs. Blogs and forums on the Internet also provide more or less useful examples, but you will want to check them carefully before you execute them.
For now, the Gallery is a good place to start. Download some examples to get familiar with their functions and structure, and with working with the editor. Once you have loaded a shortcut, you will find it in your collection. If you hover over it, you can run it immediately from the small play icon at the top right of the tile. A double-click on the tile opens the respective shortcut in the editor.
To begin, try two simple commands that work on both iPadOS and macOS. The Split Screen 2 Apps shortcut has just one action that does exactly what the name promises. The action expects two variables for the apps to be started. You can statically define two apps when downloading, or alternatively, each time you start the program, you can select which two apps you want the command to start. You can also change your choice in the editor later.
The Search GIPHY & Share shortcut already has two linked actions. The first action opens a free text field for entering a search term and then shows the results in the Share action, where you can share one of the matches with another app.
Initial Orientation in the Editor
The editor has the navigation bar on the right side; it is divided into the Action library and the Shortcut Details. You can switch between the two areas with the icons right at the top. The action library is again divided into two registers: You can see the basic actions in the Categories tab sorted by their respective application purpose, as well as all the applications that offer actions in the Apps tab.
Most of the apps are by Apple, with hardly any third-party providers. Apple does offer a suitable interface in the form of SiriKit, which combines the Intents and IntentsUI frameworks. However, developers would actively have to use them and incorporate them into their applications. One hopes more third-party providers will discover Shortcuts for themselves in the future. Until then, advanced techniques will help you target apps outside of Apple's ecosystem. The existing actions prove to be practical.
Buy this article as PDF
(incl. VAT)