I’ trying for too long now to create a simple generic button to create a new tiddler passing simple parameters (button label tiddler title and tiddler template)
I have it to work quite efficiently but if I try to pass the template param cotaining a system path ($:/my-template) it fails.
Any advice to help? I post the tiddlers to understand the problem.
Generc Button macro.json (674,5 Ko)
The best solution is to use \procedure instead of \define. Then, you can refer to the param values using <<label>>, <<template>>, and <<buttonName>>, like this:
\procedure AB(label:"Click me", template:"templatetest", buttonName:"button")
\define actions()
<$action-sendmessage $message="tm-new-tiddler" $param=<<template>> title=<<buttonName>>/>
\end actions
<$button actions=<<actions>>><<label>></$button>
\end
Alternatively, if you want to continue to use OLD deprecated \define AB(...) syntax, then enclose the param references in quotes so they are passed “as-is” to the tm-new-tiddler message handler. Like this:
<$action-sendmessage $message="tm-new-tiddler" $param="$template$" title="$buttonName$"/>
-e