Can Siri Be Used to Trigger a KM Macro?

triggers

#1

Continuing the discussion from Trigger Suggestion: Siri/Reminder List Change:

@peternlewis,

The above topic prompted this question:
Can Siri Be Used to Trigger a KM Macro?

That would be very cool!


#2

I don’t have a Mac running a Siri-equipped OS, but since Siri on the Mac can respond to “Open [name of app]”, then an AppleScript invoking a KM Macro which has been saved as an application should work. Obviously, that doesn’t make all of a user’s KM Macros accessible without a lot of work, but maybe some people would find it useful for a selection of their macros.


#3

Thanks, that is one solution.

What would be ideal is to tell siri "open Keyboard Maestro macro <name of macro>", so that it works much like the KM Trigger by Name Action.


#4

Certainly, that would be the ideal setup for Siri on Mac. But I don’t think Mac Siri even has support yet for third-party apps. Combine that with this week’s revelations about backend disorganization regarding Siri at Apple, and that type of functionality looks a long way off. Personally, as someone who prefers the speed of a Spotlight-style interface since it doesn’t have the lag that comes with voice recognition, I would stick with Spotlight Search Prompt from @DanThomas even if I had a Siri-equipped Mac (and I figure I eventually will).


#5

Thanks. I use other methods of triggering macros all the time, including the one by @DanThomas.

However, I would also like to trigger by Siri. That is the subject of this topic.


#6

As far as I am aware, there are no direct application APIs for Siri, so anything would have to be indirect (which is sad, but typical). Really sad when you think of the accessibility opportunities allowing Siri to interact with accessibility/productivity tools would provide.

So you’d presumably have to use techniques like opening an applet or something like the original detecting a reminder change (however that might be done), etc.

I don’t know of any particularly good one, nothing better than an applet anyway.

If you can open a file, Keyboard Maestro can save a trigger file (File ➤ Export as Trigger File) but I don’t know if Siri will let you open a file.


#7

An alternative solution, if you don’t want to save the entire macro, is to trigger it by a script that is saved as an app:

tell application "Keyboard Maestro Engine"
	do script "<UUID>"
end tell

You could the app “Keyboard Maestro macro .”

Thanks to @JMichaelTX for showing me how to do that earlier:

(menu Edit > Copy as > Copy as UUID)

At some point, what you could do is have siri trigger a separate script (say something called “keyboard maestro launcher”) that has different commands for each of your apps. I’m sure it could be done given enough time. Siri is much better than the apple dictation, however.


#8

Don’t tell her, or her parents, but Siri is an idiot. LOL

Ask Siri to find files on your Mac

For example, you can ask Siri to search for all the documents that you opened this week.

When it says “documents” it literally means files in your ~/Documents folder.
It is restricted to that.

Since I almost never create any files there, that is worthless to me.

In another thread I guessed that Siri might use the Spotlight technology. That is clearly not true. She should, but I guess she is still in kindergarten.


#9

Well said :nauseated_face:

\startRant

Sometimes I have the impression Siri is designed for folks that use their Mac exclusively for adding entries to Calendar, writing Reminders and Notes, etc., and besides that are mainly interested in the latest soccer/football/baseball results.

\stopRant

No, seriously: I think they know how bad Siri is, and that’s why they are reluctant to improve it. (Every attempt to improve something carries the risk to make it worse.)


#10

Peter,

It looks like Mojave now has an SDK for Siri: Sirikit

https://developer.apple.com/documentation/sirikit

For the time being I am creating some KM Macros that interact with "Type to Siri" to turn HomeKit devices on / off. It works - but obviously it's UI and who knows how reliable this will be. Some integrated Siri functionality in KM would . be . amazing! ... v9????? :wink:


"Type To Siri"
#11

Noted.


#12

Hi guys, I'm new here and only got Keyboard Maestro a few days ago. I was thinking on how to control Mac with Siri and just wanted to tell you it was quite easy, using Shortcuts app on iPhone and iPad. I first created a Macro in KM with folder trigger, used Dropbox (best solution to have it installed on Mac for fast sync as opposed to mounted by 3rd party apps), then in Siri shortcuts made: when I say "Hey Siri, open video editing workflow", that action creates a text file in a specified Dropbox folder, which in turn, runs the Macro on the Mac. My Macro is to launch a few apps and Finder windows for a quick start on my workflow. Then the last thing I have set up in KM is to delete the newly created file so that the trigger folder is always empty.

I got 1 question though. Is it possible to open 2 new finder windows on a specified monitor perhaps?

Thank you and hope this helps...


#13

Hi @MPand, you can use the SSH action in Siri Shortcuts to directly retrieve and execute a Keyboard Maestro macro or macro group.

You can see an example of how I unlock my Mac's via a Siri shortcut here:

Using the Siri shortcuts, I also lock the Macs again or start a backup / synchronization and much more.
You are spoilt for choice :wink:

It is in German, but the procedure should be understandable as well :nerd_face:


#14

I'd be much more interested in how to tell Siri on the Mac (Mojave) to trigger (or edit) a KM Macro.
Is that possible? @peternlewis?


#15

Not directly.

Perhaps by creating Services or Automator workflows?


#16

I myself call KM macros or macro groups via the KM URL @JMichaelTX & @peternlewis.

The disadvantage to the Automator workflow would be with a macOS new installation, that one would have to enter everything again laboriously manually.


#17

Yep, I get that. Unfortunately the disadvantage with your approach is that you have to create a new entry in the Dictations preferences for each KM Macro.

I'd like to use Siri because that should work automatically with every active Macro, without any special work on my part.