Re: Executing external notebook
- To: mathgroup at smc.vnet.net
- Subject: [mg92797] Re: Executing external notebook
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Mon, 13 Oct 2008 07:05:05 -0400 (EDT)
Hi, what you wrote indeed looks, as if you need to make a custom package. In this case you have already got answers from David Park, Tyler and /Peter Pein/. However, if for whatever reason you do not want to transform common.nb into a package, but in contrast, you need to leave common.nb as a simple notebook with the same status as that of your other notebooks you may try the following. Include into your notebooks main1.nb, ... , main5.nb three commands nb1 = NotebookOpen[ "Full_path_to_your\common.nb"] (* this opens your common.nb notebook and gives it the name nb1 *) FrontEndTokenExecute[nb1, "SelectAll"] (* this selects all cells in the common.nb *) FrontEndTokenExecute[nb1, "EvaluateCells"] (* This evaluates all selected cells of the notebook common.nb *) If you always execute all the notebooks main1.nb, ... , main5.nb in the same sequence, the above commands may be included only once into the main-notebook executed first in the sequence. Further, it is clear that these commands must appear in the notebooks main1.nb, ... , main5.nb before the place in which the results of the notebook common.nb are first used. Have a success, Alexei I have a really trivial question, but nevertheless am stuck. Within a notebook file, how do I execute an external notebook and keep all the results in memory? For example I have 5 files, main1.nb main2.nb main3.nb main4.nb main5.nb each of which must call common.nb which contains code that is common to all 5 main files. It seems like this should be easy to do but I cannot find an appropriate command (Get seems like it is intended for this purpose, but perhaps I am not using it correctly). -- Alexei Boulbitch, Dr., Habil. Senior Scientist IEE S.A. ZAE Weiergewan 11, rue Edmond Reuter L-5326 Contern Luxembourg Phone: +352 2454 2566 Fax: +352 2454 3566 Website: www.iee.lu This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.