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/09956e8c-d8f4-46ec-864d-6126e6727b96n%40googlegroups.com.

Reply via email to