I am trying to use this but getting mixed results. I am using this to copy file links into OmniFocus, Mainly pdf files. Sometimes it works and the file will open in the Preview app and other times it just opens Finder and highlights the file? Can someone help as I would like the links to open with the default apps.
I've noticed that too — in Mojave, file:/// URLs often just "reveal" the target file in the Finder instead of opening it. Not a big deal since you can then just ⌘O to open it, but still. Anyway, I'm pretty sure it's not a problem with the macro. Probably something to do with the new security features.
For the past couple years, I had been happily using this script on a regular basis, until I recently realized that some applications (such as Obsidian) don't always handle file:/// links properly, unless they are enclosed in <angle brackets>.
After a bit of tinkering, I figured out how to modify the script accordingly:
So maybe this modified version of the script is useful to someone else, who, like me, is too stubborn to just add the angle brackets via Keyboard Maestro, and instead insists on modifying the actual script, even though their JavaScript skills are somewhat rudimentary.