open multiple tiddlers macro

668 views
Skip to first unread message

than

unread,
Jan 11, 2010, 4:51:28 PM1/11/10
to TiddlyWiki
hi there

I want to open multiple tiddlers from a single link
had a good look around

Ive got this working:
<<tiddler {{
var tidlist="[[Wish List]] Contact GettingStarted";
story.displayTiddlers(null,tidlist.readBracketedList());
"";}}>>

but i want several links in a tiddler which each map to many tiddlers,
not a tiddler that automatically opens with others.

no joy from this business:

<<tiddler OpenTaggedTiddlers with: "click me..." sample title reverse
"" 3>>

and have the sense that it may be contingent on the MatchTagsPlugin?
but cannot import anything due to this being the only response from
the import function:
"Error getting list of tiddlers, click Cancel to try again" (never
known this work... what am i missing?)
and not getting on well importing manually.

can anyone step me through it like a non -programmer?
cheers
nathaniel

Mike

unread,
Jan 11, 2010, 6:11:40 PM1/11/10
to TiddlyWiki
This is an older way to do this . . . (I need to update to the tiddler
method, should be a pretty easy modification)

In a tiddler (example)

!!![[Choose a Realm|Apps]]
<html><a href="javascript:void(0)"onclick="story.closeAllTiddlers
();story.displayTiddlers(null,store.getTiddlerText
('Realm##Home').readBracketedList())">Home</a></html>
<html><a href="javascript:void(0)"onclick="story.closeAllTiddlers
();story.displayTiddlers(null,store.getTiddlerText
('Realm##Work').readBracketedList())">Work</a></html>
<html><a href="javascript:void(0)"onclick="story.closeAllTiddlers
();story.displayTiddlers(null,store.getTiddlerText
('Realm##Troubleshoot').readBracketedList())">Troubleshoot</a></html>
<html><a href="javascript:;" onclick="story.closeAllTiddlers();restart
();" title="Restart Display">Default</a></html>/%
!!!Home
[[Home]] [[Projects]] [[TwStart]]
!!!Work
[[Work]] [[Projects]] [[TwStart]]
!!!Troubleshoot
[[PluginManager]] [[systemConfig]] [[SideBarTabs]] [[SideBarOptions]]
!!!end
%/

hope that helps,

Mike

Mike

unread,
Jan 11, 2010, 10:44:10 PM1/11/10
to TiddlyWiki
FYI, beware the google group wrapping . . .
<html> .. .. .. </html> should be one line each

Hopefully this is what you are looking for, I did play with the
tiddler method no luck just yet

Mike

Mark S.

unread,
Jan 11, 2010, 11:58:03 PM1/11/10
to TiddlyWiki

I'm assuming that you're trying to download from tiddlytools.com?

It could be you have a slow connection. Try opening the main page at
tt and then saving the source to a file. Then try importing from that
downloaded file.

If all else fails, you can find the tiddlers you wish to import from
tt, and copy them, their titles, and tags by hand into new tiddlers in
your TiddlyWiki. For most plugins, you will need to save your TW and
reload.

Mark

Morris Gray

unread,
Jan 12, 2010, 2:48:22 AM1/12/10
to TiddlyWiki
Try this script (requires InlineJavascriptPlugin)

Put in in a tiddler named 'OpenTiddlersByTag'
-------------------------------------------
<<tiddler OpenTiddlersByTag##script with: yourtag>>
/%
!script
<script label="OpenTiddlerByTheTag">
var msg=store.getTaggedTiddlers('$1');
var list=msg;
story.closeAllTiddlers();
story.displayTiddlers(msg,list);
</script>
!end
%/
----------------------------------------------

This closes all other tiddlers first.

If you delete story.closeAllTiddlers(); it opens your tiddlers in
addition to what is already open.

Morris

PMario

unread,
Jan 12, 2010, 11:04:24 AM1/12/10
to TiddlyWiki
hi nathaniel,

I am not really shure what you exactly need. But here is a try.

Assumed that you have.
==
A tiddler "MyStory1" tagged "story" containing text:
tiddler1 tiddler2

tiddler "MyStory2" tagged "story" contains:
tiddler3 tiddler4

tiddler "MyStory3" tagged "story" contains:
tiddler5 [[tiddler with spaces]]
==

On Jan 11, 10:51 pm, than <nathanielsl...@hotmail.com> wrote:
> hi there
>
> I want to open multiple tiddlers from a single link

if you want a list of the story tiddlers use the core list macro:
<<list filter [tag[story]]>>

result:
* MyStory1
* MyStory2
* MyStory3
=====================

