Task Tracker scripting challenge

195 views
Skip to first unread message

Walt Ludwick

unread,
Dec 29, 2020, 4:36:00 AM12/29/20
to tiddl...@googlegroups.com
Following this excellent tutorial video by Francis Meetze about "Tracking Tasks in TiddlyWiki", i was easily able to get the thing working as shown... And moreover, getting it to integrate with the Contents tab i have created, following the previous video in same series, to the extent that my list of Completed and ToDo items shows up in the Contents tab.

The one hair in this soup is that the tickbox for "Completed" items, tho it works fine to migrate items from ToDo tiddler to Completed tiddler (and back, if status changes accordingly), does not remove the ToDo tag from the tiddler of a completed task, so it takes an edit on that task's tiddler to remove the ToDo tag -a small PITA, of course, but it does crap up the experience of a perfectly beautiful workflow.

So: this is to ask if anyone here can suggest a tweak to this script (below) on the ToDo tiddler that would trigger removal of the ToDo tag object from the subject tiddler. Ideas, anyone?

(NB: i have modified the script in video by changing instances of the word "done" to "Completed," just to make it work with my Contents tab taxonomy -but that is irrelevant to the problem i'm having; i've tried it both ways, and it makes no diff).   /walt

8<------- (contents of ToDo tiddler -which is tagged only w/ "Tasks", b/t/w) ----->8

<$list filter="[!has[draft.of]tag[task]!tag[Completed]sort[created]]">

<$checkbox tag="Completed"> <$link to={{!!title}}>
<$view field="created" format="date" template="DDth mmm hh:mm"/> - <$view field="title"/>
</$link>
</$checkbox>

</$list>

8<------- (end of script) ----->8

TW Tones

unread,
Dec 29, 2020, 6:14:23 PM12/29/20
to TiddlyWiki
Hi,

In the new release there is a toggle or cycle operator see here https://tiddlywiki.com/#toggle%20Operator and the examples provided include a tag.


Tones

TW Tones

unread,
Dec 29, 2020, 6:16:45 PM12/29/20
to TiddlyWiki
Post script,

I mean to suggest that a checkbox is not really the way to go here since it typically toggles between existence and non existence or two values. Where when using tags that replace another tag the new toggle or cycle is more logical.

Regards
Tones 

ludwa6

unread,
Dec 30, 2020, 3:26:51 AM12/30/20
to TiddlyWiki
Looks like an elegant solution, Tones, that Toggle operator... If only i was able to run that latest TW version that enables it.  
Because of this conflict between TW v5.1.23 and the Stroll plugin (on which i rely), alas, i am having to stick w/ TW v5.1.22 until it's resolved.  

