Creating a new tiddler with multiple tags from a button

84 views
Skip to first unread message

Christian Macedo

unread,
Aug 15, 2019, 6:24:28 AM8/15/19
to TiddlyWiki
I'm attempting to create a new tiddler with the button below:

<$button class=<<tv-config-toolbar-class>> tooltip="New Journal Entry">{{$:/core/images/file}}

<$action-sendmessage $message="tm-new-tiddler" tags=" [[JournalEntry]] <<now 0DD.0MM.YYYY>> " />

</$button> 

The first tag is created without any incident. However, the second tag doesn't It gets passed as a literal string, pehaps obviously, ending up with the unwanted tags:

  • "<< now" and
  • "0DD.0MM.YYYY>>"
How can I pass todays date in the format <<now 0DD.0MM.YYY>>?

BurningTreeC

unread,
Aug 15, 2019, 9:12:28 AM8/15/19
to TiddlyWiki
Hi Christian,

maybe something like the following does the trick?

\define actions()
<$action-sendmessage $message="tm-new-tiddler" tags=" [[JournalEntry]] [[$(currentDateTime)$]] " />
\end


<$button class=<<tv-config-toolbar-class>> tooltip="New Journal Entry">{{$:/core/images/file}}
<$set name="currentDateTime" value=<<now "0DD. 0MM. YYYY">>>
<<actions>>
</$set>
</
$button>


Christian Macedo

unread,
Aug 15, 2019, 9:24:00 AM8/15/19
to TiddlyWiki
That did it! 

Thank you so much. And now I have a nice example of how to properly use set for a button which I'll need a lot. 

Thanks again!

TonyM

unread,
Aug 15, 2019, 11:14:23 PM8/15/19
to TiddlyWiki
This is a valuable lesson in the fact you should not expect the contents of a parameter to be evaluated in the same step as calling a widget. There are a few parameters that do by design such as text= in the wikify widget but these are the exception.

Use set or macro defines outside the widget to prepare the parameter for your widgets.

I wish someone told me this when I was first learning.

Tony

Reply all
Reply to author
Forward
0 new messages