Re: Using randomTiddlers macro with openStory/saveStory marcros

68 views
Skip to first unread message

Tobias Beer

unread,
Jul 13, 2012, 4:02:39 AM7/13/12
to tiddl...@googlegroups.com
Hi Scott,

I have released a new version 1.0.2 at...
http://randomtiddlers.tiddlyspace.com/

It allows for two new parameters:
save: yes / no
saveWithTags: Tag Tag Tag

If you set save to yes, you are prompted for a tiddler title to which the output will be saved.
With saveWithTags you can give such a tiddler certain tags when being created.

For more info, see...
http://tobibeer.tiddlyspace.com/#RandomTiddlers


Am Freitag, 13. Juli 2012 07:09:59 UTC+2 schrieb Scott Masterson:
Hello all, 

I'm up against a timeline and have hit 2 roadblocks and could really use some help.  I have a TW that's going to be used as a distributed test.  What I want is for the test administrator to be able to click a button and get a test consisting of 25 random questions from a pool of 100.  So, I used the randomTiddlers macro, which works perfectly - it fills the tiddler with the titles of 25 random tiddlers.  

But what I'd really like it to do is close all open tidders and then open 25 random tiddlers.  Then I'll be able to click on "Save Test" in the right menu (it's already there).  "Save Test" calls the saveStory macro and currently works fine.  The part I can't figure out is how to open 25 random tiddlers?

The other problem is, I'd like to find some way to have nestedSliders accessible only for people with a specific UserName?  I'm using the formTiddlersPlugin and want to put the answers below the questions in a slider, but only the test grade should be able to open the slider. How can I do that?

Here's the TW in my Dropbox folder:  https://dl.dropbox.com/u/3946724/Test-Bank.html   (the right menu toggle is in the top menu).

I'd appreciate any help ... thanks!
Scott

Scott Masterson

unread,
Jul 13, 2012, 8:38:55 AM7/13/12
to tiddl...@googlegroups.com
Thanks for answer so quick Tobias!  Those changes are useful, but not exactly what I was looking for.  Since I'm using the saveStoryPlugin to save my layout as a Test (there are 3 types), I need a macro that will close everything and theen open 25 random tiddlers.  Right now, the titles of the 25 tiddlers are written to a tiddler, but I need the actual tiddlers to be open, so that I can save them as a story.  Any ideas?  Here's my config file for randomTiddlers:

|''max''|10|
|''sample''||
|''tagged''|[[Marine Casualty]]|
|''exclude''|systemConfig|
|''content''|Source|
|''type''|none|
|''required''|no|
|''sort''|modified|
|''dateformat''|DD. MMM, YYYY|
!Template
!!![[%0]]

As far as showing nestedSlider to certain users, I'm going to try to use your SimpleRolesPlugin.  Thanks again!

Scott

Scott Masterson

unread,
Jul 13, 2012, 9:54:41 AM7/13/12
to tiddl...@googlegroups.com
So, an update...

This is the macro I'm using to open a quiz/test:  <<openStory MC-Quiz "Open Marine Casualty Quiz">>
This is the macro I'm using to generate a random list of questions:  <<randomTiddlers MC-RandomTiddlersConfig>>

What I want to do is this:  

<<openStory <<randomTiddlers MC-RandomTiddlersConfig>> "Open Marine Casualty Quiz">>

Notionally, that would open 25 random tiddlers, which I could then save with:  <<saveStory MC-Quiz "Save MC Quiz">>.

That's clearly the wrong code, but my coding skills are rusty and I'm not sure how to format the call - if it's even possible. Any thoughts?

Thanks,
Scott

Tobias Beer

unread,
Jul 13, 2012, 10:31:27 AM7/13/12
to tiddl...@googlegroups.com
Hi Scott,

I am positive that the current implementation actually allows you to do what you want.

save:yes
SafeWithTags: story
!Template
[[%0]]

So this will save the list to a tiddler in the form of a story with the name you specify.

To open that story, you need something like this somewhere:
<<openStory popup label tooltip>>

...and then chose the story you just saved.

However, I have added an option to override any existing tiddler with version 1.0.3:

Tobias.

Scott Masterson

unread,
Jul 13, 2012, 12:14:32 PM7/13/12
to tiddl...@googlegroups.com
Tobias,

I'm apparently doing something wrong.  I updated the plugin, added |''save''|yes| and |''saveWithTags''|MC-Quiz| to the config file and put thee <<randomTiddlersMacro MC-RandomTiddlersConfig>> macro in a tiddler.  When I save and reload, it asks me for a tiddler name (I'd really like to define the tiddler name in the config file), and then when I enter it, it asks me if I want to overwrite the existing tiddler.  So far, ok ...but the name changes from MC-Quiz (my entered tiddler  name) to "undefined".  When I click Ok, it creates a tiddler named undefined and tagged with MC-Quiz, which makes sense.  But if I try to change undefined to MC-Quiz in the dialog, it won't let me click Ok and move on.  If I do allow the tiddler to be created with "undefined", then when I try to open the story, it destroys the whole tiddlywiki.

