TWC: Writing out a tiddler as a separate text file?

80 views
Skip to first unread message

Shankar Swamy

unread,
Feb 28, 2016, 10:10:52 AM2/28/16
to TiddlyWikiDev


For those of you who subscribe to TiddlyWiki and TiddlyWIkiDev, my apologies: I had posted it at the former group first.

I would like to save the contents of a tiddler as a separate file, via JavaScript.  I am exclusive to Firefox (with Tiddlyfox).  So it does not have to be a cross-functional solution.  Fine, as long as it works with Firefox.

Is there a way of doing it?

What I am attempting to save separately is a JSON file. It is generated inside TiddlyWiki by a script and currently is written to a tiddler.  This works as long as I process it inside Tiddly.  But there are times when I use a Python program to process the JSON file.  So it would be convenient if I could directly save it as a separate JSON file without having to cut-and-paste every time. 

Thanks.

Cheers; 'best,
shankar

Eric Shulman

unread,
Feb 28, 2016, 11:31:09 AM2/28/16
to TiddlyWikiDev
On Sunday, February 28, 2016 at 7:10:52 AM UTC-8, Shankar Swamy wrote:
I would like to save the contents of a tiddler as a separate file, via JavaScript.  I am exclusive to Firefox (with Tiddlyfox).  So it does not have to be a cross-functional solution.  Fine, as long as it works with Firefox.

Is there a way of doing it?


You'll need to specify a target filename, since the "ask for filename" option is broken due to browser security changes over the years.  Also, the plugin relies upon the TWCore SaveFile() function, which only works if you have TiddlyFox installed... and I don't know if TiddlyFox allows creation of new files... so it might not work at all.  But it's worth a try.

-e

Shankar Swamy

unread,
Mar 5, 2016, 12:38:48 PM3/5/16
to TiddlyWikiDev
Eric,
Thanks.

It works - mostly.  The part that does not work, as you suspected, is the file chooser part, due to changes in Network security.  In your repository, perhaps you can remove the file picker part and instead prompt the user to enter the file name with full path?

For my purpose, it worked perfect, as I already know the file name and don't need the prompting part of it.

Thanks.

Cheers; 'best,
shankar
Reply all
Reply to author
Forward
0 new messages