Hook to OneNote page using URL scheme link on clipboard

I know Microsoft OneNote does not have a scriptable interface to allow a proper Hook, but is there a way to use the OneNote URL scheme links on the clipboard from a “Copy Link to Page” action in OneNote.

These OneNote URL scheme links you can paste in to Safari and it opens the page in the OneNote Mac app. E.g.

So I was thinking that Hook could do something similar.

You can manually copy those URLs then hook them, but as far as I know there’s no way to programmatically get those URLs from OneNote.

1 Like

As @stevelw (thank you, Steve) pointed out OneNote has copy link functions. I see the following:

Pages > Copy Link to Page
Sections > Copy Link to Section
Section Groups > Copy Link to Section Group
Notebooks > Copy Link to Notebook

Does anyone know when those were added. According to our internal issue tracking system, we have had OneNote on our radar since no later than 2018-04-21 (almost a year the publish launch). I don’t recall whether they were there originally. Not that we at CogSci Apps use it internally: lack of automation rules it out (and of course it’s MS).

But we will look at adding UI scripting for it. Which command should be the default? Pages > Copy Link to Page? If we can use it, then we will provide the others as options.

1 Like

They’ve been there for as long as I remember, but only accessible via mouse clicks last time I tried (not got it in front of me) with no standard menu items or AppleScript access. When you get the links and add to Hook manually they work robustly though.

Thanks @stevelw & @LucB for your replies.

If Hook can create a link that would be ideal. But if not and it can create a Hook link from the URL on the clipboard that was added manually to the clipboard that would still be really useful. With the Hook link when opened goes to the page in OneNote Mac app, as Safari does when it opens the URL.

I was not sure if Hook can already create a Hook link from a clipboard URL.

The Copy Link to Page is the most used one for me.

Hookmark can already work that way with OneNote , or any app that can give you the link.

for now, please simply:

  1. copy the link manually.
  2. invoke Hookmark
  3. Focus on Link in Clipboard
  1. Hookmark would not create the link per se, it would retrieve it.
  2. it is not a Hookmark link. Actually their “Pages > Copy Link to Page” yields two entities: like this https://onedrive.live.com/view.aspx?resid=AE6242F572E703A7%21106&id=documents&wd=target%28test.one%7C05919B03-FBAB-7F43-96BA-AF7CF7A08078%2FUntitled%20Page%7C6A04B4E4-45C7-FF46-85EF-055B45A70287%2F%29 onenote:https://d.docs.live.net/dae6242f572e703a7/Documents/Luc's%20Notebook/test.one#section-id={05919B03-FBAB-7F43-96BA-AF7CF7A08078}&page-id={6A04B4E4-45C7-FF46-85EF-055B45A70287}&end . You will notice: a https URL (scheme) and a onenote URL (scheme). They’re not hook:// URLs.

No matter. Hookmark’s OneNote script would parse the clipboard and extract a link from it.

If the user assigns a keyboard shortcut in System Preferences to that OneNote Copy Link to Page (or whatever OneNote link command they like), then Hookmark’s script can presumably issue the keyboard shortcut and take it from there.

We’ll look into it.

Thanks @LucB I’ll try the “Focus on Link in Clipboard” tomorrow. I was not aware of that.

At the moment I have a Keyboard Maestro macro, triggered via Stream Deck button, that takes the OneNote: part of the clipboard link and opens it in Safari then clicks on the “open in OneNote” pop-up that Safari displays. It is not 100% reliable and messy with Safari tabs appearing etc.

1 Like

we should have a version later today or tomorrow uploaded to the Hookmark script server that can be pulled by Hookmark automatically or manually.

1 Like

Hi there, we have added support for OneNote. Please use the Check for App Updates and Update Scripts … function in Hookmark’s gear menu, or in its Hook > Preferences > Update tab.

Hook to New > OneNote cannot be implemented due to Microsoft OneNote limitations.

Users need restart Hookmark for this script to work.

Thanks so much @LucB for doing this, and so quickly. But… :slight_smile: Read until end as not bad.

I updated and Quit Hook. I was then running “Version 4.0 (4988; Integration v. 247)” but I did not have any OneNote script listed. I had Excel, PowerPoint, Outlook and Word listed, along with many others. Trying to Hook while in OneNote displayed the nothing to Hook message.

So I Quit Hook, restarted, updated again, Quit and restarted. It still did not list any OneNote script, but trying to Hook while in OneNote now works. The link you create I can use on my Stream Deck etc to go straight to the appropriate page in OneNote app. :grinning:

If you would expect me to see a OneNote script let me know, or if I have misunderstood what you have done.

One restart of Hookmark should be enough. This one is unlisted. We’ll try to find a way to indicate that. Glad it’s working for you!

1 Like