Re: How to close down the front end from a 3.0 notebook ?
- To: mathgroup at smc.vnet.net
- Subject: [mg41365] Re: How to close down the front end from a 3.0 notebook ?
- From: Rolf Mertig <rolf at mertig.com>
- Date: Fri, 16 May 2003 06:43:26 -0400 (EDT)
- Organization: Mertig Consulting
- Reply-to: rolf at mertig.com
- Sender: owner-wri-mathgroup at wolfram.com
>> >> Here's the problem: I need to save my work and close the front end from >> within a notebook. Strictly speaking, closing down the front end is not >> essential. What I need to do is to save my notebook, close down the kernel, >> and close the notebook, all using kernel or front end commands in the >> notebook (i.e. with no keyboard input). Is there a way to do this in >> version 3.0 ? >> ... >> Basically, my notebook looks as follows... >> ... lots of stuff deleted ... >> NotebookSave[SelectedNotebook[]]; >> Exit[]; >> NotebookClose[SelectedNotebook[]]; >> Of course, the problem is that once you do Exit[], there is no kernel left >> to do NotebookClose. >> ... > > > >I was able to do this successfully with the code > >(NotebookSave[EvaluationNotebook[],"savedNotebook.nb"]; > NotebookClose[EvaluationNotebook[]];Exit[];) > >I think the front end sends the entire expression to the kernel before >evaluation is done, so once it is all sent to the kernel, there is no >more need for the notebook, and the Exit[] gets executed. >-- >----------------------------- >Dick Zacher This seems to close down the FrontEnd completely (on Linux and Windows, 3.0, 4.1, 4.2): (NotebookClose/@Notebooks[];FrontEndTokenExecute["FrontEndQuit"];Quit[]) Rolf Mertig Mertig Consulting http://www.mertig.com http://www.mathxls.com