Macro to copy Apple Notes Deep Link

Sorry if this has been asked before, but I'm wondering if there's a way to capture the deep link of an Apple Note using Keyboard Maestro. I'd like to bind this to a keyboard shortcut for easy access, similar to what's possible with most other applications.

Did some searching and didn't see a post on this - sorry if this is duplicate.

It is possible to link to a particular Note in a couple of ways from Keyboard Maestro (in other words, to open that particular Note). But are you wanting to link to a specific point within an Apple Note? I don't think that is possible as Notes does not provide links to specific points in a Note.

Hello Brandon (@gianthobbit):wave:

Since you could format Apple Notes‘s Contents in HTML maybe you could do deep linking inside the Application by formatting everything into HTML - but beware this is only guessing on my side.

I don’t know if it might be really possible…

Greetings from Germany :de:

Tobias

No a link that you can open on either mac or iOS that would open a specific note (not a part of a specific note).

Hello Brandon (@gianthobbit):wave:

Here‘s some good information I found …

Maybe this will help you getting started…

https://forums.developer.apple.com/forums/thread/701574

https://x.com/viticci/status/1575162181053726720

With information on the linked pages you should be able to build what you want that could be accessible from any Apple iPad, iPhone or Mac.

Greetings from Germany :de:

Tobias

Note that the URL scheme only works if you sync your notes to iCloud, and the listed AppleScript requires full disk access to work (so it can run the sqlite command, I believe).

If you're just looking for fast access to a note on your Mac, you can open them via their titles with a simple AppleScript:

tell application "Notes"
	set theNote to first note whose name is "My Note Title"
	show theNote
	activate
end tell

Replace My Note Title with the title of the note that you'd like to open. Put that in a macro on a hot key, and there's a deep link on a keyboard shortcut.

With the help of ChatGPT for the "get titles" script, this simple macro pops up a list of all your notes and lets you pick one to open:

Download Macro(s): Choose Note.kmmacros (3.9 KB)

Macro screenshot

Macro notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System information
  • macOS 14.7.1
  • Keyboard Maestro v11.0.3

Depending on what your end goal is, you could use some variation of either this macro or @Nr.5-need_input's above-linked solution to get the job done.

-rob.

2 Likes

There's also a Shortcuts action:

...and you can run the Shortcut from KM:

3 Likes

Yes, as I mentioned and @griffman, @Nr.5-need_input and @Nige_S have shown, there are several ways to do this with Keyboard Maestro. Personally I use the Apple Shortcuts approach but send the name of the note via a Keyboard Maestro Action.

Which calls the Apple Shortcut:

3 Likes

Hi, @gianthobbit.

It's really amazing that Apple hasn't provided a simple means to create a deep link for a note, but as far as I know, there's no simple way to do it. (Just to be sure, I just tried holding the option key down and viewing all of the menus is Apple Notes. I didn't find anything hidden under ⌥.)

Albeit it's not automated, but there is a manual way to generate a deep link for a note if you are using Sonoma or later. (See the Link to another note section of Add links in Notes on Mac - Apple Support.)

Here the brute force method to generate a link that can be used elsewhere:

  1. Create a new blank note in Apple Notes. Optionally title it Deep Link Scratch.

  2. Below the note title, type >> (and pause your typing). A pop-up menu will appear that is populated with the last few modified notes.

  3. If you see the note of interest in the menu, select it. A link to the note will be inserted.

  4. If you don't see the note of interest, after typing >>, type the title for the note of interest. You will see the note appear in the pop-up menu. Select it to insert a link.

  5. Select the inserted link, right-click and select Edit Link.

  6. When the Edit Link dialog opens, deselect the Use Note Title checkbox. Click OK.

  7. Reselect the link, right-click it and select Copy Link.

  8. If you open a text editor and select Paste, text like the following will appear:

    applenotes:note/8af63d15-f28a-4ee6-aa6a-ba6f6cd976a9?ownerIdentifier=_5135e842e09a66ce8c37f6378ad325eb
    
  9. To quickly open the note using Keyboard Maestro, paste the text into the Open a URL action:

    Keyboard Maestro Export

