Affiliate Disclosure
If you buy through our links, we may get a commission. Read our ethics policy.

How to run basic and advanced Shortcuts on iPhone & Mac

Shortcuts can use advanced features like AppleScript

Last updated

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.

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.

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.

  • Clean Up Screenshots: Found in the Photography section, the Clean Up shortcut offers a list of screenshots for the user to decide whether to save or delete.
  • Stop Distractions: Under the Get Stuff Done category, this shortcut will quit all running apps except for a few chosen by the user, then turn on Do Not Disturb.
  • Translate Text: In the Writing Toolbox category, this shortcut is a quick way to speak text and view it in another language.

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 A shortcut to download videos from the web
  • SW-DLT: Using an iOS terminal app called "a-Shell," this shortcut can download videos from across the web.
  • Summarize Article: Making use of ChatGPT, it uses OpenAI's artificial intelligence tool to summarize any article from the web.
  • Song Links: Using the Toolbox Pro app, users can share a link from a popular music streaming service and have it output the link to the same music on their preferred streaming service. For example, sharing a Spotify link from a friend and finding it on Apple Music.

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 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.