Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8749 > unrolled thread

Multiple Notebook Execution

Started by"Harker, Anthony" <a.harker@ucl.ac.uk>
First post2012-02-26 09:25 +0000
Last post2012-02-27 11:43 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Multiple Notebook Execution "Harker, Anthony" <a.harker@ucl.ac.uk> - 2012-02-26 09:25 +0000
    Re: Multiple Notebook Execution Szabolcs <szhorvat@gmail.com> - 2012-02-27 11:43 +0000

#8749 — Multiple Notebook Execution

From"Harker, Anthony" <a.harker@ucl.ac.uk>
Date2012-02-26 09:25 +0000
SubjectMultiple Notebook Execution
Message-ID<jictpv$eog$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#8760

FromSzabolcs <szhorvat@gmail.com>
Date2012-02-27 11:43 +0000
Message-ID<jifq89$snj$1@smc.vnet.net>
In reply to#8749
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[])

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web