Getting the URL of the selected note in Apple Notes

I figured out how to get the built-in Apple Notes URL for the selected note in Hookmark (or in any app that can run Apple Scripts), so I can replace the default Hookmark script, which is a bit cumbersome.

I have a detailed write-up about the script’s inner workings in the Hookmark forums. It can be helpful even if you don’t use Hookmark. You can modify the script to copy the URL to the clipboard.