Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Notebook Manipulation' topicStudent Support Forum > General > Archives > "Notebook Manipulation"

Next Comment >Help | Reply To Topic
Author Comment/Response
Alexander Peterhansl
01/24/01 09:31am

The function below creates a notebook, inserts some text, evaluates the text, then saves and closes the notebook:

experiment[] := Module[{nb},
nb = NotebookCreate[];
NotebookWrite[nb, ''1+2'', All];
SelectionEvaluateCreateCell[nb];
NotebookSave[nb, ''experiment.nb''];
NotebookClose[nb];
]

The problem is that ''1+2'' never gets evaluated as the notebook is saved before that happens. Is there a way to make sure that a command has been fully executed before the next command is invoked?
I would like to use the above function with commands that take MUCH longer to execute than 1+2 (on the order of 30 minutes).

URL: ,

Subject (listing for 'Notebook Manipulation')
Author Date Posted
Notebook Manipulation Alexander Pe... 01/24/01 09:31am
Re: Notebook Manipulation Forum Modera... 01/31/01 1:44pm
Next Comment >Help | Reply To Topic