I stripped a Dynamic down to its bare essentials. Dynamic doesn't execute any of the functions asked for in second argument. Once the countdown completes a cycle (recurring Clock) it should at a minimum do (Ding[]; NotebookSave[];) however ideally I would prefer it did all of this (Ding[]; NotebookSave[]; x = "saved"; Pause[3]). Please help me solve this.
countdown[s_ : 10, n_ : 3] = Dynamic[s - Clock[{0, s, 1}, s, n]];
Ding[v_ : 3/5] :=
Quiet@EmitSound[
Sound[{SoundNote["G#6", .3, "Marimba", SoundVolume -> v]}]];
DynamicModule[
{s = 6, n = 3, t, x},
t = countdown[s, n];
Dynamic[x,
If[t == 0, (Ding[]; NotebookSave[]; x = "saved"; Pause[3]),
#] &, Initialization :> (x = t), TrackedSymbols :> {x, t}]
]
Dynamicis called only "during interactive changing or editing." There is no interactive changing or editing here. (2)tdisplays as an integer, but its head isDynamic. Sot == 0is neverTrueand neverFalse. UseSetting[t] == 0instead. But it never gets executed here because of point (1). – Michael E2 Sep 26 '21 at 14:03