a not-so-power-user contact was frustrated that they couldn’t link to files easily and have the default app open the linked file.
While file:// works, that reveals the file in Finder only.
I was nerd sniped by this and created a little open source tool:
OpenAny.app
It exposes the openany:// URL scheme and can be used for “open file X with app Y” in its most complex invocation:
openany://app/com.apple.textedit → launches TextEdit via its bundle identifier.
openany://file/open?path=/path/to/file.txt → opens /path/to/file.txt in your default editor of text files.
openany://file/open?url=file:///path/to/file.txt → opens /path/to/file.txt in your default editor of text files, but using a file:// URL instead of a path.
openany://app/com.apple.textedit/view?path=/path/to/file.txt → opens /path/to/file.txt in TextEdit.
openany://app/com.apple.textedit/view?url=file:///path/to/file.txt → opens /path/to/file.txt in TextEdit, but using a file:// URL instead of a path.
The most power user thing I can think of is that you can now create links in your plain text note-taking/Zettelkasten/… app of choice to launch files and apps.
fNo need to use Spotlight anymore, or the mouse, as long as you can invoked the link with a keyboard shortcut
E.g. this would launch Marked to preview a file and TableFlip to edit its tables:
Preview: <openany://app/com.brettterpstra.marked2/view?path=~/document.md>
Edit Tables: <openany://app/de.christiantietze.TableFlip/view?path=~/document.md>
... document goes here ...
Apps that fold away the link URL work best for this, of course!
If you want to check that out, you can find the downloads here:
I consider this to be beta software and want to test it a bit more, esp. if the URL scheme formats make sense or could be shortened, maybe.
If this tool arrives in your toolbox and makes something work, tell me about it!
Someone requested Shortcuts support, which I imagine could be used to create links based on Finder selection? Not sure.
IMHO using bundle identifiers is non-intuitive. The app idea is good, but I probably wouldn’t use it as often (or I’d need additional programming on my side) as I wouldn’t remember the bundle identifiers.
That said, I still have no desire to go look that up when I’m creating a link. And if there’s an easy way to query it based on the app name, ideally that easy way would be built into the app’s URL parser.
For example, “NotePlan” returned “co.noteplan.NotePlan3.”
But I got errors with “Bridge” and “Adobe Bridge.” It wasn’t until I submitted “Adobe Bridge 2024” that I got the unintuitive response of “com.adobe.bridge14.”
Sorry the README doesn’t do a good job and I forgot to mention here:
You can drag an .app onto the OpenAny app to discover app identifiers. It works with multiple apps, too.
It’s still not ideal, and it kind of assumes that you only do it once and remember this, which is unrealistic But it’s a built-in way to discover app id’s for now.
– I’m not a heavy Shortcuts user. I guess someone here is and can help Because I wonder this:
Would a Shortcuts (App Intent) help and and make sense to select an app and a file to produce these openany:// links for you?
@MevetS’s osascript approach is a great idea. If AppleScript can do it, there’s probably a built-in way to do that, too, somehow, without a (slow) round-trip to AppleScript.
Oh yes: In the spirit of 75%, allowing an app name and then selecting the first match from ~/Applications and then /Applications would probably do the trick and help with weird official but internal app names (that differ from the .app bundle you see in Finder, like the Adobe Bridge example I guess)
I’ve built and uploaded v1.1.0 to GitHub to make e.g. openany://app/TextEdit work:
Had a quick play, its a nice idea. Hookmarks does the same thing, among other stuff, so its not something I need myself. But Hookmarks is expensive and if you just need the launch from a link aspect and nothing else, this’ll do the job,
Sure. I actually did it as package, copying an existing package and modifying it, but here is the snippet version (which I had to learn how to do, much simpler!).