SelectionEvaluate does not run in sequence
- To: mathgroup at smc.vnet.net
- Subject: [mg21056] SelectionEvaluate does not run in sequence
- From: "Roger Wilson" <roger.wilson at nomura.co.uk>
- Date: Sun, 12 Dec 1999 23:51:21 -0500 (EST)
- Organization: Nomura
- Sender: owner-wri-mathgroup at wolfram.com
I'm trying to generate a set of reports in html. I have a controlling notebook which runs through a set of files in a loop, setting a filename variable, selecting another notebook and using SelectionEvaluate to run that. The problem I'm encountering is that SelectionEvaluate does not inset the new tasks into Mathematica's task list at the point its encountered but appends them on the end. This means if I have six files, the filename is changed six times, the other notebook is selected six times and told to execute but it doesn't actually do anything until the loop exists. When this happens the other notebook runs six times but always with the last filename becuase the loop exists before the evaluations of the other notebook made by SelectionEvaluate actually run. DoStuff[filename_] := Module[{}, myfilename = filename; SelectionMove[main, All, Notebook]; SelectionEvaluate[main];] Do[ DoStuff[files[[i]]], {i, 1, Length[files]}] main is a notebook I want to execute that uses myfilename as an input. files is a list of filenames. Any ideas, comments or laughter? Roger Wilson