On every nth (2) evaluation autoEval
should invoke a function check[]
. The thing which is supposed to listen for all Notebook Kernel Evaluation
-s is this CellEvaluationFunction :> (check[])
. I also tried and failed with SetOptions[nb,$Pre:>(check[])];
and SetOptions[nb,CellProlog:>(check[])];
and SetOptions[nb,CellEpilog:>(check[])];
. All producecd same message that evaluation symbols given are
not options of notebook object. Please help!
I prefer using TaggingRules
for keeping persistent values but I could not get those to work either. If you think you have a better solution I'm all ears.
autoEval[ ] := NotebookAutoBackup[2]
autoEval[ n_Integer /; n > 0, objname_String : "autoback",
objloc_ : "Local"] := Block[{nb = EvaluationNotebook, x = 0},
check[] := (++x;
If[x == n, (Echo@n; Print["check[]"];
PersistentSymbol[objname, objloc] = 0),
PersistentSymbol[objname, objloc] = x]; Echo@x);
(*SetOptions[nb,CellEvaluationFunction:>(check[])];*)
CellEvaluationFunction :> (check[])
];
autoEval[]