Shortcuts for Mac: Scripting your desktop with Apple’s Mac-only actions

When Apple brought Shortcuts to the Mac in macOS Monterey, the original set of actions accessible that take advantage of Mac characteristics were being ported in excess of from Automator.

These steps had been formerly offered (in a identical type) in Automator for buyers developing workflows to automate their jobs — with Shortcuts for Mac, people exact features had been recreated as native steps, mostly located in the Scripting classification.

This piece clarifies how to best automate your beloved Mac with Shortcuts steps for controlling your apps, transforming window arrangements, and incorporating advanced features applying the Script Editor application actions:


Within the “Apps” part of the Scripting classification in Shortcuts for Mac, customers will obtain two steps — Conceal Application and Give up Application — in addition to the present Open up Application and Break up Screen Applications.

(Image credit score: Upcoming)

“Hide App” can be utilised to conceal all windows from any app you pick out, all your applications, or, when applied various situations, a established of apps. Alternatively, the All Applications option also makes it possible for an “Except” discipline where by you leave several particular apps open up. In influence, “Hide All Applications Except” is effective as “Show Only These Applications,” an exciting use case for concentrating on a particular task.

The moment an application is concealed, its home windows will remain concealed until eventually you click on the application icon or switch to the app making use of the App Switcher, at which point the windows will reappear.

(Impression credit: Upcoming)

“Quit App” goes all the way to closing the software, like equivalent possibilities to opt for a person app, give up all applications, add exceptions, and quit various applications if included to a shortcut many times.

Give up App also consists of a Clearly show Extra button that, when expanded, reveals a toggle for “Ask to Save Adjustments,” which can display the method prompt for any relevant documents or files that require preserving. If Question to Help save Adjustments is toggled off, any unsaved adjustments will be dropped, so only use this if you have to have to force all apps to quit.

Home windows

In the Windows part of the Scripting class, Shortcuts for Mac people will also obtain steps for Obtain Home windows, Go Window, and Resize Window.

(Impression credit history: Upcoming)

Come across Windows is employed to retrieve the present established of windows open on your Mac, pulling them into your shortcut to subsequently be applied to Go and Resize the home windows. Come across Home windows consists of the ability to incorporate Filters, where you can then discover home windows by the Title, Application Title, Width, Peak, X Situation, Y Situation, and Window Index. Additionally, you can use Type By to rearrange home windows working with those people identical values, and a Restrict possibility is available if you desired to most likely kind by window index and only get 1 to get the best-most window for case in point.

This means you can, in result, look for by the title demonstrated at the prime of any window, locate windows from a certain application, only grab home windows within or over and above a certain dimensions, seem for windows in precise destinations on your monitor, and even test for the prime-most window or yet another one particular below it in the stack.

Once you have included some filters and examined which windows seem dependent on your latest set up, you can then move that new “Windows” variable into the Resize Home windows and Transfer Home windows actions as necessary to re-arrange your set up. 

(Graphic credit: Potential)

The Go Home windows motion allows you position any window into a established of nine default positions on your screen — from best, center, and base, to left, heart, and suitable. Alternatively, a Proportions area is readily available, which then allows you enter variables for X and Y coordinates, and the values you enter will regulate the spot commencing from the major-still left corner of your monitor.

Shift Home windows also contains a “Bring to Front” toggle that lets you set the specified window on prime of every thing else, or normally leave it at its current index in the window stack.

(Graphic credit history: Future)

Identical, the Resize Home windows features nine positions and a Dimensions option for specifying your individual Width x Top — the positions are Suit Monitor, Leading 50 %, Bottom Half, Remaining Fifty percent, Suitable 50 percent, Top Left Quarter, Prime Proper Quarter, Base Still left Quarter, and Base Right Quarter. Resize Home windows also contains a “Bring to Front” toggle.

Script Editor

In addition to scripting the Applications and Home windows on your Mac, Shortcuts also provides steps for the Script Editor application, the indigenous device Apple provides for creating and working scripts employing AppleScript or JavaScript for Automation.

(Impression credit: Future)

Each the Operate AppleScript and Operate JavaScript for Automation actions contain the skill to take enter, specify parameters for that script, and return the input at the close. Equally steps also consist of a remark for “Your script goes here”, where by customers familiar with AppleScript or JavaScript for Automation can spot their scripts to execute when run.

Every single action also contains a “Build” button (in the sort of a hammer icon) that validates the script contents when they are crammed out, building sure there are not any problems in the code so you can correctly debug it without the need of essentially working the comprehensive script.

These Script Editor actions are a wonderful utility for much more highly developed Mac end users and people familiar with the current scripting instruments on the system Apple initially introduced these as a holdover from Automator as Shortcuts for Mac is portion of a multi-12 months transition as the “future of automation.”

For now, these actions allow Shortcuts act as a great front-conclusion to the scripts that current Mac end users have previously crafted — the Menu Bar in particular makes these super simple to access. And in idea, in the upcoming, Shortcuts must be equipped to fix these exact same use circumstances working with indigenous steps, if that “future of automation” quotation will become the “present” of automation.

For that purpose, the greatest way to take advantage of Run AppleScript and Run JavaScript for Automation actions (for people not now common with those programming languages) is to come across superior illustrations on line and replicate them in your shortcuts, or make off scripts working with present foundations.

(Graphic credit score: Foreseeable future)

1 region I have found exciting to enjoy with is this checklist of AppleScript critical codes from blogger Christopher Kielty, who has documented all of the ways to use AppleScript to simulate pressing keys on your keyboard.

Working with the instance codes linked on the website page for precise keys — as well as modifier keys — Shortcuts end users can in effect “press” keyboard shortcuts and activate instructions from their Mac applications that are not if not equipped to be automated yet.

(Picture credit score: Foreseeable future)

(Image credit score: Foreseeable future)

Here’s an illustration shortcut “File > New” that simulates Command + N, the broadly-applied shortcut for making a new merchandise in appropriate Mac apps. This second shortcut, “Hide Some others,” employs the Command + Alternative + H keys to replicate the “Hide All Applications Except” functionality of the Hide App motion — use it as an illustration for urgent many modifiers at after.

Creating Mac additional productive

Shortcuts for Mac’s new Scripting steps for Apps and Windows let Mac users create shortcuts that beautifully rearrange their desktop set up — they can open up the exact applications they want, with the home windows in the right area and measurement, additionally hide everything that does not need to be seen just still.

And as you might observe, the potential to run scripts of any kind using Shortcuts for Mac tremendously expands the achievable abilities of what you can do as soon as these apps are open up — right until Shortcuts and Mac apps establish much more native actions for these kind of functionalities, Shortcuts users can usually test to script the Mac by itself to attain the similar ambitions.

Shortcuts for Mac continue to has more chance for automation — which includes current Documents steps and Finder equipment, plus actions for Archives, Disk Utility, and Network drives — moreover the complete host of Application Store applications that present Shortcuts actions for their possess capabilities, so the system continue to has room to improve over and above these Automator-primarily based steps.

But the Mac as a position for deep productiveness combined with proper help for automation tools from Apple is an interesting location in 2022 — I seem ahead to observing how Apple delivers that potential of automation into the existing very first-hand.

Sharing is caring!

Facebook Comments

Leave a Reply