MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How do I script the evaluation of a Notebook

  • To: mathgroup at
  • Subject: [mg30532] Re: How do I script the evaluation of a Notebook
  • From: "Allan Hayes" <hay at>
  • Date: Tue, 28 Aug 2001 04:54:36 -0400 (EDT)
  • References: <9m6ted$l8f$>
  • Sender: owner-wri-mathgroup at

You need the FrontEnd Token, "EvaluateNotebook":

nbe =
Notebook[{Cell["2+3", "Input"] },
    WindowTitle -> "temp"

nbo = NotebookPut[nbe];


For more on FrontEnd tokens see "The Beginner's Guide to Mathematica Version
4, by  Jerry Glynn and Theodore Gray.

Allan Hayes
Mathematica Training and Consulting
Leicester UK
hay at
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Matthew D. Langston" <langston at SLAC.Stanford.EDU> wrote in message
news:9m6ted$l8f$1 at
> How do I script the evaluation of a Notebook?
> I'd like to programmatically evaluate a Notebook multiple times in a loop.
> Although I don't know how to write it, here is the Mathematic pseudo-code
> that I'd like to learn how to write:
> nb = NotebookOpen["foo.nb"]
> Do[NotebookEvaluate[nb], {myVar,4}]
> I made up the name "NotebookEvaluate" because it is not a real Mathematica
> function, but it does describe what I want to do.  Is there a function in
> Mathematica that takes a Notebook expression and evaluate the entire
> Notebook?  Thanks for your help.
> Regards, Matt
> --
> Matthew D. Langston
> SLD, Stanford Linear Accelerator Center
> langston at SLAC.Stanford.EDU

  • Prev by Date: Re: Notebook contents
  • Next by Date: Anderson-Darling Test
  • Previous by thread: Re: How do I script the evaluation of a Notebook
  • Next by thread: Random often fails to return a result