Is this possible?

41 views
Skip to first unread message

axelm

unread,
Jul 25, 2011, 6:13:00 PM7/25/11
to tiddl...@googlegroups.com
Hello All,

I have 3 tiddlers open (A, B, and C)
Is it possible to add tags to tiddler D with the names of all open tiddlers?
So tiddler D would then have the tags A, B, C

Thank's for any help,

axelm


axelm

unread,
Jul 26, 2011, 2:06:23 PM7/26/11
to tiddl...@googlegroups.com
Could this script be modified to do what I want?

<script label="Add Text Now!">
var t,i,
tids=store.getTaggedTiddlers('UPDATE'),
txt=store.getTiddlerText('NEWTEXT')||'';
if(!confirm("Really add to the contents of:\n"+
tids.map(function(t){return t.title;})))return;
for(i=0;i<tids.length;i++){
t=tids[i];
store.saveTiddler(
t.title,
t.title,
store.getTiddlerText(t.title)+'\n'+txt,
config.options.txtUserName,
new Date(),
t.tags,
t.fields,
t.created
);
};
</script>

Any help is greatly appreciated,

axelm

PMario

unread,
Jul 26, 2011, 4:38:10 PM7/26/11
to TiddlyWiki
Do you know TiddlerTweakerPlugin [1]?
It can be used as a browser bookmarklet [2]. So you don't need to
include it into your production TW. Just load on demand.

Adding or removing tags is quite easy
eg:
tagfield is empty .. remove all tags from marked tiddlers
tagfield = +newTag .. will add the tag "newTag" to tiddlers
tagfield = -newTag .. will remove the tag "newTag" from existing
tiddlers

IMPORTANT:
I highly recomend to create a backup prior to messing around with this
tool :)

-m

[1] http://www.tiddlytools.com/#TiddlerTweakerPlugin
[2] http://www.tiddlytools.com/#InstantBookmarklets

axelm

unread,
Jul 26, 2011, 4:58:51 PM7/26/11
to tiddl...@googlegroups.com
Yes, I have that plugin, but it won't do what I need:

I have 3 tiddlers open named: "A" "B" and "C"
I need to add the names of the open tiddlers to tiddler "D" as tags.
So tiddler "D" would then have the tags A, B, C  added to it's tag list.

TiddlerTweakerPlugin can't do that.

axelm

Måns

unread,
Jul 26, 2011, 5:13:43 PM7/26/11
to TiddlyWiki
Hi Axelm

> I have 3 tiddlers open (A, B, and C)
> Is it possible to add tags to tiddler D with the names of all open tiddlers?
> So tiddler D would then have the tags A, B, C

In two steps:
1) Save story to a tiddler with http://www.tiddlytools.com/#StorySaverPlugin
2) Save tiddlerlist (storytiddler) as the collected tiddlertitles as
tags to a tiddler with:

<script label="script(B)" title="Tag tiddlers from a list with
doublebracketed listitems">
var tid=prompt("title of the tiddler with the list");
if (!tid) return; /* cancelled by user */
var txt=store.getTiddlerText(tid);
if (!txt) { alert(tid+" not found"); return; }
var titles=txt.readBracketedList();
for (var i=0; i<titles.length; i++) store.setTiddlerTag(titles
[i],true,'TagName');
</script>

http://groups.google.com/group/tiddlywiki/browse_thread/thread/a8922becd1f29938#

Cheers Måns Mårtensson

axelm

unread,
Jul 26, 2011, 5:41:36 PM7/26/11
to tiddl...@googlegroups.com
Hello Måns,

this is probably what I need. Except it doesn't want to work.
It asks me for the name of the tiddler with the links from the StorySaver in it, and then it does nothing!
How do I tell it which tiddler it should add the tags, to?

help,

axelm


PMario

unread,
Jul 26, 2011, 7:23:39 PM7/26/11
to TiddlyWiki

