[Date Index] [Thread Index] [Author Index]
On 12 Jan 1998, P.J. Hinton wrote: > On 8 Jan 1998, Axel Kowald wrote: > > > I would like to use Mathematica 3.0 on our Linux system to run some of > > my notebooks in the background. Normally, I would mark the cells I want > > to be evaluated as initialization cells and then type a command line > > like: > > > > math -batchoutput < test.nb & > > > > Unfortunately I keep getting the error message: "Cannot initialize Motif > > window graphic". > Notice that the entire notebook file now looks like a Mathematica > expression. On the good side, this enables you to manipulate notebooks > within the kernel. However, it makes it impossible to use notebooks as > batch inputs. > > QUALIFICATION: You could write a sophisticated program to scan through > the Notebook expression (since it contains a list) and use > MakeExpression on the contents of Input cells which have the option > InitializationCell->True and then do the evaluation, but this is left > as an exercise for the ambitious student :-). An alternative approach, that I neglected to mention in the previous post, is to use the automatic package generation capabilities of the front end. To take advantage of this, you can do the following: 1) On the front end menu bar, click on Edit -> Preferences to bring up the Option Inspector dialog box. 2) Enter the following text in the Lookup line of the Option Inspector dialog box: AutoG This expands the Notebook Option|FileOptions subsections to reveal an option called AutoGeneratedPackage. Change this value from its default of Manual to Automatic. 3) Close the Option Inspector dialog box. Now, when you attempt to save a notebook with initialization cells, the front end will automatically create a companion file with the same base filename but with a .m extension. This package file contains the contents of the initialization cells in InputForm, and it should be suitable for batch input into the kernel. -- P.J. Hinton Mathematica Programming Group email@example.com Wolfram Research, Inc. http://www.wolfram.com/~paulh/ Disclaimer: Opinions expressed herein are those of the author alone.