CaseLeaf

Handbook / Hookmark

Hookmark

Hookmark is a separate application that links things on your Mac together, such as a file, a mail, a task or a page, and lets you get back to them from each other. This page is about making it work with CaseLeaf. It is not a guide to Hookmark itself.

What it gives you

Press your Hookmark key over a marked passage, and the link Hookmark takes points at that passage: the document, the page and the mark, rather than the whole file.

It has to be set up once

Hookmark keeps a script per application, and it does not know about CaseLeaf until you tell it. What you need ships inside CaseLeaf: three short scripts and a README repeating these steps.

Help ▸ Show the Hookmark Folder opens a Finder window on them. It reveals the folder rather than opening the README, because you have to copy the contents of three files into another application's preferences, and for that you need the files in front of you.

In Hookmark ▸ Preferences ▸ Scripts, add CaseLeaf and paste each script into the matching field:

field file
Get Address get-address.applescript
Get Name get-name.applescript
Open Item open-item.applescript

No permission is asked for. The scripts do not control CaseLeaf; they open a web address, which any application may do, and CaseLeaf calls Hookmark back the same way. That is deliberate: Hookmark runs in a sandbox and cannot read another application's scripting dictionary, so a script that spoke to CaseLeaf by name would fail before its first line. Obsidian works with Hookmark the same way, for the same reason.

What the link points at

  • A mark selected in the marks list, or the mark you just made: the link opens the document, goes to the page, and selects the mark.
  • No mark in the frame: the page you are reading.
  • A document that has never been saved: nothing. There is no file to name, so the scripts return an empty string rather than a link to nothing.

How the address gets across

Get Address opens caseleaf://hook-get-address with a return address for Hookmark inside it. CaseLeaf answers by opening that return address with two things appended: the link, and a title for it. Get Name returns nothing on purpose, because the title arrives with the address. Open Item opens the link it is handed.

Nothing to point at is answered as well, on the return address Hookmark gave for failure, so Hookmark is never left waiting for a reply that is not coming.

The same two things are also readable from a script that is not sandboxed, as the address and subject name properties. Asking from AppleScript covers those and the rest of the scripting interface, but none of it is involved here.

The title is the text under the mark, cut to 120 characters, and the document's name when the mark covers no text. On a form whose fields sit on dotted leader lines, that text is a run of dots, so a link made from one is called a run of dots. That is what is on the page, but it is not a useful name.

See also

Watch: a short video for this page is still to come.


Contents