axelm

unread,
Jul 26, 2011, 7:38:30 PM7/26/11
to tiddl...@googlegroups.com
Thank you so much, PMario

That works great!!!

That will save me so much work.

axelm


Måns

unread,
Jul 26, 2011, 8:30:22 PM7/26/11
to TiddlyWiki
Hi axelm

> How do I tell it which tiddler it should add the tags, to?

The script should be run in the tiddler which is to be tagged - just
like Mario's script - except my example needs InlineJavascriptPlugin
(sorry forgot to say...) - get it here: http://www.tiddlytools.com/#InlineJavascriptPlugin.
Eric has also made http://www.tiddlytools.com/#AutoTaggerPlugin:
"If you enter auto as a tiddler tag value, AutoTagger scans the
tiddler content (including title) for text that matches any existing
tags, and automatically adds any embedded tags that it finds."
and
"You can also create a tiddler that defines a set of AutoTaggerAliases
to replace a single tag with one or more alternative tags."

@PMario
Nice work :-) Thumbs up!!

Cheers Måns Mårtensson

rakugo

unread,
Jul 27, 2011, 2:06:04 AM7/27/11
to TiddlyWiki
> I have 3 tiddlers open (A, B, and C)
> Is it possible to add tags to tiddler D with the names of all open tiddlers?
> So tiddler D would then have the tags A, B, C

Glad you have solved your problem. However I would love to know the
context of this problem.... and what this solves. Very curious!

PMario

unread,
Jul 27, 2011, 3:45:09 AM7/27/11
to TiddlyWiki
Hi,

I created a toolbar command [1], so you don't need
InlineJavascriptPlugin to use it. Also implementation should be easier
now, since you don't need to mess around with the view template.

To speed things up, the confirmation dialog can be disabled with a
cookie. (Be carefull with this. Read the documentation :)

It should be easier now to translate. ...

have fun!
mario

[1] http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#TagWithStoryCommand

axelm

unread,
Jul 27, 2011, 9:27:49 AM7/27/11
to tiddl...@googlegroups.com
Thank you PMario, that is so awesome.

rakugo, here is the scenario:

Lets say I have 10 tiddlers of companies (1 tiddler each).
These companies are all in the medical research industry.
Each of these tiddlers is tagged "Research".
Each of these tiddlers has the "<<tagged>>" macro on the top, from their template.
This shows all the tiddlers that are tagged with the companies name as a tag.
So now you find a company that supplies stuff to these "Research" companies. I make a new tiddler for this "Supplier".
I want it to show up on each "Research" company's menu of "tagged".
So now, all I have to do is open all tiddlers tagged "Research" (with the "OpenTaggedTiddlers" macro) and add their
titles (the name) to the suppliers tiddler as tags (thanks to PMario), and now the supplier tiddler shows up on all the "Research" companies.
Or I may find an article on the Internet that relates to all the "Research" companies.
I use TiddlySnip to make a new tiddler. Again, I want that tiddler to show on each "Research" companies tiddler, same procedure.

Does that make sense?

axelm

rakugo

unread,
Jul 28, 2011, 7:21:07 AM7/28/11
to TiddlyWiki
Sort of! Thanks for sharing. As I understand you use the current state
of the TiddlyWiki story as a way of grouping tiddlers and running
batch operations (ie. tagging the multiple tiddlers that are open
rather than manually changing each single tiddler).

Always interesting to hear of the different ways people use
TiddlyWiki. :)

axelm

unread,
Jul 28, 2011, 11:00:06 AM7/28/11
to tiddl...@googlegroups.com
I guess it would be nicer (and save one step) to use ForEachTiddler, but I wouldn't know how to do that, since it is reversed.
FET could find all the tiddlers tagged "Research" and would have to store all their titles and then add those as tags to the tiddler that contains the FET code.

Hmmm,

axelm


Reply all
Reply to author
Forward
0 new messages