Ok, I've done the macro for Onetastic plugin by myself.
Procedure:
- Shift + right click on the file
- Choose Copy as Path
- Go to OneNote, Onetastic Link > Add Link (the macro)
- Paste it in the box with Ctrl+V
It will be wonderful if:
- it will become possible to associate a keyboard shortcut to the Onetastic macro
- The author of Onetastic add the "paste from clipboard" function in the programming language
The following is the macro code: Add Macro -> Import -> Paste the code -> Save
<?xml version="1.0" encoding="utf-16"?>
<Macro name="Add link" category="Link" description="" version="5">
<ModifyVar name="strData" op="set" value="file:///" />
<For first="Text">
<That hasProp="selected" op="eq" value="true" />
<IfProp name="hyperlink" op="not" value="">
<ModifyVar name="strData" op="set">
<Prompt type="message" values="">Cannot insert when cursor is next to or in a hyperlink. Add a space and try again.</Prompt>
</ModifyVar>
<Else>
<IfProp name="value" op="eq" value="">
<ModifyVar name="linktext" op="set">
<Prompt type="text" initialValue="" values="">< CTRL+V ></Prompt>
</ModifyVar>
<IfVar name="linktext" op="contains" value=""">
<ModifyVar name="linkn" op="set">
<Function name="String_Length">
<Param name="string" var="linktext" />
</Function>
</ModifyVar>
<ModifyVar name="linkn" op="sub" value="2" />
<ModifyVar name="linktext" op="set">
<Function name="String_Substring">
<Param name="string" var="linktext" />
<Param name="offset" value="1" />
<Param name="count" var="linkn" />
</Function>
</ModifyVar>
</IfVar>
<ModifyVar name="strData" op="add" var="linktext" />
<ModifyProp name="value" op="set" var="strData" />
<ModifyProp name="fontSize" op="set" value="8" />
<ModifyProp name="hyperlink" op="set" var="strData" />
</IfProp>
<IsRootOp />
</Else>
</IfProp>
</For>
</Macro>