Re: Notebook manipulation
- To: mathgroup at smc.vnet.net
- Subject: [mg32843] Re: Notebook manipulation
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 15 Feb 2002 02:49:41 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <a4fnja$j3c$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
add a
NotebookWrite[nb, "NotebookSave[SelectedNotebook[],\"notebook.nb\"]",
All];
SelectionEvaluateCreateCell[nb, Before];
to your code and the output *is* present.
Try
nb = NotebookCreate[];
(*nb = SelectedNotebook[];*)
NotebookWrite[nb, "10!", All];
SelectionEvaluateCreateCell[nb, All];
NotebookApply[nb, "\[SelectionPlaceholder]/2", All];
SelectionEvaluateCreateCell[nb, Before];
NotebookWrite[nb, "NotebookSave[SelectedNotebook[],\"notebook.nb\"]",
All]; \
SelectionEvaluateCreateCell[nb, Before];
(*NotebookSave[SelectedNotebook[], "notebook.nb"];*)
(*NotebookPrint[nb,
"/home/rmason/test.ps",
PrintingStyleEnvironment -> "Printout"];*)
(*NotebookClose[nb];*)
Regards
Jens
Roger Mason wrote:
>
> Hello,
>
> Firstly, thanks to Paul Hinton of WRI for his help with my last
> question.
>
> Secondly, I have been attempting to use the notebook manipulation
> functions to get some output written into a notebook that is created by
> the kernel. The idea is then to save or print the new notebook. By
> following section 2.10.3 of the on-line help, I have been able to write
> data into the new notebook and perform evaluation on the data. However,
> on saving or printing the new notebook the output cells are never
> present.
>
> Clearly, I am missing something. What am I doing wrong? Some code is
> appended.
>
> Thanks,
>
> Roger Mason.
> Mathematica 4.0, Linux RH7.0.
>
> nb = NotebookCreate[];
> (*nb = SelectedNotebook[];*)
> NotebookWrite[nb, "10!", All];
> SelectionEvaluateCreateCell[nb, All];
> NotebookApply[nb, "\[SelectionPlaceholder]/2", All ];
> SelectionEvaluateCreateCell[nb, Before];
> NotebookSave[nb, "notebook.nb"];
> (*NotebookPrint[nb, "/home/rmason/test.ps",
> PrintingStyleEnvironment -> "Printout"];*)
> NotebookClose[nb];