MathGroup Archive 2012

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

Search the Archive

Re: Evaluation of a whole notebook from another one

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127571] Re: Evaluation of a whole notebook from another one
  • From: awnl <awnl at gmx-topmail.de>
  • Date: Sat, 4 Aug 2012 21:46:55 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <jvitc7$32n$1@smc.vnet.net>

Am 04.08.2012 12:26, schrieb Dr. Robert Kragler:
> Hi,
>
> I have a simple question:
>
> There is a nb-file, say "Source.nb", which is called and should be evaluated as
> a whole (containing several procedures in a group of input cells) from another
> nb-file, say "Application.nb" which needs these procedures for further
> calculations.
>
> Within "Application.nb" the notebook "Source.nb" is correctly opened and pops up
> by NotebookOpen["filepath\Source.nb"]. It is, of course, possible to evaluate
> the cell group manually but the idea is to do this automatically and then return
> after evaluation to the calling nb-file "Application.nb" and close "Source.nb"
> using NotebookClose["filepath\Source.nb"].
>
> I miss a command such as NotebookEvaluate[...]. The commands EvaluationNotebook
> and SelectionEvaluate are not just doing what I want. Suggestions are appreciated.
>
> R. Kragler
>

Which version are you using? Since Version 8 there is exactly that function:

?NotebookEvaluate
NotebookEvaluate[notebook] evaluates all the evaluatable cells in 
notebook. >>

On the other hand, I'm almost sure that it's not the best possible way 
to have your "library" in the form of a notebook to be evaluated. Maybe 
you want to have a look at how to organize your code into package-files 
with proper use of Contexts (or namespaces), see e.g. the documentation 
of BeginPackage and EndPackage...

hth,

albert



  • Prev by Date: How to swap two elements of a list
  • Next by Date: Re: Evaluation of a whole notebook from another one
  • Previous by thread: Fwd: Evaluation of a whole notebook from another one
  • Next by thread: Re: Evaluation of a whole notebook from another one