Opening Things

February 2014

To be perfectly honest I didn't quite accomplish what I wanted, but I figure I might as well post what I found as not in case I'd like to revisit it later.

I wanted to be able to launch files in iA Writer much like one is able to with Sublime from the command line. With a little digging in its app contents I found an executable and assumed I might be able to alias to something like iA or something less laborious to type if they were longform articles while still retaining the ability to open them in sublime if they were just code READMEs. Options, you know.

After trying to create a symlink I noticed that nonetheless I couldn't launch the app, for whatever reason. I initially thought that I had botched the symlink but then found that it had something to do with the executable I'd found. Unfortunately, digging around in it did little good, as it was a binary file.

... Charming.

Trying to open anything with it with absolute paths to the executable gave me some new information, although I couldn't dig any deeper without access to the code it came from.

Since it seemed to have issues finding my README file, I gave it the proper path, not that that changed much.

Curious. After digging around where it suggested I look I wasn't able to launch it even after giving everyone full access to test. Ultimately I just changed all .md files so that they would automatically launch in iA Writer instead, although it wasn't the solution I had hoped for. At the very least, it allows me to just type open README.md and have what I expect to happen.

Anyone ever tried to do something like this? It would be lovely for certain file types if I had options for which program they were opened in, not just the preferencial program set through Finder.

UPDATE, as of 9:26pm:

@myobie on Twitter very quickly found a solution, which was exactly what I needed:

@helenvholmes just FYI you can do $ open README.md -a iA\ Writer (also iA="open -a iA\ Writer")

— Nathan Herald (@myobie) February 6, 2015

Absolutely perfect! Immediately aliased in my .zsh profile. Score! Thanks Nathan!