I'm probably just missing  something, but how can I define the name of the output tiddler in the config file and NOT have it ask me to overwrite it?  I plan on putting the 3 macros in a systemConfig tiddler and having  them generate a new quiz each time it's loaded.

Scott

Eric Shulman

unread,
Jul 13, 2012, 2:06:12 PM7/13/12
to TiddlyWiki
> I need a macro that will
> close everything and theen open 25 random tiddlers.  Right now, the titles
> of the 25 tiddlers are written to a tiddler, but I need the actual tiddlers
> to be open, so that I can save them as a story.  Any ideas?  Here's my
> config file for randomTiddlers:

A story tiddler is just a tiddler containing a white-space separated
list of tiddler titles. Thus, if you change your RandomTiddlersMacro
config so the !Template is defined as just "[[%0]] " (e.g., without
the leading "!!!" and with one trailing space), then the output *is* a
saved story, and you can just invoke <<openStory [[StoryName]]>> macro
to view the 25 tiddlers. You can also set <<option chkStoryClose>>
(i.e., config.options.chkStoryClose) so that currently open tiddlers
are automatically closed whenever a new story is opened. QED.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

WAS THIS ANSWER HELPFUL? IF SO, PLEASE MAKE A DONATION
http://www.TiddlyTools.com/#Donations
Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact
Message has been deleted

Tobias Beer

unread,
Jul 14, 2012, 6:06:26 AM7/14/12
to tiddl...@googlegroups.com
Ok, I have changed the implementation once more to version 1.0.4.

A)
Now you no longer say if you want to save the output to a tiddler via the slice:

save:yes

In other words, the parameter save is now deprecated and no longer recognized.

Instead you define the title of a tiddler to which you want to save the output via the slice:

saveTo:SomeTiddlerTitle

You are still being prompted to confirm the tiddler title to which you want to save, but the prompt defaults to the title you defined. If you leave it unchanged and hit Ok, it will save to that tiddler without further ado. If you change the title and that tiddler exists, you must confirm to overwrite that tiddler at a second prompt where you can do either of...
- enter "YES" to overwrite
- enter a different title
- cancel saving all together


B)
Also, I have included a link above the list to the tiddler to which the output was saved. In addition, if you have http://tiddlytools.com/'StorySaverPlugin installed, it will also render the openStory macro as a link which directly allows you to open the newly saved tiddler as a story.


C)
I have updated the documentation accordingly:


Let me know if this suits your needs and, above all, have a great weekend.

Cheers, Tobias.

Scott Masterson

unread,
Jul 16, 2012, 11:40:18 AM7/16/12
to tiddl...@googlegroups.com
Tobias,

Thanks, that worked beautifully! My only remaining problem is that I want to invoke the macro with a button or link, but I don't know the syntax?

V/r
Scott

Scott Masterson

unread,
Jul 16, 2012, 1:59:21 PM7/16/12
to tiddl...@googlegroups.com
Disregard my last, I figured it out! Thanks for all the help.

V/r,
Scott

Reply all
Reply to author
Forward
0 new messages