If you wikify (render) the contents before stashing in the tiddler, you'll prevent the recursion. In the following I'm using "HelloThere" from TiddlyWiki.com
\define addtimestamp(tiddler) <$set name="curtext" tiddler=$tiddler$ > <$set name="ts" value=<<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>> > <<ts>> <<curtext>> </$set> </$set> \end <$button>test <$wikify name=out text=<<addtimestamp HelloThere>> > <$action-setfield $tiddler="HelloThere" text=<<out>>/> </$wikify> </$button> On Friday, January 8, 2021 at 5:25:27 AM UTC-8 Petri M. wrote: > Oh apparently my <<addtimestamp test2>> tries to put the *entire > contents *of the addtimestamp macro into the test2 tiddler. I think this > is why it breaks. Can I not use <$set ...> </$set> within a macro? Or > what is going on here? > > This works fine if I use > > \define concat(a b) > $a$ $b$ > \def > > <$set name="curtext" tiddler="test2" > > > <$set name="ts" value=<<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>> > > <$button> > <$action-setfield $tiddler="test2" text=<<concat $(curtext)$ $(ts)$>> /> > test > </$button> > </$set> > </$set> > > It just looks ugly. > > -Petri > > On Friday, January 8, 2021 at 11:49:11 AM UTC+2 Petri M. wrote: > >> I have a todo list and I would like to automatically add a timestamp to >> each tiddler's title so that each todo-tiddler has a unique title. I have a >> button that uses a state tiddler's body as the title of the new >> todo-toddler. So I was thinking that I would just have a macro that has two >> variables, the state tiddler's body and my timestamp and then just put them >> together and replace the body of the state tiddler. >> >> As a test I made a tiddler test1 with this macro to try: >> >> \define addtimestamp(tiddler) >> <$set name="curtext" tiddler=$tiddler$ > >> <$set name="ts" value=<<now [UTC]YYYY0MM0DD0hh0mm0ssXXX>> > >> <<ts>> <<curtext>> >> </$set> >> </$set> >> \end >> >> And using <<addtimestamp test2>> works fine, the macro seems to give me >> a text with the timestamp and whatever I have in tiddler test2. >> >> And then I tried to trigger it with a button so that it would put that >> text back into the tiddler test2. >> >> <$button> >> <$action-setfield $tiddler="test2" text=<<addtimestamp test2>>/> >> test >> </$button> >> >> And everything crashes. I can see that there's a billion timestamps in >> test2 but I have no idea why that is! Can someone shine some light on >> this? >> >> Thanks, >> Petri M. >> > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/60c7b262-d38a-459d-a760-953ec4347970n%40googlegroups.com.

