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.
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.
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:
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.
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:
Create a new blank note in Apple Notes. Optionally title itDeep Link Scratch.
Below the note title, type >> (and pause your typing). A pop-up menu will appear that is populated with the last few modified notes.
If you see the note of interest in the menu, select it. A link to the note will be inserted.
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.
Select the inserted link, right-click and select Edit Link.
When the Edit Link dialog opens, deselect the Use Note Title checkbox. Click OK.
Reselect the link, right-click it and select Copy Link.
If you open a text editor and select Paste, text like the following will appear:
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...
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:
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.
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.
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.
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.