Re: Launch notebook in FE and evaluate it immediately
- To: mathgroup at smc.vnet.net
- Subject: [mg92360] Re: Launch notebook in FE and evaluate it immediately
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Mon, 29 Sep 2008 07:06:22 -0400 (EDT)
- References: <gbmpnr$i4e$1@smc.vnet.net>
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