0

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

Ale1794
  • 525
  • 3
  • 10
  • 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. – b3m2a1 Jun 06 '17 at 14:47
  • @b3m2a1 Is there a way to automatic enable Dynamic? – Ale1794 Jun 06 '17 at 14:50
  • You'll understand that is a security risk, so short of placing the notebook in a trusted directory, no. – b3m2a1 Jun 06 '17 at 14:51
  • 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 – Ale1794 Jun 06 '17 at 14:53
  • Oh I thought you knew to place it in the NotebookDynamicExpression or similar. Sorry about that. – b3m2a1 Jun 06 '17 at 14:55
  • @b3m2a1 writing this NotebookDynamicExpression[ FrontEndTokenExecute["EvaluateInitialization"]]; , I still have a loop – Ale1794 Jun 06 '17 at 15:00
  • 1
    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. – b3m2a1 Jun 06 '17 at 15:02
  • See search InitializationCellEvaluation and let us know what is missing. – Kuba Jun 06 '17 at 15:20

0 Answers0