AutoOpenPlugin

8 views
Skip to first unread message

skye riquelme

unread,
Sep 12, 2009, 5:23:41 PM9/12/09
to TiddlyWiki
Hi All

Starting to work on a project to create a simple chat system for a
small group.

One thing I need is to have the TW automatically open a new tiddler,
in edit mode, with an automatically generated heading (something like
"UserName-YYYYMMDDHHMM). When that tiddler is saved...a new tiddler is
automatically opened using the same format.......so that there is
always a ready tobe edited (written) tiddler open at all times.....

The idea is a local simple twitter-type chat within TW (I am finding
it strange to leave the environment of my TW space!!).

Thanks in Advance
Skye

shavinder

unread,
Sep 13, 2009, 11:47:23 PM9/13/09
to TiddlyWiki
Thats a geat idea. Inlinejavascript plugin by Eric can do this, I
think. A script can create a new tiddler which when closed triggers
another script to make a call back to the mother script(you would
prolly also need a special template, using TaggedTemplateTweak plugin,
again by Eric . The mother script again spawns a fresh tiddler.
Alternatively why not just keep the same tiddler open and just send
the current data away to the chat destination? That too should be
possible by InlineJavascript plugin. You could create a macro button
"send" and place it in the toolbar along with others. This macro call
should send away the current text and delete it from the current
contents. Further if might check if logging feature is enabled, then
it might also "append" the text to log tiddler. Eric just yesterday
explained the appending technique here in the group.

Would this be a peer to peer chat without a central server?

(be warned: I am just a novice TW enthusiast)

Eric Shulman

unread,
Sep 14, 2009, 12:17:15 AM9/14/09
to TiddlyWiki
> One thing I need is to have the TW automatically open a new tiddler,
> in edit mode, with an automatically generated heading (something like
> "UserName-YYYYMMDDHHMM). When that tiddler is saved...a new tiddler is
> automatically opened using the same format.......so that there is
> always a ready tobe edited (written) tiddler open at all times.....

Try this instead:

In PageTemplate, add a special 'quickInput' DIV inside the
'displayArea', and above the 'tiddlerDisplay', like this:
----------------------------
<div id='displayArea'>
<div id='messageArea'></div>
<div id='QuickInput' refresh='content' tiddler='QuickInput'></div>
<div id='tiddlerDisplay'></div>
</div>
----------------------------
Then, in QuickInput, write:
----------------------------
<html><nowiki><form>
<textarea name="txt" rows="5" cols="60" style="width:100%"></
textarea><br>
<input type='button' value="save" onclick="
var who=config.options.txtUserName;
var when=new Date();
var title=who+when.formatString('-YYYY0MM0DD0hh0mm');
var msg=config.messages.overwriteWarning.format([title]);
if (store.tiddlerExists(title) && !confirm(msg)) return;
store.saveTiddler(title,title,this.form.txt.value,who,when,[],{});
story.displayTiddler(null,title);
"></form></html>
----------------------------

That's it... without any plugins...

enjoy,
-e

skye riquelme

unread,
Sep 14, 2009, 1:26:45 AM9/14/09
to TiddlyWiki
Hi Eric

I tried your script but can´t get it to work...it creates a great box
at the top of the page with a send bottom at the bottom...but when I
type some text and then hit send ..it doesn´t create the
tiddler.......nitions

..and ..in the store.saveTiddler line.......can I include
tags ?????........I´d like to tag each tiddler as Talk (licked up by a
FET that is displaying the chat) and temporary (so I don´t keep saving
months worth of chats in each persons TW...

Thanks in advance...a real neat solution..

Skye

Eric Shulman

unread,
Sep 14, 2009, 2:02:28 AM9/14/09
to TiddlyWiki
> type some text and then hit send  ..it doesn´t create the
> tiddler.......nitions

huh?

I tried this in an empty TW document and it created the tiddler just
fine. Perhaps you have installed a plugin that is interfering?

> ..and ..in the store.saveTiddler line.......can I include
> tags ?????........I´d like to tag each tiddler as Talk (licked up by a
> FET that is displaying the chat) and temporary (so I don´t keep saving
> months worth of chats in each persons TW...

easy... instead of the empty tags array:
[]
just write:
["Talk","temporary"]

enjoy,
-e

shavinder

unread,
Sep 14, 2009, 9:00:52 AM9/14/09
to TiddlyWiki
Its wonderful! never would have thought such a neat solution and
compact solution was possible!
Its working wonderfully. I just tried it out. There is one thing I
noticed, we can only create one tiddler in a minute, otherwise TW
alerts us that a tiddler already exists. I changed this line:
var title=who+when.formatString('-YYYY0MM0DD0hh0mm');
to:
var title=who+when.formatString('-YYYY0MM0DD0hh0mm0ss'); //adding the
seconds

Now one tiddler per second can be created.

-shavinder

Måns

unread,
Sep 14, 2009, 7:24:43 PM9/14/09
to TiddlyWiki
Wauw - this sounds great and very usefull indeed - would you mind
uploading a working testcase?
I would love to see it in action.

YS Måns Mårtensson

Tobias

unread,
Sep 14, 2009, 9:12:36 PM9/14/09
to TiddlyWiki
Hi Eric,

Possibly the problem is in using the wrong quotes. Instead of:
["Talk","temporary"] skye would have to use:
['Talk','temporary']

QuickNotes is a cool solution. I just added such a tiddler to my
notetaking tiddlywiki, listing newly created notes via
tiddlerListMacro right below the input form, allowing to delete notes
at a button click.

Tobias.

skye riquelme

unread,
Sep 14, 2009, 11:26:44 PM9/14/09
to TiddlyWiki
Hi Again

Finally had time to check out what was happening. As Eric said one of
the other plugins must be interfering with this working. So I set up a
empty TW...the code works perfectly asa Eric said...then added in the
plugins I have in the TW where this code doesn´t work......until I
found that loading in HTMLFormattingPlugin breaks this code...delete
HTMLFormattingPlugin and it works again...reload HTMLFormattingPlugin
it stops working.....its beyond me to figure out why...but I have
deleted that plug in and things work fine

......this was of course after I remembered the nasty habit that
Google has of putting in line breaks where they aren´t!!!!

Thanks again

Skye

skye riquelme

unread,
Sep 14, 2009, 11:37:05 PM9/14/09
to TiddlyWiki
OOOooops

Just one thing....the code now writes the tiddler correctly...but does
not clear the text in the input box....so I have to delete before I
can add something else......can I have it clear r the text as
well...in preparation for another entry???

Thanks
Skye

Eric Shulman

unread,
Sep 14, 2009, 11:47:12 PM9/14/09
to TiddlyWiki
> found that loading in HTMLFormattingPlugin breaks this code...delete
> HTMLFormattingPlugin and it works again...reload HTMLFormattingPlugin
> it stops working.....its beyond me to figure out why

Did you include the special "<nowiki>" syntax in the html? Are you
using an older version of HTMLFormattingPlugin? (the nowiki feature
was added in 2.3.0)

-e

Eric Shulman

unread,
Sep 14, 2009, 11:48:57 PM9/14/09
to TiddlyWiki
> Just one thing....the code now writes the tiddler correctly...but does
> not clear the text in the input box....so I have to delete before I
> can add something else......can I have it clear r the text as
> well...in preparation for another entry???

add these two lines to the end of the script:
this.form.txt.value=""; // reset content
this.form.txt.focus(); // put cursor in field

enjoy,
-e

skye riquelme

unread,
Sep 15, 2009, 1:42:40 PM9/15/09
to TiddlyWiki
....You´re right again.......that HTMLFormattingPlugin was
2.2.0.....need to get myself more organised around maintaining current
versions....just that with my laptop now being populated by hundreds
(maybe 1000s) of TWs its task to keep them all synchronised!!!!!

Which leads to a new question.......How many TWs can fit inside a
laptop ? With superhigh populations is there any danger they will
start copulating and maybe even transmuting into something else?

Thanks
Skye

Eric Shulman

unread,
Sep 16, 2009, 4:30:29 AM9/16/09
to TiddlyWiki

Based on the discussions in this thread, I've just added a new tiddler
to TiddlyTools:
http://www.TiddlyTools.com/#QuickNote

QuickNote isn't a plugin (no 'systemConfig' tag), nor an inline
script. Instead, it's "transcluded" content using only TW's core
syntax, and doesn't need *any* plugins at all. To use QuickNote, you
embed it in another tiddler and pass a 'dateformat' parameter to it by
writing something like this:
<<tiddler QuickNote with: "-YYYY0MM0DD0hh0mm0ss">>

Also, I've improved the interface a bit by adding a text field that
the form shows the title (updated automatically) that will be used to
create the next quick note tiddler, plus an input field for entering
tags (default tag="quicknote"). When you press 'save', you get a
chance to confirm or change the auto-generated title (or cancel the
save).

enjoy,
-e
Reply all
Reply to author
Forward
0 new messages