Hello TW Dev Guru's,
I needed a script to copy tiddler content, add a tag and change the
title in the process and do this for a bunch of tiddlers.
The script listed here below is doing the job but unexpectedly the
source tiddlers also get the tag that should only be in the target
tiddler.
When the tag object is converted to a string the script works as it
should.
Could any Guru tell me if I call a wrong function or something along
the line or make any basic mistake ???
Code ===
<script>
var out = '';
var tids=store.filterTiddlers('[tag[action]]');
out += "Length tids: " + tids.length + '\n' ;
store.suspendNotifications();
for( i = 0 ; i < tids.length ; i++) {
var newTitle = String(tids[i].title).replace(' ','-');
var newTag = tids[i].tags;
// var newTag = 'project'; and some more code to converse the
tag but this is the idea
store.saveTiddler(newTitle, newTitle, tids[i].text,
config.options.txtUserName, tids[i].date, newTag , tids[i].fields);
out += newTitle + '\n';
store.setTiddlerTag(newTitle,true, 'project' );
}
store.resumeNotifications();
store.notifyAll();
return out;
</script>
Remember to share good fortune with your friends, Okido
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywikidev?hl=en.