If you want, that a click on "MyStory1" opens tiddler1 and tiddler2
you can use "StorySaverPlugin"[1] at TiddlyTools which has a
<<openStory...>> macro.

use: <<openStory list story>>

"manually importing tiddlers see at the end of the post:)"
=====================


If you want to have a list like this: (2 possibilities)
*MyStory1
*tiddler1
*tiddler2
*MyStory2
*tiddler....

1) Use Monkey Pirate TiddlyWiki [3] and Tagglytagging
which can display a sitemap. Open the "story" tiddler see the footer

"-Tagged as 'story': title↑ modified created group excerpts cols±"
click on _group_ until it says _sitemap_. It should look like the
above example


2) you can use "RelatedTiddlersPlugin" [2] at tiddlytools: see this
[4] TiddlyWiki descussion and refere to Eric's comment.
I think it may be similar to what you may want.
=====================


> <<tiddler OpenTaggedTiddlers with: "click me..." sample title reverse
> "" 3>>

As far as I have seen OpenTaggedTiddlersMacro works like this:
<<openAll [[tag]] ["title:..."] [closeAllFirst]>>
<<openAll story "title:Open tiddlers tagged stroy">>

It will open: MyStory1, MyStory2 ...

If you tag: tiddler1, tiddler2 with "MyStory1" it can work like this
<<openAll MyStory1 "title:Open tiddlers tagged MyStory1">>
=====================


> and have the sense that it may be contingent on the MatchTagsPlugin?
> but cannot import anything due to this being the only response from
> the import function:
> "Error getting list of tiddlers, click Cancel to try again" (never

> can anyone step me through it like a non -programmer?
> cheers
> nathaniel

Manual Plugin Import
=====================
eg: StorySaverPlugin from TiddlyTools
1) Klick link [1]
2) Edit the macro (doubble klick)
3) Select all
4) Copy to Clipboard

5) Open a new tiddler in _your_ local TiddlyWiki file
6) Delete the default content
7) Copy from Clipboard to "new tiddler"
8) Renmame to StorySaverPlugin

IMPORTANT
9) tag the tiddler with "systemConfig"
10 save -- no reload yet!!

since StorySaverPlugin needs MarkupPostBody
11) open MarkupPostBody [5]
12) do steps 2 to 7
13) rename to MarkupPostBody
IMPORTANT
Do _not_ tag it

14) Save and Reload. now
=====================


regards Mario
[1] http://www.tiddlytools.com/#StorySaverPluginInfo
[2] http://www.tiddlytools.com/#RelatedTiddlersPlugin
[3] http://mptw.tiddlyspot.com/#[[1.%20What%20is%20TagglyTagging%3F]]
[4] http://tinyurl.com/yag8yp9
[5] http://www.tiddlytools.com/#MarkupPostBody

PMario

unread,
Jan 12, 2010, 11:08:00 AM1/12/10
to TiddlyWiki

Morris Gray

unread,
Jan 13, 2010, 9:51:30 AM1/13/10
to TiddlyWiki
Just wondering, after several offerings, if nathaniel has received
what he was after. The request sounded interesting and the answer
might be of use to us all.

Morris

Scalpa

unread,
Feb 11, 2010, 3:28:04 PM2/11/10
to TiddlyWiki
Hi everybody

I’ve been trying to open multiple tiddlers as well and following
closely the hints here (being a newbie). But I can’t get TiddlyWiki to
do what I really want: open a dynamically generated list of tiddlers,
typically gotten from a field = value request.

What I can do, using the OpenStory macro or story.display directly
is :
1) open the tiddlers listed in another tiddler, so a static call ;
2) open all tiddlers with a given tag ;
3) generate a list of tiddlers with prescribed values for given
field(s), using ForEachTiddler.

