Running Bash and Python scripts from within TiddlyWiki

434 views
Skip to first unread message

jimb...@hotmail.com

unread,
Jan 15, 2016, 1:40:28 PM1/15/16
to TiddlyWiki
Hi,

I am working on the organisation of images that are more or less randomly distributed over my file system in the moment. What I want is to create a tiddlywiki (node) that allows tagging and linking the images that will be placed in a central directory. So far I've written a script that hard copies the images automatically to the directory in the tiddlywiki and creates tiddlers out of the exif metadata and other arguments that add to the tagging. I access the images with the ximg macro of Tobias Beer that points to a local server.  Up to now I have encountered two problems that are both related to the question if and how it may be possible to run bash or python scripts in the node version of tiddlywiki:
  1. There is no automated previewing for RAW, NEF, CR2 and other raw file formats. So now I extract the preview jpgs and store them separately. The tiddler preview then actually points to these. This is however pretty vulnerable when any changes take place. And I certainly could make better use of the data volume...
    I imagined that I could extract the preview jpgs dynamically when being able to run a bash script. The deletion of the created previews doesn't have to take place inside tiddlywiki, would be nice though.
  2. To normalize importing and deleting processes of images, i.e. copying them to the image directory and creating their tiddlers as well as deleting tiddler and image simultaniously, I'd like to be able to run the script I mentioned above inside tiddlywiki by defining the necessary arguments and clicking for example a button.

Thanks for any replies,

Jim

Jed Carty

unread,
Jan 15, 2016, 5:41:19 PM1/15/16
to TiddlyWiki
This probably isn't a useful response, but I played with a similar idea trying to run perl scripts from a local tiddlywiki and never managed to get it working. If you find a way to make this work please share it.

Hegart Dmishiv

unread,
Jan 15, 2016, 7:47:08 PM1/15/16
to TiddlyWiki
Another non-useful response, but I'm interested in the answer as well. Much of what I'm doing with TW is for documenting my network installation in preparation for deploying the next Lubuntu LTS version due in April this year, and I was intending to just copy the relevant BASH scripts from my TW file and paste each into the SSH shell manually. If there is a way to execute them directly from TW instead, that would make things even easier for me.

Andreas Hahn

unread,
Jan 15, 2016, 11:04:21 PM1/15/16
to tiddl...@googlegroups.com
Hi guys,

I have had similiar ideas in the past and gave it a few tries. The (more
or less) best thing I could come up with is extending the nodejs-server
command with a CGI interface. That way the execution of an external
program turns into a http-request, more specifically a tiddler
load/render event. Furthermore it is just a simple addition to the sever
command code so it was what I eventually ended up doing.
Note that this does mean, that the external program needs to be either
CGI capable itself or you have to have a wrapper application of some sorts.

That sort of solution would also work for TiddlyDesktop, but I don't
really see a good way of making this work for a standalone wiki. There
are however other options. The ones I found and tested (all
unsuccessfully, which is why I ended up doing it another way, but it
would in theory be possible) are:

- Custom protocol handler in Firefox/OS
(http://kb.mozillazine.org/Register_protocol or in firefox itself in the
settings menu (note that you need an application runner as a program
that will take the request and execute the program you want))
- Extend Tiddlyfox to handle a new tw-message
(https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Running_applications)
- Get an extension that does that for you. (For example:
https://addons.mozilla.org/en-US/firefox/addon/applauncher/ << Note that
it looks untrustwhorthy, but it would do the trick, since it can take
the selected text and incorporate it into the command)

/Andreas
Reply all
Reply to author
Forward
0 new messages