How do I can I display txt-file in TW

415 views
Skip to first unread message

Jan

unread,
Mar 27, 2019, 9:27:40 AM3/27/19
to TiddlyWiki
...in a way
-that automatically scales a div to the needed heigth,
-that can refresh on clicking a button or within afixed time
-that allows to import the text.

(which excludes iframes, external Text /canonical_uri. or <object data="" type="text/plain"> because they can't do this.

I do not know whether there is an obvious solution that I overlooked so far.
For me it would make it possible to cooperate in education by beeing able to display and import txt-files that students write on my server.

I did an unsuccessful test to write a widget that does this on www.szenio.de/test which I already posted.

thanks and best wishes Jan


Jed Carty

unread,
Mar 27, 2019, 12:43:40 PM3/27/19
to TiddlyWiki
This is mostly a server side problem, not something a normal widget can do, so this answer may not be very useful to you if you are hoping to make it work in a single file wiki.

If you have the text file in question locally than you could, possibly with some bash scripting, display the text file as a tiddler and get automatic refreshes that way. If you can't make the text file a tiddler than the bash script would periodically read the text file, give it the appropriate header to make it a tiddler and then overwrite the existing tiddler for the text to make it update in the browser.

Bob would be able to work with that, I am not sure how the normal node server handles changes on the file system anymore, I think it may check every minute or so.

If the text file is remote than you may still be able to do it, but it would take a more complex bash script or possibly some node or python to fetch the text file.

Jed Carty

unread,
Mar 27, 2019, 12:54:36 PM3/27/19
to TiddlyWiki
My last post may be almost completely wrong. It is one way that you could handle the problem but I think that your example is not far from working. One problem you have is you are mixing a javascript macro with a widget, the two are different and having pieces of both is causing trouble.

I will look at this for a bit longer and I may have something to help a little at least.

Jan

unread,
Mar 27, 2019, 6:35:10 PM3/27/19
to tiddl...@googlegroups.com
Hi Jed,
great, light at the horizon! In fact I mixed up the two because the difference was not clear to me. I'll have to look it up.

best wishes and big thanks for your help!
Jan


Am 27.03.2019 um 17:54 schrieb Jed Carty:
My last post may be almost completely wrong. It is one way that you could handle the problem but I think that your example is not far from working. One problem you have is you are mixing a javascript macro with a widget, the two are different and having pieces of both is causing trouble.

I will look at this for a bit longer and I may have something to help a little at least.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/93e8c566-ece0-451d-80f9-40d998b6b9ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jan

unread,
Mar 29, 2019, 6:45:02 PM3/29/19
to tiddl...@googlegroups.com
Hi Jed, Hi everybody!
I am beginning to grasp the difference of widgets and macros which I mixed up on http://szen.io/Test/ would you propose to  make a widget or a macro to display refreshing txt.files...
Have you found a solution?

Best wishes Jan




Am 27.03.2019 um 17:54 schrieb Jed Carty:
My last post may be almost completely wrong. It is one way that you could handle the problem but I think that your example is not far from working. One problem you have is you are mixing a javascript macro with a widget, the two are different and having pieces of both is causing trouble.

I will look at this for a bit longer and I may have something to help a little at least.

Jan

unread,
Apr 9, 2019, 5:44:45 PM4/9/19
to tiddl...@googlegroups.com
Hello,
I still was not able to solve this problem...
Should I use a macro or a widget to display external .txt-files
I want to
-display txt-files configurably
-use them in widgets (like converting them it them into tiddlers)
-and it would be great it I could make them refresh on click.

I made an attempt on http://szen.io/Test/ to solve the Problem but I am stuck...

best wishes Jan

TonyM

unread,
Apr 9, 2019, 11:42:43 PM4/9/19
to TiddlyWiki
jan

I would like this as well, If we could only access the content of an external text file we could easily interrogate the status of something that say a server process set or another user deposited.

I believe using the html object to display a file should provide us the opportunity if not with a button click or trigger, it is after all on the screen in front of us, I can use the mouse to select and copy it so why can I not get a TiddlyWiki process to capture it. I believe a refresh of the tiddler does refresh the file from disk.

However not withstanding the value I see in this, Perhaps there is another way to achieve what you are after. Have you considered importing the text file, or giving each student their own wiki and exporting/importing tiddlers created by their username?

Importing from external resources

Try this - Go to TiddlyWiki.com then use import and rather than provide a local file provide the following url https://tiddlywiki.com/prerelease/index.html
This will open the whole prerelease wiki and you can select one or all tiddlers to import. 

I tested also importing a text file such as https://psat.com.au/tiddlywiki/Readme.txt and it worked

The Browse widget also works for html/tiddlywiki files but not for txt files

Perhaps you could build an independant process to collect all the students text files and create a local copy then use <$browse multiple> and select all the text files and import them in one step

Also
In the pre-release there is a local storage and an Innerwiki plugin that may solve a number of related needs.

Regards
Tony


On Wednesday, April 10, 2019 at 7:44:45 AM UTC+10, Jan wrote:
Hello,
I still was not able to solve this problem...
Should I use a macro or a widget to display external .txt-files
I want to
-display txt-files configurably
-use them in widgets (like converting them it them into tiddlers)
-and it would be great it I could make them refresh on click.

I made an attempt on http://szen.io/Test/ to solve the Problem but I am stuck...

best wishes Jan


Am 29.03.2019 um 23:44 schrieb Jan:
Hi Jed, Hi everybody!
I am beginning to grasp the difference of widgets and macros which I mixed up on http://szen.io/Test/ would you propose to  make a widget or a macro to display refreshing txt.files...
Have you found a solution?

Best wishes Jan



Am 27.03.2019 um 17:54 schrieb Jed Carty:
My last post may be almost completely wrong. It is one way that you could handle the problem but I think that your example is not far from working. One problem you have is you are mixing a javascript macro with a widget, the two are different and having pieces of both is causing trouble.

I will look at this for a bit longer and I may have something to help a little at least.
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.

Jan

unread,
Apr 10, 2019, 10:12:38 AM4/10/19
to tiddl...@googlegroups.com
Hello Tony,
thanks a lot for your interest. I think the ability to work with external ressources would enable us to new and "unothodox" Uses of TiddlyWiki.
Unorthodox because they contradict the single file concept of TW.
This is why importing the .txt is not the solution. https://szenio.de/Test/post/Posttester/Jan_Test.txt is created by a php which allows students to post to the wiki and to modify the posts during the session see https://szenio.de/Test/post/Posttester. The posts are then shown on the sidebar and I am importing into a mod of admls Mentat you find here: http://szenio.de/pin. (On the Desktop you can drag an entry to the pin and show it...) It is all work in progress so i did not show it to the group yet.)

So this is why I need a new way to
-display txt-files configurably
-use them inside widgets (like converting them it them into tiddlers)

-and it would be great it I could make them refresh on click.

Best wishes Jan
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Mohammad

unread,
Apr 10, 2019, 11:15:09 AM4/10/19
to TiddlyWiki
Jan
 In TW-Scripts there are some examples uses HTML5 embed to embed text, video or audio,...

I am not sure, but may be helpful or shed some lights into this case.

See for example:


--Mohammad

Jan

unread,
Apr 10, 2019, 12:54:01 PM4/10/19
to tiddl...@googlegroups.com
Hi Mohammad!
This looks good, and so easy!
I will check the refresh behaviour, for the data-tag that was a problem...
Why does Firefox tell me I need a plugin for this ?!

Jan
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Mohammad

unread,
Apr 10, 2019, 1:13:58 PM4/10/19
to TiddlyWiki
Jan,
 For me it works like a charm!
I use FF 66 and there is no problem.

--Mohammad

TonyM

unread,
Apr 10, 2019, 7:35:32 PM4/10/19
to TiddlyWiki
Jan

I do think we should always maintain site of the single file model but It is often applied too rigorously. Remembering this is already not the case on node, but in this case you are talking about inputs to your wiki. As long as your wiki does not break with the absence of external files. Presently a given wiki can recieve json csv text pdf images tiddlers plugins etc from sources external to the wiki. More and more people are using skinny tiddlers and external files.

Inputs and outputs should not be limited to manual processes.

Regards
tony

Jan

unread,
Apr 11, 2019, 10:13:48 AM4/11/19
to tiddl...@googlegroups.com
Hello Mohammad,
embed produces a sort of Iframe-Element.
This does not meet my needs, I do not only want to display it need to work with the result this means I want to insert it into a field.
I guess XMLHttpRequest is the answer...
But I can not find how to get this into the widget-code...

Best wishes Jan
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Jan

unread,
Apr 18, 2019, 7:28:33 PM4/18/19
to TiddlyWiki
Hello
I am still searching to solve the problem get the content of a txt-file
http://szenio.de/WebKnowHow/
...in a way
-that automatically scales a div to the needed heigth,
-that can refresh on clicking a button or within afixed time
-that allows to import the text.

Now I a last gat something that gives me the desired text ... but as an alert.

There is two things I want now:
- getting the content in a way I can display it and use the values macros and so forth.
- displaying the correct charset at the moment my röckdöts get diamonds.

Thanks for help.

Birthe C

unread,
Apr 18, 2019, 9:20:56 PM4/18/19
to TiddlyWiki
Hi Jan,
If I import a txt into TW, it is utf8 encoded. I do not see any diamonds then.

Birthe

Jan Johannpeter

unread,
Apr 19, 2019, 4:36:36 AM4/19/19
to tiddl...@googlegroups.com
 Hej Birthe,
 Request is that I do not want to import the text permanently, because it may still be changed on the server.  One use of this is displaying texts that are posted to the pin board by students and they shall still be able to modify them...and There is other uses where I need to change the external text file dynamically .

Best Wishes Jan 

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Jed Carty

unread,
Apr 19, 2019, 6:01:56 AM4/19/19
to TiddlyWiki
You could set up a timer to fetch the text and put it into a tiddler periodically so that you have it in a tiddler but it still updates.

An xmlhttprequest should let you do that.

Jan Johannpeter

unread,
Apr 19, 2019, 7:32:12 AM4/19/19
to tiddl...@googlegroups.com
 Hi Jed thanks, 
I think a timer will be part of the final solution.  But at the moment I’m still having trouble displaying the content in another way then in an alert which I got to work here:  Somehow “return” didn’t work.
So I am still struggling with the basics of getting the result of the JS into TW in a usable way.
 Best wishes Jan 


Jed Carty <inmy...@gmail.com> schrieb am Fr. 19. Apr. 2019 um 12:02:
You could set up a timer to fetch the text and put it into a tiddler periodically so that you have it in a tiddler but it still updates.

An xmlhttprequest should let you do that.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.

Jed Carty

unread,
Apr 19, 2019, 7:40:25 AM4/19/19
to TiddlyWiki
replace the line

alert(client.responseText);

with these two lines:

var fields = {title: 'Look! A title!', text: client.responseText}
$tw.wiki.addTiddler(new $tw.Tiddler(fields))

you will have to open the tiddler called 'Look A title!' manually, but that should put the text in that tiddler. I haven't tested this so there may be bugs.

Jan

unread,
Apr 24, 2019, 7:37:37 PM4/24/19
to tiddl...@googlegroups.com
Hello Jed, and many Thanks.
I am back on track and have worked with your solution.
For one of my aims the solution is perfect. I had to figure out how to use it and finally put it into a modal, where it refreshes as I want it to do.
http://szenio.de/Test/ .
As you can see, the only remaining Proplem is the charset.

But displaying changing external txt or html files refreshing and configurably (without either importing or diplaying them in an Iframe/embed/data frame still is not solved.
I would like to have something like <$external "url.xyz"/> which displays the content in place or vía a viewTemplate.

best wishes
Jan
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
Reply all
Reply to author
Forward
0 new messages