From: Arturas Acus on 6 May 2010 04:51 Dear group, I have a large collection of notebooks I want to run in Mathematica FrontEnd authomatically. math < in > out solution is not applicable, because Notebooks contains commands like NotebookCreate[], etc.. I tried JLink solution, something like Needs["JLink`"]; $FrontEndLaunchCommand="mathematica -matlink -display :1 -nogui"; ConnectToFrontEnd[] Unfortunatelly, thought I can use commands like Plot*, it do not allow open notebooks in the connected FrontEnd. The only way I found to execute notebook in Mathematica FrontEnd authomatically is to set all notebook cells as initialization cells, then set the following options in the init.m file AutoOpenNotebooks->{"/home/acus/test.nb"}, InitializationCellEvaluation->True, InitializationCellWarning->False But this solution has drawback is that I have to execute different notebooks. Probably it could be solved creating some master notebook, which consequently opens and executes other notebooks. But may be somebody could suggest better way? Thanks in advance. Sincerely, -- Arturas Acus <arturas.acus(a)tfai.vu.lt>
From: David Bailey on 9 May 2010 07:50 Arturas Acus wrote: > Dear group, > > I have a large collection of notebooks I want to run in Mathematica FrontEnd authomatically. > > math < in > out solution is not applicable, because Notebooks contains commands like NotebookCreate[], etc.. > > I tried JLink solution, something like > Needs["JLink`"]; $FrontEndLaunchCommand="mathematica -matlink -display :1 -nogui"; ConnectToFrontEnd[] > Unfortunatelly, thought I can use commands like Plot*, it do not allow open notebooks in the connected FrontEnd. > > The only way I found to execute notebook in Mathematica FrontEnd authomatically is to set all notebook cells as initialization cells, then > set the following options in the init.m file > > AutoOpenNotebooks->{"/home/acus/test.nb"}, > InitializationCellEvaluation->True, > InitializationCellWarning->False > > But this solution has drawback is that I have to execute different notebooks. Probably it could be solved creating some master notebook, which > consequently opens and executes other notebooks. > > But may be somebody could suggest better way? Thanks in advance. > > > Sincerely, It would be easy to create a script of things you needed to do as a .m file. Such a file is much easier to execute automatically (with Get) and because it is a simple text file, it could even be partially constructed in a bash script. It could also use the Environment[] function for even greater flexibility. The leaves the little matter of starting the whole thing by command. There is a function UseFrontEnd which you can wrap around a sequence of operations that need the FE, and then execute the whole thing as input to Math. I executed the following using Math: UseFrontEnd[ nb=NotebookCreate[]; Print[nb]; ] Obtaining: In[1]:= NotebookObject[<<Untitled-1>>] This may do exactly what you want, but I would caution slightly that this is the sort of area in which Mathematica bugs seem to reside - so test it well with the kind of operation you want to do before committing to it! David Bailey http://www.dbaileyconsultancy.co.uk
|
Pages: 1 Prev: 3D imaging Next: Giving several functions the same argument |