do action on open tiddler

199 views
Skip to first unread message

Dave

unread,
Nov 28, 2018, 1:13:42 PM11/28/18
to TiddlyWiki
Is this still the most current way to trigger actions upon opening a specific tiddler?


What I'd like to be able to do is this 
<$action-setfield mynow=<<now YYYY0MM0DD>>/>

when I open a specific tiddler.


I tried just putting that in the DefaultTiddlers section of the control panel, but it just treated it as 3 tiddlers

TonyM

unread,
Nov 28, 2018, 5:36:45 PM11/28/18
to TiddlyWiki
Dave,

Default tidders is only to open tiddlers when you open the wiki.

Do you want this date time field set on each tiddler when it is opened?

Are you asking for an action on open tiddler?

I have learned a fair bit around this but want to clarify what you want before I comment in more detail.

There are tricks, limitations and work arounds.

Regards
Tony

Dave

unread,
Nov 28, 2018, 8:23:08 PM11/28/18
to TiddlyWiki
I'd like to have that action happen when one specific tiddler opens. I can put that tiddler in the default tiddlers, but also open in other situations.

TonyM

unread,
Nov 29, 2018, 12:00:49 AM11/29/18
to TiddlyWiki
Dave,

The Quickest and easiest way to do I is to have a button appear when the tiddler is opened, via a view template entry. Yes you will have to click it.


I have wanted something similar but was told we have to make a change in the navigation mechanism, which is not so strait forward, and is likely to have a performance impact.

I have managed to get an action on close by adding an action to the Close button, But the Close all (page Button) will bypass it, and close all does not ”know" which tiddler your are using.

Another way

You could build your own tiddler, that contains a custom button that not only sets the field as you wish, but also opens the target for view or edit. As long as you click on that button to open the target tiddler you can get what ever actions you want to happen inside the definition of that button.

Perhaps a tiddler containing the Button could be added to  ($:/tags/AboveStory for elements to be placed at the top of the story river)

Even better would be a way to add a field to any tiddler eg; on-open-action, then a special tiddler/Menu will list all such tiddlers, and provide a button which on click will transclude the on-open-action field in that button (and execute it on click), this is speculations on my part.

Basically what I am saying is if you provide a convenient way to open a tiddler in the first place you can determine what also Happens when opening it. It is not so easy to try and trap the opening of any tiddler, and respond with actions when a specific tiddler is opened. However their may be a hack no one has though of yet.

Regards
Tony

TonyM

unread,
Nov 29, 2018, 1:39:38 AM11/29/18
to TiddlyWiki
Just tested this;

Tiddler: Open with open actions
<$list filter="[has[open-actions]!has[draft.of]]">
<$button>
<
<currentTiddler>> {{!!open-actions}}<br>
Click me!
</$button>
</$list>

It creates a button for all tiddlers having a field open-actions with content eg  a tiddler with 
<$action-sendmessage $message="tm-notify" $param="SampleNotification"/><$action-setfield mynow=<<now YYYY0MM0DD>>/>

Also a tiddler called SampleNotification has the message to display

This could be improved by using the an icon, or caption field, adding the same to the view template by Tagging [[Open with open actions]] with $:/tags/ViewTemplate
Also I would display the field with $view date widget, perhaps using relative date.

So this should be functionally equivalent to your original request.

Since you date stamp is today you could even put in a test that only show the button if is does not have today's date in the field.

Regards
Tony

Dave

unread,
Nov 29, 2018, 3:54:12 PM11/29/18
to TiddlyWiki
good idea!

 Thanks, I'll try that

S. S.

unread,
Nov 30, 2018, 5:58:27 AM11/30/18
to TiddlyWiki
When a tiddler "opens" - no matter how it is opened, I believe its presence is added to the tiddler $:/HistoryList and the list field of tiddler $:/StoryList.
Perhaps whatever is making that happen can be modified to also change the value in the mynow field of the tiddler being opened.

PMario

unread,
Nov 30, 2018, 6:46:25 AM11/30/18
to TiddlyWiki
Hi Dave,

For me it would be easier, if you describe, what you want to achieve. ... This would give me the possibility to understand the needed workflow.

-m

Dave

