MathGroup Archive 2001

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

Search the Archive

Re: How do I script the evaluation of a Notebook


Matt,
You need the FrontEnd Token, "EvaluateNotebook":

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

nbo = NotebookPut[nbe];

FrontEndExecute[{FrontEndToken[nbo,"EvaluateNotebook"]}]


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

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
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 smc.vnet.net...
> 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