MathGroup Archive 2008

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

Search the Archive

Re: Launch notebook in FE and evaluate it immediately


Szabolcs Horv=E1t wrote:
> Is there a way to launch the front end and instruct it to do something
> *immediately*, without any user intervention?  For example, evaluate a
> notebook using the default kernel.
>
> Is there a way to do this, perhaps with a command line option?
>
> I know that this can be done with the kernel, but I would like to use
> the Front End---more specifically I would like to diff two notebooks
> using AuthorTools's NotebookDiff function.
>
This might be classed as a kludge, but it worked for me. Place the
output cell from the following at the front of your notebook:

Dynamic[Refresh[
   If[! ValueQ[alreadyDone],
    alreadyDone = True;
    SelectionMove[SelectedNotebook[], All, Notebook];
    SelectionEvaluate[SelectedNotebook[]]
    ], UpdateInterval -> 1
   ]
  ]

At first sight this would appear to fail for lengthy evaluations because
of the time limit on calculations triggered by dynamic. However, the
evaluation is queued and the Refresh finishes rapidly. I tested this by
simulating a lengthy program with a cell containing:

  DialogInput["Testing"]

This will normally run out of time if executed as part of a Dynamic.

Of course, there may be a much better, non-kludge way of doing this!

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Re: Defining a custom Leibnitz operator in Mathematica
  • Next by Date: Glitch in NumberFieldFundamentalUnits
  • Previous by thread: Launch notebook in FE and evaluate it immediately
  • Next by thread: Re: Launch notebook in FE and evaluate it immediately