Hi Stefano. BatchManipulator was created for batch ops like this.
\define add-new-tag-bulk(newTag)
<$list filter={{$:/temp/commander}}>
<$fieldmangler>
<$action-sendmessage $message="tm-add-tag" $param=<<__newTag__>> />
</$fieldmangler>
</$list>
\end
Not completely sure how it works yet, but working on it...
Cheers,
S.
Stefano,TW-Commander worth a try as well: https://github.com/kookma/TW-Commander
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/360fac05-f3c4-4151-8af8-077841eb77a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
\define add-new-tag-bulk(filter, newTags)<$list filter="$filter$" ><$list filter="[enlist<__newTags__>]" variable="itemTag"><$fieldmangler><$action-sendmessage $message="tm-add-tag" $param=<<itemTag>> /></$fieldmangler></$list></$list>\end
<$button> do<$macrocall $name="add-new-tag-bulk"filter="[tag[About]]"newTags="bb cc dd [[mytag with space]]"
/></$button>To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/CAJODLwYMtK3xGz9AUMQb7X-MvWFX6Rjr8r4MjfZnmgELHoeXwQ%40mail.gmail.com.
As an explanation of what is going on (node the added button, this doesn't do anything with the button):
<$button>
Add tags
<$list filter=<<SomeFilterHere>>> <$fieldmangler> <$action-sendmessage $message="tm-add-tag" $param=<<__newTag__>> /> </$fieldmangler> </$list>
</$button>
The list widget makes a list, one way to think about it is as iterating over a loop, but if you are familiar with some programming it is more accurately list comprehension similar to python (I think also erlang and haskell, it has been a while. Many other languages probably use the same concept).
So a possibly way too detailed description of the list widget:
The filter creates a list of titles
The template between the opening and closing tags for the $list widget is applied to each title returned by the filter
The results are output in the same order as the titles in the list
The $fieldmangler widget is magic, it is mostly left over from a previous version of how we thought tiddlywiki was going to work. Mostly it lets you add tags without overwriting the tags field. This is the only time when it is required or that there isn't a simpler way to do it. The magic is that it lets you edit fields, but that was before the action widgets became the main tool for changing tiddlers so it is less useful now.
The $action-sendmessage widget is a way that the older message-based changes to the wiki are used with the newer action widgets. It was a more conceptually complex system, I suggest that you just accept the magic for now and come back to that part later. Just treat the combination of $fieldmangler and $action-setfield widgets in this context like an action widget that lets you add a tag to a tiddler.
Then, if you wrap that whole thing in a button, the result is a button that activates a list of action widgets, each action widget adds a tag to one tiddler.
Hopefully that is understandable and not too rambling.
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/9bcadc92-45fe-453f-87fc-ba7eb903c378%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.