BookmarkSubscribeSubscribe to RSS Feed
lwx228

Frequent Contributor

Joined:

Aug 14, 2018

How do write code in JSL to call another JSL?

Hello everyone!
In  AAA.jsl, how do  write code that calls another JSL to continue running: for example, this another JSL is  BBB.jsl with the same path


When BBB. jsl finished, AAA. JSL continues to run the rest of the code.

thanks you!

6 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Re: How do write code in JSL to call another JSL?

Use the 

     Include();

function.

I strongly advise that you spend time and read the Scripting Guide

     Help==>Books==>Scripting Guide

 

Jim
lwx228

Frequent Contributor

Joined:

Aug 14, 2018

Re: How do write code in JSL to call another JSL?


This seems to work,

where bbb. JSL only performs 2 files at a time, and moves the resulting file to another path in a timely manner, with code to clear the variable:
Include("d:\BBB.jsl");Wait(0);
Include("d:\BBB.jsl");Wait(0);
Include("d:\BBB.jsl");Wait(0);
Include("d:\BBB.jsl");Wait(0);
Include("d:\BBB.jsl");Wait(0);
……



Clear Log(); Clear Globals(); Close All(DataTables,"No Save");


This reduces the number of automatic exits.
lwx228

Frequent Contributor

Joined:

Aug 14, 2018

Re: How do write code in JSL to call another JSL?


Please consult experts:


What else should you pay attention to in JSL, such as freeing memory and erasing variables?Thank you!

Except the following:Clear Log(); Clear Globals(); Close All(DataTables,"No Save");
Highlighted
txnelson

Super User

Joined:

Jun 22, 2012

Re: How do write code in JSL to call another JSL?

Clear symbols();
Jim
gzmorgan0

Community Trekker

Joined:

Jul 25, 2016

Re: How do write code in JSL to call another JSL?

Jim provided the correct answer, but this blog took another turn.

 

I recommend that you investigate scoping, specifically Names Default to Here() and New Context when working with Include();

 

Without proper scoping, clear symbols() could lead to unwarranted behavior.  

 

You likely do not need this, but as an FYI, Run Program() can be used to create a new instance of JMP and execute a script or commands, then return to your session.  There is no sharing of data or variables.

 

lwx228

Frequent Contributor

Joined:

Aug 14, 2018

Re: How do write code in JSL to call another JSL?

Well, Thanks for the way. I'll write them to BBB.jsl.