Zettelkasten Forum

Mac tool for automation: openany://

edited January 15 in Software & Gadgets

I spent two evenings on a quick tool to experiment with URL schemes (like The Archive uses) to test something, then bundled this into an app:

Here's the gist: you can create links to open file with app, e.g. to create a dashboard of sorts with Markdown notes in e.g. The Archive


Excerpt from the README


Any app that renders URLs as clickable links can now become your external app or file launchpad.

  • 🎉 Create open-file-with-app links anywhere!
  • 🌎 Assemble dashboards to your projects in your favorite note-taking app!

For example, you can use this in almost any Markdown editor with syntax highlighting to get a clickable link that will open TextEdit:

## My favorite stock macOS apps

TextEdit: <openany://app/TextEdit>

That's a very silly example. Why would you want to launch TextEdit in such a complicated way?

Here's a more complicated example: open a file with a specific app, with a link.

The default file:// URLs you get from dragging from Finder are also clickable, but they only reveal the file. Opening the file is an extra step. Boo extra steps!!11

How about embedding a shortcut to edit a file with TableFlip and preview with Marked?

Preview:     <openany://app/com.brettterpstra.marked2/view?path=~/document.md>
Edit Tables: <openany://app/TableFlip/view?path=~/document.md>

... document goes here ...

Open any app, or any file, or any file in any app!


Powered by the openany:// URL scheme, you can launch apps and open files.

Open app:

  • openany://app/com.apple.textedit

    launches TextEdit via its bundle identifier. It's a bit cumbersome, so:

  • openany://app/TextEdit

    launches TextEdit via its app name (not case-sensitive, actuall). That may not always be unique, though. Pick your poison 🙂

Open file:

  • 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.

Open files with app:

  • openany://app/TextEdit/view?path=/path/to/file.txt

    opens /path/to/file.txt in TextEdit.

  • openany://app/TextEdit/view?url=file:///path/to/file.txt

    opens /path/to/file.txt in TextEdit, but using a file:// URL instead of a path.

  • openany://file/openwith/TextEdit?path=/path/to/file.txt

    opens /path/to/file.txt in TextEdit.

  • openany://file/openwith/TextEdit?url=file:///path/to/file.txt

    opens /path/to/file.txt in TextEdit, but using a file:// URL instead of a path.

Reveal file:

  • openany://file/reveal?path=/path/to/file.txt

    reveals /path/to/file.txt in Finder.

  • openany://file/reveal?url=file:///path/to/file.txt

    reveals /path/to/file.txt in Finder, but using a file:// URL instead of a path.

Author at Zettelkasten.de • https://christiantietze.de/


  • There may be people who don't want to do any scripting who will find this app useful. However, I will note that it has been easy for a long time to create custom URL schemes for Mac using AppleScript applets. The "Launching Scripts From Links" page has been around at least since 2012 (judging by Wayback Machine archives), and I've used its instructions to create custom URL schemes for my note system with little programming skill.

  • Can you explain the difference between openany and the tool provided by Apple?

    my first Zettel uid: 202008120915

  • @zk_1000 Which do you mean?

    Author at Zettelkasten.de • https://christiantietze.de/

  • The AppleScript applet, I think. Is Andy suggesting an alternative to openany?

    my first Zettel uid: 202008120915

  • I don't know which differences are relevant to you.

    • AppleScript will take a couple of seconds to warm up and run, so if speed is an issue, OpenAny is faster.
    • AppleScript can easily be extended if you find extending AppleScript easy. @Andy's linked example shows a dispatcher that runs other script files in response to the mein 'dispatcher' script being executed. You could make this infinitely complex and tailor to different situations.
    • OpenAny is open source and can easily be extended if you find extending macOS apps written in Swift easy to extend 🙃

    Author at Zettelkasten.de • https://christiantietze.de/

  • @zk_1000: Christian summarized the trade-offs well. The compiled Swift app will be faster, no doubt! It's good work from Christian. But modifying the Swift app requires installing Xcode, whereas creating a custom URL scheme with AppleScript merely requires opening Script Editor, which is already installed on every Mac, and pasting the code snippet that Christian provided, saving it as an application, and making one other edit in a text editor. Creating a custom URL scheme for each app with AppleScripts will also provide shorter URLs, but the openany URL scheme is more versatile. Note also that you can pass a URL from AppleScript to any scripting language of your choice simply with code like this:

    on open location this_URL
        do shell script "path/to/your/script " & quoted form of this_URL
    end open location
Sign In or Register to comment.