Using nvALT with Hook

I’ve put together a little blog post on Hook Productivity with nvALT and Marked 2 apps by Brett Terpstra – Hook. I thought we could perhaps discuss nvALT in relation to Hook here. I’ll start a separate topic for Marked2.

I see that this thread never took off, or perhaps it became a Marked 2 discussion? Of course I am new to Hook. And I am a long time user of NVAlt.

Of course I tested NVAlt with Hook right away. It is not behaving in a way that I am able to find useful however. To explain. I use NVAlt to collect my ideas all the time. It is my base level “catch all” of well, everything that I am thinking of.

When I am on a specific NVAlt topic and I collect the Link and paste the link into a different document that I am working on, TaskPaper, Nisus, whatever, clicking that NVAlt link should take me back to the NVAlt page I was on when I made the link. Except that, it doesn’t.

To test this, first select a specific NVAlt page as I have just described. Then, select a different NVAlt page, then close/quit NVAlt. Now try the Hook link on the other document. It won’t open the page you linked to in NVAlt, but the last page you had selected before you closed NVAlt.

I would love it if this worked as I use NVAlt all the time. If this worked, I could make all my stop notes a part of a new NVAlt page and link it to all my project pieces. I will start to explore how Hook can create a new note taking page at some point. As I am already doing that in NVAlt, it is too bad that I will have to think of yet another, different, way of doing things.

My Notational Velocity preferences are to save my NVAlt documents as individual rich text files. They are stored in the default location user/library/application support/notational velocity.

I’m preempting the first questions support will ask:

  1. Is your macOS language set to English?
  2. What version of Hook, and what version of Hook scripts are you running?
  3. What version of nvALT are you using?

Here’s a fix for your issue, @levelbest :

  1. Go into Preferences, either through the gear menu, or by pressing command-comma (⌘,)
  2. Go to the Scripts pane
  3. Scroll down and select nvALT
  4. Select Open Item
  5. Paste this script into the big text field:
tell application "nvALT"
    open location "$0"
end tell
  1. write nvalt in the Hook:// /document-identifier text field below that

Any new links you create now will open nvALT and load the desired document.

The problem seems to be a bug in nvALT, it doesn’t “remember” to handle URLs which are opened before it finishes launching, so when you open “nvalt://document-identifer” it doesn’t open the note unless the application is already open. I’m surprised I haven’t run into this myself, but I usually keep nvALT open in the background.

Putting nvalt in the Hook://_____/document-identifier field changes the URLs you get from nvalt://document-identifier to hook://nvalt/document-identifier, so Hook will open the URL instead of nvALT. Hook uses the Open Item script, which activates nvALT first and then opens the URL

1 Like

Interesting, thanks for the tip. The only problem with the suggestion that I have is that … I can’t see any script tab or script area in NVAlt preferences - so I can’t apply the solution that you are suggesting. Just General, Notes, Editing, Fonts & Colors. Nothing in the Editing tab (or in any other tab area) says anything about using scripts.

Storage selection is Rich Text files and is not single database (allow encryption) if this helps. I am running NVAlt 2.2.8 (128). I just had it check for updates and it says it is up to date as the current version is the latest version. Brett’s website confirms this.

ADDED: Oh wait a minute … you were speaking of doing this in the Hook Preferences. Oh, duh. I knew NVAlt triggered the preference panel with a modifier and a comma but it did not occur to me that Hook also did this. OK, testing this now.

Almost but not quite there. This script you provided fixes it half way. If NVAlt is open and I click on a different topic to test this, then I go back to my regular document, in this case TaskPaper, and trigger the link in Hook to that specific NVAlt document, it now works in the way you expected. It opens to the exact NVAlt note it was saved as.

However, when you select a different area to test, and then you close NVAlt, triggering this same Hook selection in TaskPaper only brings up the original sort pattern of a regular opening of NVAlt. It still will not default to the saved URL.

Sorry for my initial confusion concerning scripts and Hook, this is a feature I had not used or been very aware of before.