f



How to call or run a NB file in another NB file?

Hi guys,


I met a problem, in ABC.nb , I need to run XYZ.nb, is there any
function to execute the XYZ.nb in ABC.nb?

cheers,

leo

0
7/23/2008 10:21:57 AM
comp.soft-sys.math.mathematica 28821 articles. 0 followers. Follow

5 Replies
610 Views

Similar Articles

[PageSpeed] 12

Leo.Chen wrote:
> I met a problem, in ABC.nb , I need to run XYZ.nb, is there any
> function to execute the XYZ.nb in ABC.nb?

Make the vital lines in XYZ.nb "Initialization" cells then
save it to create XYZ.m this can now be run with the "Get"
or "Needs" function as a Package

<<XYZ`

you will probably want it in the same directory as your current
notebook; Mathematica won't look there unless you tell it; I find
this useful for doing that - the current notebook (ABC.nb in your
case) needs to have been saved.

SetDirectory[ToFileName@("FileName"/.NotebookInformation[EvaluationNotebook[]]/.{"FileName"->""})[[1]]]

Robert

0
7/24/2008 8:51:08 AM
Hi,

this is total useless, write a package with the code
of XYZ.nb and load the package in ABC.nb

Regards
   Jens

Leo.Chen wrote:
> Hi guys,
> 
> 
> I met a problem, in ABC.nb , I need to run XYZ.nb, is there any
> function to execute the XYZ.nb in ABC.nb?
> 
> cheers,
> 
> leo
> 

0
kuska (2791)
7/24/2008 9:05:24 AM
On Jul 23, 3:21 am, "Leo.Chen" <leo.chen...@gmail.com> wrote:
> Hi guys,
>
> I met a problem, in ABC.nb , I need to run XYZ.nb, is there any
> function to execute the XYZ.nb in ABC.nb?
>
> cheers,
>
> leo

Leo,

Here the command that you need to execute from ABC.nb:

nb=NotebookOpen["path_to_file_XYZ\\XYZ.nb",Visible->True];
FrontEndExecute[{FrontEndToken[nb,"EvaluateNotebook"]}];

GS

0
vokaputs (17)
7/25/2008 10:19:47 AM
On Jul 25, 4:19 am, GS <vokap...@gmail.com> wrote:
> On Jul 23, 3:21 am, "Leo.Chen" <leo.chen...@gmail.com> wrote:
>
> > Hi guys,
>
> > I met a problem, in ABC.nb , I need to run XYZ.nb, is there any
> > function to execute the XYZ.nb in ABC.nb?
>
> > cheers,
>
> > leo
>
> Leo,
>
> Here the command that you need to execute from ABC.nb:
>
> nb=NotebookOpen["path_to_file_XYZ\\XYZ.nb",Visible->True];
> FrontEndExecute[{FrontEndToken[nb,"EvaluateNotebook"]}];
>
> GS

This opens the notebook and runs it, but shows the output in it's
notebook, not the notebook that the command ran in. The impression I
got from Leo's question was that he wanted the output to show in the
first notebook, not the second.

So, Leo, where did you want to see the output appear?

-Bob

0
deepyogurt (166)
7/27/2008 6:43:56 AM
GS,

thanks,

yes, the previous replies can solve my problem,

I need XYZ.nb run from ABC.nb, and XYZ outputs in XYZ.nb.

cheers,

leo

2008/7/27 Bob F <deepyogurt@gmail.com>:
> On Jul 25, 4:19 am, GS <vokap...@gmail.com> wrote:
>> On Jul 23, 3:21 am, "Leo.Chen" <leo.chen...@gmail.com> wrote:
>>
>> > Hi guys,
>>
>> > I met a problem, in ABC.nb , I need to run XYZ.nb, is there any
>> > function to execute the XYZ.nb in ABC.nb?
>>
>> > cheers,
>>
>> > leo
>>
>> Leo,
>>
>> Here the command that you need to execute from ABC.nb:
>>
>> nb=NotebookOpen["path_to_file_XYZ\\XYZ.nb",Visible->True];
>> FrontEndExecute[{FrontEndToken[nb,"EvaluateNotebook"]}];
>>
>> GS
>
> This opens the notebook and runs it, but shows the output in it's
> notebook, not the notebook that the command ran in. The impression I
> got from Leo's question was that he wanted the output to show in the
> first notebook, not the second.
>
> So, Leo, where did you want to see the output appear?
>
> -Bob
>
>

0
7/29/2008 5:48:10 AM
Reply: