evaluates all the evaluatable cells in notebook.
- NotebookEvaluate returns the value returned by the last evaluation in the specified notebook.
- NotebookEvaluate can take either a NotebookObject or a file name referencing a notebook file. If a file name references a notebook that is presently open, then evaluation proceeds on the open notebook.
- The following options can be given:
InsertResults False whether to insert results in the notebook EvaluationElements All which cells to evaluate
- By default, NotebookEvaluate evaluates the cells of a notebook in the same way that Get evaluates the lines of a package file. Messages, print output, and other side effects will be placed as output to the cell that called NotebookEvaluate rather than the specified notebook. Existing output cells in the notebook will not be updated or deleted.
- NotebookEvaluate[notebook,InsertResults->True] evaluates the notebook as if all cells had been evaluated with Shift+Return. Messages, print output, and other side effects are placed in the notebook along with outputs.
- When NotebookEvaluate[notebook,InsertResults->True] is used on a file that is not open, the Wolfram System will invisibly open the file, evaluate it entirely, save, and close the file.
- NotebookEvaluate[notebook,InsertResults->False] will leave the notebook completely unmodified.
- The cells of the notebook are evaluated in a dialog subsession.
- Using NotebookEvaluate on an open notebook will cause the visible artifacts of subsession evaluation to occur in that notebook. The notebook will continue to be updated on-screen as necessary while its cells are being evaluated.
- Unlike Get, the presence of a syntax error in an evaluatable cell will not prevent NotebookEvaluate from evaluating other inputs.
- NotebookEvaluate[notebook,EvaluationElements->Automatic] evaluates only the initialization cells. This is equivalent to saving the notebook as a package file, or with an automatically generated package file, and using Get on the resulting package file.
- When run on a package file, NotebookEvaluate is equivalent to Get. The InsertResults option will be ignored.
Introduced in 2010