1 Like

Assuming you use iCloud to sync your notes you can also use the Share menu to generate a link in fewer steps.This works on iPhone and Mac.

1 Like

I can’t try it on my Mac at the moment, but on my iPhone (iOS 18) I don’t have a Copy Link. :thinking:

@Zabobon, might that be from a 3rd party app or shortcut?

Interesting. After it worked perfectly I tried another note and no item in the share menu to create a link... Some notes have that item in the share menu and some don't (both on Mac and iPhone). I think it might be if the note has already been shared...

Some like this:
image

And some like this:
image

Maybe someone here can explain why!

1 Like

This -- you need to Share the Note first.

2 Likes

Ah, of course; I need to get more sleep. :face_with_open_eyes_and_hand_over_mouth:

I have a few shared notes and I now remember doing that. In my case, however, to check the share status first, I've clicked the Share icon, selected Manage Shared Note, and when the Share dialog opened selected the Copy Link button.


With all that said, the method I shared above creates a URL scheme link versus a Share link. See:

Defining a custom URL scheme for your app | Apple Developer Documentation

URL scheme links:

  • Are not limited to shared notes.

  • If the note is On My Mac, the link will only be useful on the mac.

  • If the note is in iCloud, the link will be useful on any device logged into the same iCloud account.


@ComplexPoint, please excuse my ignorance, but is there any chance that you could extract these with a modified version of Copy as Markdown link?

1 Like

Hi!

I can't remember where I got this macro (I think it was the Hookmark forum), but it works like a charm.
Copy Notes URL.kmmacros (3.7 KB)

Hope this helps!
Ralph

3 Likes

Yes, that works for me too, iCloud shared or not.

Thanks so much for sharing, @Ralph.

Hello to all

The Macro @Ralph shared is using the AppleScript Code I was pointing to with my shared link to the Hookmark Forum in my reply above

So a big thank you to you @Ralph for sharing the Macro.

Please Note that this Macro requires Full Disk Access for KM - otherwise it may not work !! Also note that this Script is maybe not compatible with OS Versions older than Ventura - this has to be tested and maybe tweaked if incompatibility issues exist.

Greetings from Germany :de:

Tobias

2 Likes

You're welcome :nerd_face:

I just realized that the Apple Script part of the macro could use a little modification – if you're on Sequoia:

You could change the line
set theNoteURL to "notes://showNote?identifier=" & theNoteIdentifier

to
set theNoteURL to "applenotes:note/" & theNoteIdentifier

Why?
Prior to – I guess – the last update with the ability to use ">>"-linking, you would need different URLs depending on your platform:
notes:// would only work on mac OS and
mobilenotes:// would only work on iOS.
The identifier part was the the same.

Now, all you need is applenotes:note/ as the start of your URL, and it should work on either platform.

3 Likes

Hello @Ralph :wave:

Thanks for also mentioning the changes to the Notes URL Scheme for iOS 18, iPadOS 18 & macOS Sequoia …

This is of course something that should be added …

But maybe it’s not the only thing … it might also be possible that the SQLite Database location could be different - and if that’s the case then there’s a change to be made to the shell command. Something I was thinking about to be aware of as I mentioned that older macOS Versions than Ventura could possibly have incompatibility issues with the AppleScript code like it is written.

Greetings from Germany :de:

Tobias

1 Like

Thanks for the heads up, @Ralph.

Using the applenotes:note/ syntax I've cobbled together a macro that can be used to create a text-only and rich link for the selected note. See the macro comment for more information.


Download: Create Apple Note Link.kmmacros (26 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 15.2 (24C5089c) PRE-RELEASE SEED SOFTWARE
  • Keyboard Maestro v11.0.3

3 Likes