But I can’t mix the two. If I try OpenStory on the tiddler generated
by ForEachTiddler, I get no answer at all. On the other hand
story.display shows a list of tiddlers based on the *source* text of
my dynamic tiddler  :-(

Any idea  ?

On Jan 13, 3:51 pm, Morris Gray <msg...@symbex.net.au> wrote:
> Just wondering, after several offerings, if nathaniel has received
> what he was after.  The request sounded interesting and the answer
> might be of use to us all.
>
> Morris
>
> On Jan 13, 3:08 am, PMario <pmari...@gmail.com> wrote:
>
> > hi, it should be
> > [1]http://www.tiddlytools.com/#StorySaverPlugin
>
> > -m
>
> > On Jan 12, 5:04 pm, PMario <pmari...@gmail.com> wrote:
>
> > > hi nathaniel,
>
> > > I am not really shure what you exactly need. But here is a try.
>
> > > Assumed that you have.
> > > ==
> > > A tiddler "MyStory1" tagged "story" containing text:
> > >    tiddler1 tiddler2
>
> > > tiddler "MyStory2" tagged "story" contains:
> > >    tiddler3 tiddler4
>
> > > tiddler "MyStory3" tagged "story" contains:
> > >    tiddler5 [[tiddler with spaces]]
> > > ==
>
> > > On Jan 11, 10:51 pm, than <nathanielsl...@hotmail.com> wrote:
>
> > > > hi there
>

> > > > I want toopenmultipletiddlersfrom a single link
>
> > > if you want a list of the storytiddlersuse the core list macro:


> > > <<list filter [tag[story]]>>
>
> > > result:
> > > * MyStory1
> > > * MyStory2
> > > * MyStory3
> > > =====================
>
> > > If you want, that a click on "MyStory1" opens tiddler1 and tiddler2
> > > you can use "StorySaverPlugin"[1] at TiddlyTools which has a
> > > <<openStory...>> macro.
>
> > > use: <<openStory list story>>
>

> > > "manually importingtiddlerssee at the end of the post:)"


> > > =====================
>
> > > If you want to have a list like this: (2 possibilities)
> > > *MyStory1
> > >    *tiddler1
> > >    *tiddler2
> > > *MyStory2
> > >    *tiddler....
>
> > > 1) Use Monkey Pirate TiddlyWiki [3] and Tagglytagging

> > > which can display a sitemap.Openthe "story" tiddler see the footer


>
> > > "-Tagged as 'story': title↑ modified created group excerpts cols±"
> > > click on _group_ until it says _sitemap_. It should look like the
> > > above example
>
> > > 2) you can use "RelatedTiddlersPlugin" [2] at tiddlytools: see this
> > > [4] TiddlyWiki descussion and refere to Eric's comment.
> > > I think it may be similar to what you may want.
> > > =====================
>
> > > > <<tiddler OpenTaggedTiddlers with: "click me..." sample title reverse
> > > > "" 3>>
>
> > > As far as I have seen OpenTaggedTiddlersMacro works like this:
> > > <<openAll [[tag]] ["title:..."] [closeAllFirst]>>
> > > <<openAll story "title:Opentiddlerstagged stroy">>
>

> > > It willopen: MyStory1, MyStory2 ...


>
> > > If you tag: tiddler1, tiddler2 with "MyStory1" it can work like this

> > > <<openAll MyStory1 "title:Opentiddlerstagged MyStory1">>


> > > =====================
>
> > > > and have the sense that it may be contingent on the MatchTagsPlugin?
> > > > but cannot import anything due to this being the only response from
> > > > the import function:

> > > > "Error getting list oftiddlers, click Cancel to try again" (never


> > > > can anyone step me through it like a non -programmer?
> > > > cheers
> > > > nathaniel
>
> > > Manual Plugin Import
> > > =====================
> > > eg: StorySaverPlugin from TiddlyTools
> > > 1) Klick link [1]
> > > 2) Edit the macro (doubble klick)
> > > 3) Select all
> > > 4) Copy to Clipboard
>

> > > 5)Opena new tiddler in _your_ local TiddlyWiki file


> > > 6) Delete the default content
> > > 7) Copy from Clipboard to "new tiddler"
> > > 8) Renmame to StorySaverPlugin
>
> > > IMPORTANT
> > > 9) tag the tiddler with "systemConfig"
> > > 10 save -- no reload yet!!
>
> > > since StorySaverPlugin needs MarkupPostBody

> > > 11)openMarkupPostBody [5]

PMario

unread,
Feb 11, 2010, 4:46:30 PM2/11/10
to TiddlyWiki
Hi,
There is a very interesting function in the core
"displayDefaultTiddlers" which has a simple code. I putted it into a
script for testing.
It can work with a tiddler YourList containing
[tag[story]]
[[one]]
[[two]]

<script>

story.displayTiddlers(null,store.filterTiddlers(store.getTiddlerText("YourList")));
</script>

It will open anything taggde "story" and the tiddlers "one" and "two"

With http://www.tiddlytools.com/#MatchTagsPlugin it should be possibel
to have:
[tag[sample OR (settings AND systemConfig)]]
inside YourList, because it extends the core list function which is
called in the above script. I didn't test this.


hope this helps.
If you specify your filter tags, value ..., maybe we can help a little
bit better.

regards Mario

Eric Shulman

