Linking to Apple Notes

For those of you that have followed my blog for a while, you know I’ve really wanted to use Apple Notes for my personal knowledge management for a while now. There’s really only one thing holding me back – linking. For reasons unknown to me, Apple seems to have no intention of adding linking any time soon despite it being a feature that’s present in almost every other note taking app.

Even Apple’s other apps like Mail have a way to uncover a link using AppleScript at least. If you want a link to a note in Apple Notes, on the other hand, you have to act as though you’re sharing it with someone via phone or email even if the person you’re sharing it with is just yourself. Oh, and then it adds a wonderful Shared section to Notes to remind you of all the notes you’ve shared with yourself.

My frustration eventually lead me down a rabbit hole that lead to this post – a [very convoluted] way to generate a link to a note without sharing it.

Allow me to introduce how I link to notes in Apple Notes using Keyboard Maestro and Shortcuts.

The Starting Point – Opening an Apple Note with a Shortcut

Theoretically, if you only link to a few notes, you could just create dedicated shortcuts for each note you want to link to and then link to the shortcut using the format shortcuts://run-shortcut?name=Shortcut%20Name. If that sounds good enough for you, you can swap out Clipboard for the actual note title in the following shortcut and call it a day. I, however, like to link to a lot of notes, and I really didn’t want to have to create a new shortcut anytime I wanted to link to a new note.

(By the way, links to everything are included. You’re welcome.)

I started by creating a generic “Open Note” shortcut that opens a note based on your clipboard. This is a simple two-step shortcut:

  • Find All Notes where Name contains Clipboard
  • Show Notes

Adding On – Generating a URL Base to Launch the Open Note Shortcut

Like Shortcuts, Keyboard Maestro can launch automations via URL, but it has one super power over Shortcuts’ URLs – the ability to pass a value through a URL. This means we can use it as a common URL base to run the shortcut above for any note just by changing the URL.

The macro is as follows:

  • Set System Clipboard to Text “TriggerValue”
  • Execute Shortcut “Open Note”

Almost There – Generating the actual Note Link

Now, honestly, at this point we have the base URL, and you could just manually create the links at this point. For example, “kmtrigger://macro=Open%20Apple%20Note&value=Work%20Ideas” would open my Work Ideas note.

But I don’t do clunky, and typing things out particularly when they involve percent encoding multiple words is one of my least favorite things to do. Thankfully we don’t have to, and for this I give you two options:

Option 1: Keyboard Maestro

I set this up using Keyboard Maestro initially because I’m more familiar with it, and because I already did the legwork, I’m including it here. For those of you who want a universal option, feel free to skip ahead to option 2 which uses Shortcuts instead meaning it will work on Mac OS, iPad OS and iOS.

Using Keyboard Maestro I set up a second macro that works only when I’m in Apple Notes, so that when I press ⌘K it copies the note title I’ve selected and generates the URL for me.

  • Triggered by any of the following (when Notes is at the front)
    • This hot key: ⌘K is pressed
  • Will execute:
    • Copy Selected Text
    • Filter System Clipboard with Percent Encode for URL to variable Note Title
    • Set System Clipboard text to “kmtrigger://macro=Open%20Apple%20Note&value=%Variable%Note Title%”

Now I can generate a link to any Apple Note that can be pasted anywhere on my Mac. If you only ever use a Mac, cool, you’re done, but I suspect most of you are like me and use iPhones and iPads.

Keep reading.

Option 2: Shortcuts

We can do the same thing in Shortcuts using a shortcut that receives text input from the share sheet that percent encodes the selected title, appends it to the base URL, and adds it all back to the clipboard, just like the Keyboard Maestro version, but Shortcuts means unlike the other option, this one will work on Macs, iPhones, and iPads.

Side note: If you want to use it on MacOS, you need to check a box to have this enabled in the services menu and optionally via a keyboard shortcut by going to the Details pane.

One More Thing – Parsing a Keyboard Maestro Link

Now we have our links, but we still need to use them. Again, if we’re just using a Mac with Keyboard Maestro, we’re fine using the links as they are. We’re out of luck if we want to use them on our iPhones or iPads though, which brings us to our last and final piece of the puzzle.

This is simply a shortcut that works in reverse of what we did earlier. Select the URL and select share from the pop up menu. It grabs the selected URL, removes the base Keyboard Maestro URL, percent decodes the URL, and then opens the note with that title.

So in summary here’s everything.

  1. Open a Note using Shortcuts
  2. Generate the base URL using Keyboard Maestro
  3. Generate the unique note URL using Shortcuts or Keyboard Maestro (Mac only)
  4. Open the Link on an iOS/iPad OS Device

I’ve only been testing this for a bit, and admittedly my brain is fairly exhausted after putting all this together. I also will never claim to be an expert in Shortcuts or Keyboard Maestro, so there is probably a way more elegant way to do this. I’m open to suggestions. In testing, I’ve only run into a few issues in terms of notes having similar titles or content. In that case, Shortcuts graciously gives you the option to pick the note you want from the results.

Hopefully that helps some of you. I’m off to give my brain a sorely needed break. Happy note taking.

Advertisement

2 thoughts on “Linking to Apple Notes

  1. Justin Stotts says:

    I’m missing something…. and I’m sure it’s me not you lol. I am trying to use the non-keyboard maestro version, but when I click the link under “option 2: shortcuts” it downloads a shortcut that has a KM action. Am I supposed to modify that?
    I appreciate the write up!

    • Andrea says:

      Hi Justin, yeah sorry about that. If it wasn’t clear, all of this is relying on Keyboard Maestro (KBM) at some point because that’s the basis of the URL scheme being used. I included this option mainly for generating the KBM links on an iOS device where KBM isn’t available.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.