Hi c pa

Thank you very much - however I can't see how your code will let me create 
a new tiddler title every time I click the testButton?

>1) Silently create tiddlers with new titles based on the first (current) 
tiddler's title (not a clone)
>2) Silently create multiple clones of the current tiddler with new titles 
based on the first (current) tiddler's title.

I'm aware of (some of) the capabilities of the action-setfield widget > I 
do not know how to make it create a new title eg: [[MyNewTiddler 1]] if 
[[MyNewTiddler]] already exists.

This happens automagically with the clone tiddler button - it uses a 
tm-newtidder widget message, not the action-setfield widget....
Is there some (hidden magic) scripting in the tm-newtiddler widget that 
can't be used with the action-setfield widget?

See $:/core/ui/Buttons/clone 
<http://tiddlywiki.com/#%24%3A%2Fcore%2Fui%2FButtons%2Fclone> 

Cheers Måns Mårtensson

Den tirsdag den 5. maj 2015 kl. 18.56.56 UTC+2 skrev c pa:
>
> This works:
>
> \define setfield(tiddlerName,templateName,fieldName)
>     <$set name="fieldValue" value={{$templateName$!!$fieldName$}} >
>         <$action-setfield $tiddler="$tiddlerName$" $field="$fieldName$" 
> $value=<<fieldValue>> />
>     </$set>
> \end
> \define createSilentTarget(tiddlerName,templateName,buttonName)
>     <!-- This macro displays a button that clones a template
>            All fields and content are copied from the template silently
>     -->
>    <$button> $buttonName$
>         <$action-setfield $tiddler="$tiddlerName$" $field="title" 
> $value="$tiddlerName$" />
>         <$list filter="[[$templateName$]fields[]] -created -modified 
> -title" >
>             <<currentTiddler>><br/>
>             <$macrocall $name="setfield" 
>                 tiddlerName="$tiddlerName$" 
>                 templateName="$templateName$" 
>                 fieldName=<<currentTiddler>> 
>             />
>         </$list>
>     </$button>
> \end
>
> <$macrocall $name="createSilentTarget" 
>     tiddlerName="MyNewTiddler" 
>     templateName="testTemplate" 
>     buttonName="testButton" />
> [[MyNewTiddler]]
>
>

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/5662444d-13d6-4479-871c-b0ab62e635a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to