unread,
Feb 13, 2010, 6:30:26 AM2/13/10
to TiddlyWiki
> I’ve been trying to open multiple tiddlers as well and following
> closely the hints here (being a newbie). But I can’t get TiddlyWiki to
> do what I really want: open a dynamically generated list of tiddlers,
> typically gotten from a field = value request.
>
> What I can do, using the OpenStory macro or story.display directly
> is :
> 1) open the tiddlers listed in another tiddler, so a static call ;
> 2) open all tiddlers with a given tag ;
> 3) generate a list of tiddlers with prescribed values for given
> field(s), using ForEachTiddler.
>
> But I can’t mix the two. If I try OpenStory on the tiddler generated
> by ForEachTiddler, I get no answer at all. On the other hand
> story.display shows a list of tiddlers based on the *source* text of
> my dynamic tiddler  :-(


<<forEachTiddler>> dynamically generates and shows content. However,
the output from <<forEachTiddler>> isn't actually stored as data
anywhere. It is simply rendered into the story column when the
tiddler is displayed. Thus, it is not available for use by
<<openStory>> [1] which needs *data* contained in the source text of a
stored tiddler.

Fortunately, what you are trying to do is actually very
straightforward to write as direct, inline javascript code [2] to
perform the entire process using standard TW core functions,
store.forEachTiddler(...), store.getValue(...), and
store.displayTiddlers(...)

<script>
var titles=[];
store.forEachTiddler(function(title,tiddler){
var val=store.getValue(title,'fieldname');
if (val==undefined) return; // no field... ignore this tiddler
titles.pushUnique(val);
});
store.displayTiddlers(null,titles);
</script>

note: the above code assumes that for any given tiddler, the
'fieldname' in question contains a single tiddler title to be used.
However, if we were to suppose that the field contains a space-
separated *list* of tiddler titles to be used, then instead of simply:
titles.push(val);
you could write something like:
val.readBracketedList().map(function(title)
{titles.pushUnique(title);});

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
refs:
[1] http://www.TiddlyTools.com/#StorySaverPlugin
[2] http://www.TiddlyTools.com/#InlineJavascriptPlugin

Scalpa

unread,
Feb 13, 2010, 2:15:35 PM2/13/10
to TiddlyWiki
Mario, Eric,
Thanks for the quick reply, you gave me hope.
Eric's answer seems closer to what I need, since I want to sort by
field value not by tag. Typically I have a field named 'time' with
possible value say 'early', 'late','never' and I want all tiddlers
where time==late.
However I cannot make the above script to work ! I get the following
message

TypeError: store.displayTiddlers is not a function

The script seems right though ...
(I have installed the InlineJavascriptPlugin and checked that it is
present).

Scalpa

(PS : I got disconnected from Google Groups when I first posted this,
so I assumed it didn't go through; if it did I'm sorry for the double
post ; erase at will)

Eric Shulman

unread,
Feb 13, 2010, 2:31:26 PM2/13/10
to TiddlyWiki
> However I cannot make the above script to work ! I get the following
> message
> TypeError: store.displayTiddlers is not a function

oops... typo! that should be story.displayTiddlers(...) not
store.displayTiddlers(...)

The "store" functions are related to saving/retrieving/searching
tiddler data.
The "story" functions are related to rendering/displaying content.

sorry for the confusion...

-e

Scalpa

unread,
Feb 15, 2010, 4:45:22 AM2/15/10
to TiddlyWiki
Thanks Eric,

It looks obvious once you see it !
I managed to make it work, piecing it together with Morris Gray's
syntax (see below). However your script assumes the field contains as
values tiddler names, which my script does not. I just want to filter
by field value, eg whenever field 'time' == value 'now' display the
tiddlers. I added a condition, but don't see how to add to the
'titles' list the tiddler title instead of 'val'. (The truth being I
don't know JS ;-) Any help ?

Scalpa

<<tiddler MyOpenTiddlers##script>>
/%
!script
<script label="MyOpenTiddlers">
var titles=[];
store.forEachTiddler(function(title,tiddler){
var val=store.getValue(title,'time');
if (val==undefined) return;
if (val=='now') titles.pushUnique(val);
});
story.displayTiddlers(null,titles);
</script>
!end
%/

and here's a forEachTiddler loop that lists what I want, but inside a
tiddler instead of opening all the relevant tiddlers.

<<forEachTiddler
where
' store.getValue(tiddler,"time") == "now" '
write '"[["+tiddler.title+"]] "'>>

Scalpa

unread,
Feb 24, 2010, 4:40:50 PM2/24/10
to TiddlyWiki
Hi everybody

After tinkering with the source code of StorySaverPlugin, I've found
the answer to my own query (and maybe others'). I post it here for
whomever wants it. It uses inlineJavascriptPlugin and is certainly not
optimized ;-)
What it does: checks for a certain field==value among all tiddlers,
lists all positives in a given Tiddler tid (in my example it is called
'CurrentTiddlers'), closes all tiddlers and then opens the ones listed
in CurrentTiddler.

<<tiddler WriteTiddlersWith##script>>
/%
!script
//
<script label="WriteTiddlersWith">
var tid='CurrentTiddlers';
var fieldname='yourfield'; // put in what you want
var fieldvalue='yourvalue'; // same thing
var tidlist=[];
// gets in tidlist all tiddlers satisfying a given condition
store.forEachTiddler(function(title,tiddler){
// var t=store.getTiddler(title);
var val=store.getValue(title,fieldname);
if (val==undefined) return;
if (val==fieldvalue) tidlist.pushUnique('[['+title+']]');
});
tidlist=tidlist.join('\n');
var t=store.getTiddler(tid); var tags=t?t.tags:[];
store.saveTiddler(tid,tid,tidlist,config.options.txtUserName,new
Date(),tags,t?t.fields:null);
story.closeAllTiddlers();

story.displayTiddlers(null,store.getTiddlerText(tid).readBracketedList());
</script>
!end
%/

Scalpa


On Feb 15, 10:45 am, Scalpa <scal...@gmail.com> wrote:
> Thanks Eric,
>
> It looks obvious once you see it !
> I managed to make it work, piecing it together with Morris Gray's
> syntax (see below). However your script assumes the field contains as
> values tiddler names, which my script does not. I just want to filter

> by field value, eg whenever field 'time' == value 'now' display thetiddlers. I added a condition, but don't see how to add to the

Eric Shulman

unread,
Feb 24, 2010, 4:58:04 PM2/24/10
to TiddlyWiki
> What it does: checks for a certain field==value among all tiddlers,
> lists all positives in a given Tiddler tid (in my example it is called
> 'CurrentTiddlers'), closes all tiddlers and then opens the ones listed
> in CurrentTiddler.

You could simplify this a lot by *not* writing the list to a tiddler
at all, and just pass the generated array of tiddler titles directly
to displayTiddlers().

   var fieldname='yourfield'; // put in what you want
   var fieldvalue='yourvalue'; // same thing
   var tidlist=[];

   store.forEachTiddler(function(title,tiddler){
      if (store.getValue(title,fieldname)==fieldvalue)
tidlist.pushUnique(title);
   });
   story.closeAllTiddlers();
story.displayTiddlers(null,tidlist);

enjoy,
-e

Scalpa

unread,
Feb 25, 2010, 4:36:18 PM2/25/10
to TiddlyWiki
Definitely. Thanks for pointing that out.
I was actually playing with javascript to find out what I could do,
and I wanted that tiddler with the list as well (which admittedly
could be generated by the forEachTiddler macro).

Scalpa

On Feb 24, 10:58 pm, Eric Shulman <elsdes...@gmail.com> wrote:
> > What it does: checks for a certain field==value among alltiddlers,
> > lists all positives in a given Tiddler tid (in my example it is called

> > 'CurrentTiddlers'), closes alltiddlersand then opens the ones listed

Eric Shulman

unread,
Feb 25, 2010, 7:22:32 PM2/25/10
to TiddlyWiki
> Definitely. Thanks for pointing that out.
> I was actually playing with javascript to find out what I could do,
> and I wanted that tiddler with the list as well (which admittedly
> could be generated by the forEachTiddler macro).

Of course, the results of forEachTiddler are only for *viewing*
purposes, since the macro will only produce output when the tiddler it
is in is rendered.

For *data* purposes, generating a tiddler with a static list of
tiddler titles in it is more useful, since that list can then be read
by various plugins (e.g., StoryViewerPlugin).

One interesting twist.... instead of creating a *real* tiddler in the
store, you can just write the tiddler text to a *shadow* tiddler, like
this:
config.shadowTiddlers["CurrentTiddlers"]=tidlist.join("\n");

This will create a temporary shadow tiddler... when you save the
document, it will NOT be saved. Many times, this is desirable... you
can generate chucks of data in tiddlers during the current session,
and they will be automatically discarded when you exit. Also, because
they are shadow tiddlers, they don't appear in the main tiddler
list.... just the More>Shadowed list.

Plus... if you occasionally *do* want to preserve a temporary shadow
tiddler in between sessions, you can easily turn it into a real
tiddler by using edit/done before saving the document.

enjoy,
-e

Reply all
Reply to author
Forward
0 new messages