MathGroup Archive 2003

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

Search the Archive

Controlling order of evaluation - SelectionEvaluate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40477] Controlling order of evaluation - SelectionEvaluate
  • From: stone at geology.washington.edu (John Stone)
  • Date: Mon, 7 Apr 2003 04:55:32 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

I see from the archives and WRI online help that this is a common
problem, but I cannot find a solution that works (or I am missing
something).

I am trying to write a sequence of Mathematica commands to open and
manipulate notebooks that contain data.  What I want to do requires a
long sequence of NotebookOpen, NotebookFind, NotebookWrite,
NotebookDelete, etc commands.  Among these are a SelectionEvaluate
command to read input from the notebook being edited, a NotebookWrite
command that copies input from a separate notebook containing function
definitions, and a SelectionEvaluate command to apply those functions
to input from the notebook being edited.

I initially embedded the sequence of notebook manipulation commands in
a Do[...] statement.  I discovered (as have many others, it turns out)
that this does not cause the SelectionEvaluate commands to be
evaluated in the order they appear among the notebook manipulation
commands.

I can perform the desired sequence of operations by splitting them
into three or four subgroups in separate cells, and evaluating those
cells sequentially.  However, if I group those cells and evaluate them
all at once, I get the same problem as if they were enclosed within a
Do[...] statement.

I have tried 'wrapping' each of the SelectionEvaluate commands with
ToExpression[...] (as suggested in
http://support.wolfram.com/mathematica/kernel/interface/selectionevaluate.html)
to "force" evaluation, but this does not seem to have solved the
problem.

Is there a way to force Mathematica to evaluate a sequence of notebook
manipulation commands in the order they are written?  When trying to
perform a sequence of notebook tasks, is there an alternative to
embedding the commands inside a Do[..] statement?  Would it help to
enclose each command in my sequence inside a ToExpression[...]
statement?

Thanks in advance,

John Stone
stone at geology.washington.edu


  • Prev by Date: Re: Combinatorical efficiency
  • Next by Date: Re: Re: Combinatorical efficiency
  • Previous by thread: Re: Re: NDSolve error: "Cannot find starting value for the variable x"
  • Next by thread: arrows at both ends of a line?