URL Link to Open Specified File or Folder

I’m aware that macros can be triggered by following links like this:

kmtrigger://macro=Open%20App

Can I create a link something like this that will open the file or folder using path specified:

kmtrigger://macro=specify path to open here

Note that I’m aware links to files can be specified by simply adding file:// before file path. But this isn’t what I need as software I’m using cannot open these links.

I think you would need to:

  • Write a macro with a name like openPath
  • and use a url to do two things:
    1. open that macro, and
    2. also pass a url-encoded path to it as a parameter.

examples of following a macro name with &key=value here

kmmacro://macro=<Macro Name or UUID>[&<Key=Value>]

see [manual:URL Schemes](https://wiki.keyboardmaestro.com:8443/manual/URL_Schemes)

I was hoping the below would work, but it didn't. Attached is a screenshot of macro and in green box is the url. I need a way of passing the path specified in the url into the macro.

I'm not sure how this would interact with the restrictions on your local system, but here I find that with a macro like:

openPath.kmmacros (18.5 KB)

I can open a folder like /Users/houthakker/General Notes

by clicking this link (with a URI-component-encoded path) in an app like TaskPaper:

kmtrigger://macro=openPath&value=%2FUsers%2Fhouthakker%2FGeneral%20Notes

That works, many thanks

1 Like

this somehow does not work for folder in icloud.

it shows error that execute shell script failed as file doesn't exist.

I tried opening a folder that is on my internal SSD, it opened but when I tried opening a folder that is in my iCloud, it did not work.

I haven't experimented with kmtrigger:// over iCloud URLs – perhaps @peternlewis or others are aware of any special requirements (assuming that the URL is well formed and properly encoded) ?

Log the path and see how it compares to the path to the actual file.

iCloud paths are quite complex, so it wouldn't surprise me if the path is not quite right.