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/d2b0d7bd-acbf-47fb-94cd-935e2ad08f25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to