0
$\begingroup$

How can I start an evaluation of the initialization cells when a notebook is opened? Should I use FrontEndExecute[] in some way?

$\endgroup$
  • $\begingroup$ You can do this with FrontEndTokenExecute["EvaluateInitialization"] but note that even if you make this Dynamic you will still need to enable Dynamic for that notebook before it will work. $\endgroup$ – b3m2a1 Jun 6 '17 at 14:47
  • $\begingroup$ @b3m2a1 Is there a way to automatic enable Dynamic? $\endgroup$ – Ale1794 Jun 6 '17 at 14:50
  • $\begingroup$ You'll understand that is a security risk, so short of placing the notebook in a trusted directory, no. $\endgroup$ – b3m2a1 Jun 6 '17 at 14:51
  • $\begingroup$ By the way, placing FrontEndTokenExecute["EvaluateInitialization"] a the beginning of the notebook, cause a "running" loop when i click evaluate initialization cells from the menu $\endgroup$ – Ale1794 Jun 6 '17 at 14:53
  • 1
    $\begingroup$ NotebookDynamicExpression is an option. Please read the documentation. This should not be in a cell as obviously that cell will be evaluated every time you run the initialization, which will re-run the initialization, etc. $\endgroup$ – b3m2a1 Jun 6 '17 at 15:02