Re: How write output to another notebook?[another way[
- To: mathgroup at smc.vnet.net
- Subject: [mg27857] Re: How write output to another notebook?[another way[
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Thu, 22 Mar 2001 04:30:00 -0500 (EST)
- References: <98vi9q$91l@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Murray, Here is another way to get generated cells produced by evaluating cells in notebook nb1 into notebook nb2, instead of nb1. This way uses an temporary intermediate invisible notebook, nb3 that is created and deleted with each transfer. If this seems unacceptable then it could be left, emptied each time and deleted at the end of the session. nb1= InputNotebook[]; nb2 = NotebookCreate[]; WriteOutput[nb1_,nb2_]:= With[{nb1aa=nb1,nb2aa=nb2}, $Pre=Module[{nb3}, Function[x, If[EvaluationNotebook[]=== nb1aa, nb3= NotebookCreate[Visible\[Rule]False]; NotebookWrite[nb3,Cell[BoxData[ MakeBoxes/@Unevaluated[ {x, SelectionMove[nb3,All, GeneratedCell]; NotebookWrite[nb2aa, NotebookRead[nb3]]; NotebookClose[nb3] }]], "Input"], All]; SelectionEvaluateCreateCell[nb3]; $Line--; , x ], HoldAll] ] ]; WriteOutput[nb1,nb2]; Test {a^b+2 +3, Print[123], 1/0,Plot[x,{x,0,1}], StylePrint["cell text"]} -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565