How to run basic and advanced Shortcuts on iPhone & Mac

By Andrew Orr

Apple's Shortcuts app offers plenty of built-in examples to get started, but there are third-party apps and advanced scripting methods to take the tool even further.

Shortcuts can use advanced features like AppleScript

Apple's Shortcuts app, an integral part of the iOS ecosystem, is a powerful tool designed to streamline and automate various tasks on Apple devices. It provides users with a range of built-in examples, making it easier for even the most novice users to get started.

The app's intuitive interface, combined with its extensive library of pre-made shortcuts, offers a seamless experience that enhances productivity and user interaction with their devices.

However, the true potential of Apple's Shortcuts app lies beyond its built-in examples. The app opens up a world of possibilities when integrated with third-party applications and advanced scripting methods.

For users looking to enhance their automation game, these additional resources provide the means to create more complex, personalized, and efficient workflows.

Third-party apps extend the functionality of Shortcuts by offering specialized actions and triggers. Meanwhile, advanced scripting methods enable users to tailor their shortcuts to fit their unique needs and preferences.

Together, these capabilities transform the Shortcuts app into an even more powerful and versatile tool, unlocking new levels of customization and control for Apple device users.

Shortcuts from the Gallery

The Gallery tab at the bottom of the Shortcuts app has a wide variety of pre-built shortcuts for users. There are shortcuts for accessibility, ones for photography, writing, and plenty more.

Shortcuts with third-party apps

Moving on from the Gallery, various third-party apps provide actions for shortcuts.

A shortcut to download videos from the web

Advanced shortcuts with AppleScript

AppleScript is a scripting language created by Apple designed for the macOS operating system. It enables users to automate actions of the Mac and its applications using a straightforward, English-like language.

There is a "Script Editor" action in the Shortcuts app on the Mac. One action is "Run JavaScript for Mac Automation," and the other is "Run AppleScript."

Creating text files with predetermined text on the Mac desktop

An example action is the following AppleScript to send a text message to someone.

tell application "Messages"

set theBuddy to a reference to participant "CONTACT" of account 1

send "Hello, how are you today?" to theBuddy

end tell

Replace "CONTACT" with a phone number, and "Hello, how are you today?" with the desired message. Enter that into the "Run AppleScript" action and press the Run button in the shortcut to run it.

Next, an example of the JavaScript action is to create a new text file on the desktop with a specific message inside.

var app = Application.currentApplication();

app.includeStandardAdditions = true;

var desktopPath = app.pathTo("desktop");

var fileName = "/NewTextFile.txt";

var fullPath = desktopPath.toString() + fileName;

var file = app.openForAccess(Path(fullPath), { writePermission: true });

app.setEof(file, { to: 0 }); // Clear any existing content

app.write("Hello, this is a test file.", { to: file, startingAt: app.getEof(file) });

app.closeAccess(file);

Users can rename the file to something else in "/NewTextFile.txt" and change the text contained in the file under "app.write." The code will remove the previous text from the file to add new text, but that line can be removed to add text without replacing it.

By leveraging JavaScript for Automation (JXA) or AppleScript, users can tailor their computing environment to their specific needs, enhancing their overall experience and effectiveness in using their Mac.