Re: Multiple Notebook Execution

*To*: mathgroup at smc.vnet.net*Subject*: [mg125190] Re: Multiple Notebook Execution*From*: Szabolcs <szhorvat at gmail.com>*Date*: Mon, 27 Feb 2012 06:41:36 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <jictpv$eog$1@smc.vnet.net>

On Sunday, 26 February 2012 11:25:19 UTC+2, Harker, Anthony wrote: > Suppose I have a directory full of Mathematica notebooks, each a student's answer to a classwork assignment. What I'd like to do is to load each notebook in turn, execute it in the front end, and print the result to a PDF for grading. Of course, for each assignment I want a fresh kernel, to ensure that one student's assignments of variables or definitions of functions do not come back to bite another student. Is it possible to do all of this from the front end, by cunning use of environments for example, or can it only be done by scripting outside Mathematica? > > Tony Harker You can do this from within Mathematica. An almost complete solution is here: http://stackoverflow.com/a/8659069/695132 What you need to change: UsingFrontEnd[] is not necessary because you probably won't be working from the command line. NotebookSave can be changed to Export[..., "PDF"] to save as PDF. You'll need to write code to loop through all notebooks and do this for all of them (see FileNames[])