Re: NotebookSave[] Bugs
- To: mathgroup at smc.vnet.net
- Subject: [mg20351] Re: NotebookSave[] Bugs
- From: "Dale Horton" <daleh at wolfram.com>
- Date: Sat, 16 Oct 1999 00:47:41 -0400
- Organization: Wolfram Research, Inc.
- References: <7tp7t4$98a@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Since Notebooks are valid kernel expressions, you can always try Put in place of NotebookSave. In fact, the whole operation can be done in the kernel. Module[{nb1=NotebookGet[InputNotebook[]],nb2}, Put[nb1, "withcelltagname.nb"]; nb2 = DeleteCases[nb1,Cell[__, CellTags->"CellTagName", ___], Infinity]]; Put[nb2, "nocelltagname.nb"]; ] -Dale Murphy <werner.schuster at netway.at> wrote in message news:7tp7t4$98a at smc.vnet.net... > yo MathGroup, > > I have a serious problem with the NotebookSave[] Functions; > I am using Mathematica 3.0; > > Anytime I call them, I get a "Why the beep", telling me that there was some > problem with the Notebook & that I should close the file & open it using > OpenSpecial; > the function seems to destroy the notebook, cause some cells turn white, > like they were not there; > it even crashes mathematica completely (I have to kill it via Taskmanager) > > this behaviour is reproducable and not only appearing on my Mathematica > installation, because I have already sent the following code to a > mathematica expert, he ran the code and told me tha he had'nt seen anything > like it before; > --- > Module[{nb=InputNotebook[],nb1}, > > NotebookSave[nb]; > NotebookSave[nb, "MurphyABC"]; > NotebookClose[nb]; > nb1 = NotebookOpen["MurphyABC"]; > > NotebookFind[nb1,"CellTagName", All, CellTags]; > NotebookDelete[nb1]; > --- > the problem is that Mathematica only gets til the NotebookSave[] functions, > and the shows the behaviour I described above; > > what I want to do with the code is to: > - somehow produce a copy of a notebook > - find all cells with a certain cell-tag in the copy > - delete all the cells with the cell-tag > > a previous attempt was to get the copy using this code: > --- > Module[{nb=InputNotebook[],nb1}, > nb1=NotebookPut[NotebookGet[nb]]; > NotebookFind[nb1,"CellTagName", All, CellTags]; > NotebookDelete[nb1]; > --- > > the notebook to copy is about 900 KB; > the problem with this code is that it takes about 126 seconds on my PC (100 > MHZ, 24 MB RAM, NT4.0); > even on a 200 MHZ Pentium with 64 MB RAM, this code still takes 25 seconds, > which is still way too slow; > the bottle neck is the NotebookGet/-Put functions; the finding & deleting > of the cells takes (on my PC) about 4 seconds; > > > my questions are: > > - does anybody know a way to copy a notebook in memory (like with > NotebookPut/-Get)? > AND/OR > - does anybody know a workaround for the NotebookSave bugs? > > > I hope you understand the babbling above and can help me; > Thanx in advance > > murphee > *************************************** > UNITE FOR JAVA -> www.javalobby.org > Check this out -> www.jos.org > My site -> www.angelfire.com/co/werners > *************************************** > ... and the fact, that i haven't put a gun to my mouth yet, > proves that i'm a winner! > Al Bundy >