Fortunately, as explained in a previous thread,  Zak has pointed me to a solution -i.e. "tm-remove-tag" - that works... Except "FieldMangler Widget" that is the message hander requires a button to make it work, which makes my current solution slightly less elegant (as evidenced by screenshot i've shared in that thread), but it serves my purposes for now.

I do look forward to getting on TW v5.1.23, soon as Stroll plugin is updated, and will try out that Toggle operator as soon as this comes to pass.  Thanks for the pointer, Tones!

/walt

Sylvain Naudin

unread,
Dec 30, 2020, 3:56:57 AM12/30/20
to TiddlyWiki
Hello Ludwa6,

FYI, I think the video source is from the doc https://tiddlywiki.com/#TaskManagementExample, and there is an enhanced version here : https://tiddlywiki.com/#TaskManagementExample%20(Draggable).

I agree with you, when I use this simple checkbox task manager, I don't want to see the first tag.
Maybe you can replace it with a field filter (and take opportunities to put some useful information).

<$list filter="[!has[draft.of]has:field[task]!tag[done]sort[created]]">


Sylvain

Sylvain Naudin

unread,
Dec 30, 2020, 4:04:18 AM12/30/20
to TiddlyWiki
(On the other hand here we don't use the Task tag at all).

Or deal with field to modify statut, like this example : https://tiddlywiki.com/#CheckboxWidget (see Fied mode example).


Regards,
Sylvain

ludwa6

unread,
Dec 30, 2020, 5:39:00 AM12/30/20
to TiddlyWiki
Thanks, Sylvain; this is interesting:  digging into those CheckboxWidget docs, i discovered that this widget has an "actions" attribute that can contain an ActionWidget such as "action-sendmessage"... Which could be a message like "tm-remove-tag", if i'm reading this right.  Yes?

So: i've been playing with some script like:
          <$action-sendmessage $message="tm-remove-tag" $param="ToDo"/>
and slight variations on that, embedded in different places within the CheckboxWidget code (since i don't know what i'm doing, obviously :-), but no joy as of yet. 

Good thing is, none of my experiments have broken anything; code fails gracefully, the interpreter just seems to ignore it, until i finally get something right. Someday, maybe!

/walt

scot

unread,
Dec 30, 2020, 9:32:03 AM12/30/20
to TiddlyWiki
Hello Everyone,
Maybe this topic could offer a solution.

Scot

Sylvain Naudin

unread,
Dec 30, 2020, 10:10:17 AM12/30/20
to TiddlyWiki
Hi Ludwa6,

When the documentation says that you can indeed invoke a string containing ActionWidgets, I wonder what the syntax is.
Going back to the genesis of evolution in 5.1.20, I found a post by Mohammad that used this with the help of a macro (but if someone can tell us how to do directly, that would be good).

For curiosity, I've added this short macro :

\define undone-actions()
<$action-sendmessage $message="tm-notify" $param="SampleNotification"/>
\end

And on my uncheck filter :

<$list filter="[!has[draft.of]has:field[task]tag[done]sort[created]]">

<$checkbox tag="done" actions=<<undone-actions>> > ~~<$link/>~~</$checkbox>

</$list>


So when I uncheck, I've now the content of SampleNotification tiddler show in the box notification, nice.

(PS : I don't think you can use tm-remove-tag since according to the doc it's with FieldManglerWidget, not ActionWidgets).

This does not answer the question, but with the use of a field rather than a tag, there is no need to delete it ;)


Sylvain

odin...@gmail.com

unread,
Dec 30, 2020, 12:25:18 PM12/30/20
to TiddlyWiki
" When the documentation says that you can indeed invoke a string containing ActionWidgets, I wonder what the syntax is. " 

I have wondered the same thing before. I would love to see this example in the documentation. Because I tried it like this, and I couldn't figure it out: " $action-sendmessage $message="tm-notify" $param="SampleNotification" " 
 
Op woensdag 30 december 2020 om 16:10:17 UTC+1 schreef sil...@gmail.com:

TW Tones

unread,
Dec 30, 2020, 6:45:34 PM12/30/20
to TiddlyWiki
Sylvain et al.. 

A dump of related methods/knowledge

The common way of creating a string containing actions widgets is in a macro;
\define myactions()
<$action....
<$action....
etc...
\end

Then use actions=<<myactions>>
or <$button ...
<<myactions>>
</$button>

Actions always need a trigger, the most common being a button. Because this is the case the Button widget also supports messages and actions.
  • Action send message is a way to to do the same as message= in a button, in a separate action.
  • Some messages need to be wrapped in a fieldmangler widget to work https://tiddlywiki.com/#FieldManglerWidget 
    • ie add/remove fields and tags
Inside a button you can use a list widget to programaticaly generate actions widgets or a call to action widget macros for each tiddler in a list, thus the button can be used to trigger actions that apply to many tiddlers.

A list of buttons
<$list..
<$button.. actions=
<<actions>>
</$button>
</$list>

A button that operates on a list
<$button..
<$list..
<<actions>>
</$list>
</$button>

Finally, The new toggle operator can be simulated using two buttons, with only one visible at a time. The two state on/off can invoke as many actions as you want. Adding, removing logging, messaging etc... Buttons are superior to checkboxes in many ways, and the icon could be a checkbox (ticked/unticked) to look like one anyway.

Tones

Saq Imtiaz

unread,
Dec 30, 2020, 7:10:46 PM12/30/20
to TiddlyWiki
@ludwa If I have understood the problem correctly, that you need to remove the ToDo tag when the checkbox is used, this should do the trick on 5.1.22:

\define markCompletedActions()
<$action-listops $tags="-ToDo"/>
\end

<$list filter="[!has[draft.of]tag[task]!tag[Completed]sort[created]]">

<$checkbox tag="Completed" checkactions=<<markCompletedActions>>> <$link to={{!!title}}>
<$view field="created" format="date" template="DDth mmm hh:mm"/> - <$view field="title"/>
</$link>
</$checkbox>

</$list>

Hope this helps.
Regards,
Saq

ludwa6

unread,
Dec 31, 2020, 12:56:34 AM12/31/20
to TiddlyWiki
@saq: Your solution is a perfect fit, & works like a champ; thanks, man!

@tones: Thanks for the explainer, which answers some things i've been wondering about.

How wonderful it is to have a place where one can go for both a takeaway meal AND a cooking lesson, all in one go :-)

/walt

Sylvain Naudin

unread,
Dec 31, 2020, 3:11:55 AM12/31/20
to TiddlyWiki
Thanks Tony for the confirmation that you have to go through a macro, so my try was successful.

And indeed thank you Saq for this example, it allows you to learn every day!

Sylvain

Saq Imtiaz

unread,
Dec 31, 2020, 3:58:43 AM12/31/20
to TiddlyWiki
@sylvain

A macro is not necessary, but often easier to read and less worries about using the right quotes, especially when using a longer sequence of actions.

The code I posted above is equivalent to:

<$list filter="[!has[draft.of]tag[task]!tag[Completed]sort[created]]">

<$checkbox tag="Completed" checkactions="""<$action-listops $tags="-ToDo"/>"""> <$link to={{!!title}}>
<$view field="created" format="date" template="DDth mmm hh:mm"/> - <$view field="title"/>
</$link>
</$checkbox>

</$list>

A macro simply substitutes the actions in the right place in this usage pattern.

Sylvain Naudin

unread,
Dec 31, 2020, 5:42:13 AM12/31/20
to TiddlyWiki
Thank you Saq for this complement :)

It's perfect now.
Reply all
Reply to author
Forward
0 new messages