Using Hook with Apple Notes

Hook Integration scripts version 138 reintroduced Hook’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, 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 Hook in Catalina.

Integration details

Hook’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 Hook will invoke its Notes > Open Item script to find the appropriate note.

When, in the context of an Apple Notes note, you use Hook’s Copy Link command, Hook will place a link in the clipboard whose URL has the form hook://notes/dt<int>. Where <int> 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. (Hook could in principle find and open both, but this would sacrifice efficiency.)

When you open this note, Hook iterates through all your Notes notes. So, we expect retrieval time to be a nearly linear function of the number of notes you have (parameterized by 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 1 to 2s 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 Hook – Find without searching website to a new Apple Note, the note’s name (in Big Sur) will be a hyperlink: Hook – Find without searching — 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, so in their cases new notes have a plain text name followed by (on a new line) a hyperlink back to the source.

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

Apple Notes in macOS 10.14 (Mojave)

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

Apart from this limitation, Hook 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, Hook 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)

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

Hook’s previous implementation

If you created links to Apple Notes using Hook’s prior integration those links will still work. (They have a different format, namely: hook://notes/<id>. Please keep in mind, as noted elsewhere on this website, 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 Hook’s integration scripts is based on Artëm Chistyakov’s solution which he published in Github macos-automation/src/notes at master · temochka/macos-automation. Artëm’s Twitter handle is Artëm Chistyakov (@artemchistyakov) / Twitter. Compare this Twitter thread.

Hook Productivity App Newsletter

Sign-up to receive emails about Hook productivity app. Our emails sometimes include coupons for discounts on great Hook-linkable apps made by other developers.





 Marketing permission: I give my consent to to be in touch with me via email using the information I have provided in this form for the purpose of news, updates and marketing.

What to expect: If you wish to withdraw your consent and stop hearing from us, simply click the unsubscribe link at the bottom of every email we send or contact us at support@cogsciapps.com. We value and respect your personal data and privacy. To view our privacy policy, please visit our website. By submitting this form, you agree that we may process your information in accordance with these terms.