Action on Open and close tiddler - background actions with 5.4.0

With the release of TiddlyWiki 5.4.0 the new Background Actions
stand to resolve a few outstanding needs of my own and the community.

Here are few ideas that come to mind to inspire, and criticise me if needed.

The example given on tiddlywiki.com is one of the examples. Rather than display the story list every time it changes we could construct some conditional actions to respond both on open and close of tiddler, perhaps even with their own subfilter.

The ability to trigger actions on particular tiddlers, when opened and subsequently closed allows one to do such things as;

  • Log the open time, log the close time and compute the time it is open in the story. Some time management applications can use this. Avoids asking for an independent start/end button.
  • Perhaps we can start a timer on close, to reopen the tiddler within a given period. but beware people don’t like being pestered. However sometimes like spaced repetition we are asking to be pestered.
  • We could trigger a timer to save the wiki in 5 mins, allowing multiple changes to be made before using a times save, rather than autosave that is a little more brutish especially on large wikis.
    • In the mean time you may rely on local storage in case your computer powered off.
  • It will now be possible to log when specific tiddlers are opened, this allows one to automate the opening neglected tiddlers, those not opened in some time.
  • We can selectively respond to particular tiddlers when opened such as setting the currentProject when you open a project, perhaps after saving all tiddlers relating to the last project so they can be loaded when you return to that project.
    • You could always throw a message when a project has not outstanding tasks or other useful metrics.
  • Perhaps finally we can prompt for a decryption code and re-encrypt on close with tiddler level encryption.
  • Perhaps one may be the wiki sits idle from last change, force a save (when it does not need interactions) this also permits a manual and automatic logout process to be forced on the wiki for applications where we need house keeping, sync or other actions on end of use of a wiki, something that is not so easy.

Perhaps there would be some value sharing code patterns to achieve the above on tiddler open/closed, and timer related features.

The above only responds to changes in the story list. Please share possibilities you can think of with the community especial with other filters.

More a question as this goes over my head a bit:

Could this be used as a more ‘native’ basis for an alias solution? For example:

  1. Setting a tiddler as an alias of another (in some way)
  2. Opening that other tiddler
  3. Closing the current tiddler

All by editing the $:/StoryList.

That’s just a guess, I did not test it, but you would have to be careful.

My guess

Since it is triggered by $:/StoyList …

  • The animation opening a tiddler, most likely will already have started
  • The background action modifies the story list
  • Closes the current tiddler to be opened
  • Open a different one which will start the animation again

IMO you can be sure to get user complains about: I can not open tiddler X - tiddler y is opened instead.

1 Like

One trick to employ when using automation as a tiddler is opened is to add to the recent tiddlers tab or other sidebar lists edit buttons, so rather than trigger automation you can go direct to edit.

This does however suggest a need to bypass or turn off such automation and differentiate between open and open for edit.

Similarly if you accidentally trigger on open we may need the ability to exit or reverse the actions or close without action.

The ability to switch on confirmation prompts also makes sense.

As i expected starting this topic is illuminating the subject. It also highlights the value of developing code patterns and best practices on top.of important new features.

(post deleted by author)

1 Like

@wattahay perhaps you can explain what kind of behaviour you are looking at?

There are already settings in relation to where tiddlers are placed in the story and a custom button to edit could influence this. I am not sure background actions would be needed for what you want to do, an example may be cloning the edit button and hiding the default, in the custom edit button add you special features on hitting the custom edit button.