unread,
Nov 30, 2018, 1:24:03 PM11/30/18
to TiddlyWiki
Hi Mario,

I have this Agenda list of tiddlers with "due" fields that have dates in them:
<ul>
  <$list filter="[has[due]days:due[60]days:due[-60]!tag[done]!sort[due]]">
    <li>
      <$link><$view field="title"/></$link> <<calc !!due -  by:mynow!!mynow>> days
         <$list filter="[<currentTiddler>days:due[15]!days:due[2]]"> @@color:beige;^^upcoming^^@@</$list>
         <$list filter="[<currentTiddler>days:due[1]days:due[-1]]"> @@color:red;^^today^^@@</$list>
         <$list filter="[<currentTiddler>days:due[-7]!days:due[-2]]"> @@color:black;^^recent^^@@</$list>
         <$list filter="[<currentTiddler>days:due[-60]!days:due[-30]]"> @@color:yellow;^^over a month^^@@</$list>
    </li>
  </$list>
</ul>

It's not actually super accurate outside of the current month, but that's another problem to solve in the future.

My basic need is when its a new day I have to tap this button to make sure that the date here (mynow!!mynow) is actually todays date. 
\define mynow()
<$button>
<$action-setfield mynow=<<now YYYY0MM0DD>>/>set today
</$button>
\end
<<mynow>>

My goal is for the date to be set automatically when the TW first opens, or when I open the tiddler with the Agenda list in it.

TonyM

unread,
Nov 30, 2018, 5:10:21 PM11/30/18
to TiddlyWiki
Dave,

Perhaps you could explain why you want to do this?

I have a few algorithms up my sleave, eg

I create journal tiddlers every day, and extended it to include a journal-date field I can change if I want. I also have a field called item-touch-date I can time stamp on any tiddler I visit, dont modify but want to log I reviewed.

In a similar way If I add a operational-review date to a tiddler I list all tiddlers with this field before today. When I action each I time stamp them now, indicating the daily review is done and they are removed from the list, I have something similar for weekly and monthly etc...

With these methods created and modified continue to mean what they do because the other field time stamps are set to not update the modified date.

Regards
Tony

Dave

unread,
Nov 30, 2018, 7:11:56 PM11/30/18
to TiddlyWiki
Why?      because I'm super lazy, ha ha


I'm so lazy that I'm willing to spend hours figuring out how to save seconds every day.  E.g. I get annoyed when I look at my agenda list of todos, spend 10 seconds going "huh? that's not supposed to be 4 days away..." then realising I forgot to reset the date by pressing that button.

Dave

unread,
Nov 30, 2018, 7:13:52 PM11/30/18
to TiddlyWiki
What I'd *really like* is a way to have a formula in a field, kind of like you can have a formula in an excel spreadsheet that always displays the computed value

Dave

unread,
Nov 30, 2018, 7:28:32 PM11/30/18
to tiddl...@googlegroups.com
I wonder how many chocolate bunnies I'd have to sacrifice to the TW gods to get that functionality, ha ha (maybe if I send them in the mail to London that might work ;)

TonyM

unread,
Nov 30, 2018, 10:37:22 PM11/30/18
to TiddlyWiki
Dave,

In some ways I am already doing what you ask but the details are deep within greater solutions. For example my MyMenus plugin (not developed beyond when I released it) at http://tiddlywiki.psat.com.au/mymenus/, has menu items defined in fields that can be any form of wiki text including macros and transclusions. The macro that displays the menu then "transcludes" the value in each field, which the wikification process returns the "computed value", if the menu is used on a particular tiddler it references value on the current tiddler.

Similarly in my edit-fields macros (not published) I have a tiddler that defines each field name (field definition tiddler), when viewing a tiddler, the view template will transclude the field definition tiddler to display the contents of the current tiddlers field(s). More importantly it uses some gymnastics to allow the editing of that field in the current tiddler, using the field definition. So for example if I have a project field, it will lookup all tiddlers tagged project (which are in the current "domain" eg work) from which I can set the current project.

Everything is possible.

Tony

Dave

unread,
Nov 30, 2018, 11:23:01 PM11/30/18
to TiddlyWiki
Thanks Tony, that mymenus plugin looks like it might do the trick!
Reply all
Reply to author
Forward
0 new messages