Using Hookmark with Apple Notes

Hookmark Integration scripts version 138 reintroduced Hookmark’s support for Apple Notes.

The support of Apple Notes is complete in macOS 10.14 (Mohave) and macOS 11 (Big Sur), meaning users can copy links to Apple Notes, use links to Apple Notes, hook Apple Notes to anything (that is linkable), use Hook to New > Apple Notes (to create new linked Apple Notes notes), and perform related functions (e.g., Copy All Links). However, due to bugs in macOS 10.15 (Catalina) Apple Notes’ automation (AppleScript), Apple Notes is only partially supported by Hookmark in Catalina.

Integration details

Hookmark’s integration with Apple Notes works around several limitations in Apple Notes’ automation (AppleScript), which differ across versions of macOS. Because Apple does not expose a URL for its Notes items, we (CogSci Apps) have defined the hook://notes/ scheme. That means that when you click on these links, Hookmark will invoke its Notes > Open Item script to find the appropriate note.

When, in the context of an Apple Notes note, you use Hookmark’s Copy Link command, Hookmark will place a link in the clipboard whose URL has the form hook://notes/dt<int>. Where <int> represents the time (in seconds) at which the note was created. This is based on an idea by Artëm Chistyakov, acknowledged below. This means that the URLs will work across macOS instances and even if you turn iCloud Notes off then back on.

In the unlikely occurrence that you create two notes within a second of each other, and then copy a link to one of them, using this link may open the other note. (Hookmark could in principle find and open both, but this would sacrifice efficiency.)

When you open this note, Hookmark iterates through all your notes. So, we expect retrieval time to be a nearly linear function of the number of notes you have (depending on the efficiency of your Mac and related factors). We do not have systematic figures to offer, but on a MacBook Pro 2019 with thousands of notes it takes one or two seconds to retrieve a note.

Hook to New > Apple Notes

The Hook to New Apple Notes command now inserts a hyperlink back to the source context (resource) in which you created the note. For example, if you create a link from the Hookmark web site’s home page to a new Apple Note, the note’s name (in Big Sur) will be a hyperlink: Hookmark — rather than just a plain text label.

This gives you an extra way to navigate from the new note to the source item.

Benefit: This provides a link that you can also use on iPad and iPhone! (As long as the target of the link is reachable on those devices.)

This is analogous to how Hook to New > OmniFocus already works, where it has proven to be quite popular.

macOS 10.14 and macOS 10.15 lack a feature of Big Sur; in their cases new notes have a plain text name followed by (on a new line) a hyperlink back to the source.

Hookmark Pro users who don’t like having a hyperlink in their Apple Notes can customize the integration: Gear menu > Preferences > Script Editor tab > Notes entry.

Apple Notes in macOS 10.14 (Mojave)

Due to a limitation in Apple Notes automation, in macOS 10.14, Hookmark’s Copy Link function uses the title of the note as its initial index. So if you have two notes with the same title, Hookmark may associate the wrong entry. However, once a link is correctly established it remains correct.

Apart from this limitation, Hookmark works as well with Apple Notes in Catalina as it does in Big Sur.

Apple Notes in macOS 10.15 (Catalina)

As mentioned above, macOS Catalina Notes automation has bugs. More specifically, users cannot open links to Apple Notes notes in Catalina. However, Hookmark allows users to use Copy Link, Copy Markdown Link, Hook to Copied Link, and Hook to New within Apple Notes. Users may even call Hook to New > Apple Notes within any linkable item. When users upgrade to Big Sur (macOS 11), they will be able to fully benefit from links to Notes they created in previous versions.

Apple fixed its bug in Big Sur (macOS 11), which is why we’ve reintroduced support of Apple Notes.

Apple Notes in macOS 11 (Big Sur)

Hookmark integration in Big Sur does not have the limitations mentioned with respect to Mojave and Catalina.

Hookmark’s previous implementation

If you created links to Apple Notes using Hookmark’s prior integration, those links will still work. They have a different format, namely: hook://notes/<id>. Please keep in mind that these IDs may change if you turn iCloud Notes off and then back on, and they won’t necessarily work across Macs. Our new date-time solution is more reliable.

Acknowledgements

The algorithm used in version 138 of Hookmark’s integration scripts is based on Artëm Chistyakov’s solution which he published in Github temochka/macos-automation. Artëm’s Twitter handle is Artëm Chistyakov (@artemchistyakov). See this Twitter thread.