How to Execute the Shortcuts for Mac in macOS Monterey

have km supported that feature?

Has Keyboard Maestro supported a feature that was announced yesterday?

No.

But apparently there is scripting support and a command line tool for listing and executing Shortcuts, so it should be possible. And indeed, should be possible immediately using the Execute a Shell Script or Execute an AppleScript actions.

3 Likes

As macOS Monterey just has been released as a developer beta, then I think the developer has not made it yet. The more relevant question could be what support for Shortcuts would come to Keyboard Maestro. But I think @peternlewis needs some time to examine what is possible.

3 Likes

I noticed there still isn't Shortcuts support on version 10. Is this something you plan on adding to Keyboard Maestro via a native action?

Yes. But I generally don't pay much attention to Apple’s betas, so as far as I'm concerned, Shortcuts for the Mac has been around for a week. And after that it takes a fair while until enough folks have updated to the latest OS that it is worth my development time to support the shiny new features.

Keyboard Maestro 10 itself has also not had new features for a month or more as beta testers checked it over and I updated all the documentation.

I expect I will have direct support for Shortcuts at some point, but not for some time yet.

That said, you can run shortcuts via the command line and/or AppleScript, so you can execute Shortcuts from Keyboard Maestro already using the Execute a Shell Script action or the Execute an AppleScript action.

5 Likes

Makes sense, I understand the timeline. I would also ask to look into the possibility of adding an action in Shortcuts to Execute Keyboard Maestro Macro for two-way usage.

4 Likes

Also, Shortcuts on Monterey is still extremely buggy and should be considered beta quality, even though it’s in the release. Jason Snell and Federico Viticci have talked about this on various podcasts, as did the MPU episode that talked about it on episode 612.

Not fit for production use in most cases.

YMMV, of course, but I’m not looking at it very seriously yet and wouldn’t be surprised if we have to wait until next year for a usable version of Shortcuts on the Mac.

3 Likes

Thanks for the direction Peter!

Just in case anyone's curious, here's the Applescript code to trigger an Apple Shortcut:

tell application "Shortcuts Events"
	run the shortcut named "INSERT YOUR SHORTCUT NAME HERE"
end tell
5 Likes

I did my first Mac Shortcut over this weekend. Very surprised how buggy it is. Very frustrating. With much persistence I did get the shortcut to finally work (only way I could find to get a sensor status on a HomeKit device) but I won’t be jumping back in until they get things cleaned up.

Another way to control homekit or get homekit status is to enable "Type to Siri" in the system preferences and use KM to type requests to Siri and then to get the results back using OCR.

It's not a very good way to get the answer. In fact it's a rather painful way, unless you are happy with an audio answer, but it is another way.

I have to agree there

I used the HomeBot for Shortcuts app that adds functions on Mac to Shortcuts. Developer was very responsive to a question I had - price was reasonable and it works very well. It was the native Shortcuts parts that didn’t work well - UI got confused, values not returned per docs, etc.

I used Shortcuts starting when the first Monterey Beta came out, probably about 6 months ago. It was horrible then. I'm sure it's much better now. For example, back then there was no documentation. I had to figure things out myself. I suspect that there is documentation now. I should try it again. I have about 50 shortcuts now that I debugged months ago, so I haven't really used it much since the official release. I suspect it's a lot less buggy now that it was months ago.

Shortcuts on Mac is still barely a beta version, regardless if Apple has called it that or not.

I think Apple have done a huge disservice to the Shortcuts team by releasing the Mac app in this state. I fear people will try it, see how buggy it is, and never come back.

I just hope we don't have to wait for Snow Monterey for it to work properly, and that it gets rapidly updated now that Monterey is out.

At first I thought you meant it was still officially a beta, but (after reading the new help file, which didn't exist in beta) it seems that what you mean is that it's "barely a beta" in your opinion. What exactly would Apple have to do get it out of your "barely beta" status? Is it just bug fixes, or changes?

It would have to work more reliably and not have dozens of weird interface bugs.

Honestly, I can't say more specifically because I've given up trying to make it work until I hear from people that it has gotten better.

1 Like

I only succeeded in launching Shortcuts.app shortcuts when using Shell Scripts instead of Apple Script. And it works with HomeKit too! (which is the only reason why I would bother diving into the app)

Note: it seems to operate solely when the shortcuts stored in Shortcuts.app are named with alphabetical letters, no spaces, no simbols.

Here's the script:
shortcuts run nameofshortcut

Source: Run shortcuts from the Mac command line – Six Colors

1 Like

All of the shortcuts that I call from KM have alphabetic OR numeric characters. If you wanted to use spaces (or other characters) you could just place double quotes around the shortcut name when you call it.

Thanks, I was indeed suspecting something was wrong with my syntax, but didn't spend much time tinkering with it. Appreciate the help

Note: single quotes work, double quotes do not

Double quotes work for me. I'm guessing that you are using them in some different way than I am.