Triggering remote Keyboard Maestro via Hazel instead of web trigger

On the last show, Rose talked about using triggering Keyboard Maestro actions on her home Mac Mini via the URL triggers and Shortcuts on her phone. I just wanted to share the alternate method, that I use, that may be safer.

On my Mac, I have Hazel monitoring the iCloud folder “Shortcuts”, which is the default storage folder for Shortcut actions. Each rule looks for a specific filename. If that file is found, it deletes the file and executes an AppleScript. That AppleScript is triggering a Keyboard Maestro Macro.

For example, if Hazel sees a file named LockWorkMacMini.txt, hazel deletes that file. Then the AppleScript triggers a KM Macro that mutes my Mac mini at work, and then locks the computer.

The corresponding Shortcut on my phone is only two actions. The first is a text action that is any text at all. Doesn’t matter what it says. The second is a Document action the saves the text as a file on my iCloud Drive. The destination path is locked to “/Shortcuts/LockWorkMacMini.txt.”

That’s it. The only person who can trigger my Hazel is someone who has write access to my iCloud Drive, and knows what filenames Hazel is looking for.

Hope that helps!


I do like this approach, but every so often when I’m syncing large Dropbox files it will take a long time to trigger - but it’s a good solution for many people!

Rosemary - good point! I do wonder whether the iCloud sync of a small text file would be delayed by a big Dropbox sync. I guess it depends on dropbox bandwidth.

Perhaps this is crazy but couldnt this be done by just copying a piece of text, since iphone & macs clipboard are now shared. You could then get KM to pick-up what is stored in the clipboard and act on that, that should be pretty instant right? So you could have a shortcut with different options and all it does is copying text.

Tom-that makes perfect sense, but I’ve never trusted hand off enough. In theory, it should work.