According to the manual, Hyperlink “represents a hyperlink that jumps to the specified URI when clicked”. OneNote produces hyperlinks that begin with onenote://. In Mathematica, creating a hyperlink to a OneNote page does not work. It returns a message: “The file that you tried to open was not found…”
According to the manual again, “non-file URI open in a web browser”. When I paste the onenote URI in my web browser, it opens the target.
1) Can you confirm this bug in Mathematica?
2) Does anyone know of a workaround?
Steps:
1) In OneNote right click on a page label and select Copy Link to Page. The clipboard contains something like:
onenote:///XXXX#Compound%20expressions,%20Get%20and%20Goto&page-id={7D74D7D4- E640-4217-9575-877E08975BED}&end
2) Create a text cell, put some text, select and press Ctrl+Shift+H
. Paste the OneNote hyperlink.
3) Click in the hyperlink.
Update
Following this answer, running
Hyperlink["test", MathLink`CallFrontEnd[ FrontEnd`SystemOpen[
"onenote:///\\\\myComputer\\The%20Notebook&page-id={7D74D7D4E640-4217-9575-877E08975BED}&end"]]]
creates a hyperlink that jumps correctly when it is created. If one clicks on the hyperlink, then nothing happens. On the other hand, running
Button["test", MathLink`CallFrontEnd[ FrontEnd`SystemOpen[
"onenote:///\\\\myComputer\\The%20Notebook&page-id={7D74D7D4E640-4217-9575-877E08975BED}&end"]]]
creates a button with that works correctly.
I will report this as a bug to Wolfram (in the no so near future).
My workaround
For the sake of …, I'll post this workaround. It produces a hyperlink-looking button.
Button[Style["test","Hyperlink"], MathLink`CallFrontEnd[ FrontEnd`SystemOpen[
"onenote:///\\\\myComputer\\The%20Notebook&page-id={7D74D7D4E640-4217-9575-877E08975BED}&end"]]
, Appearance -> None]
skype:
URIs on Mac. I assume you're using Windows, and the workaround (Run["open URI"]
) I used on Mac won't work the same way there. Try this:Run["start \"\" \"URI\""]
where you substitute the correct URI, and let me know if it worked. $\endgroup$SystemOpen["URI"]
, but ifHyperlink
didn't work,SystemOpen
isn't likely to work either. $\endgroup$MathLink`CallFrontEnd[FrontEnd`SystemOpen["URI"]]
. It turns out thatSystem`SystemOpen[target]
auto-prepends"file://"
totarget
, which destroys the custom URI. So please try this as well, and see if it works on Windows. $\endgroup$