Subscribe Bookmark RSS Feed

How can I force my script to execute sequentially?

lpatton

Community Trekker

Joined:

Oct 22, 2014

My current JSL script works perfectly when I step through it however, when executed it can throw up some errors.  I can handle this somewhat by putting the wait() function in but it doesn't always work.  Is there a simple function I can call out at the top of my script to make it execute sequentially?

5 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

The method that I use is to break the script into functional components, and then to have the control section of the script step through the script, and calling in the components when I need them.  I typically place the code into EXPR(() sections.  The code placed in EXPR() will not be execututed until called by the control section.

Jim
pmroz

Super User

Joined:

Jun 23, 2011

I put wait(0); statements between sections of code I want to execute sequentially.

Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

I'm sorry to hear that you're having trouble here.

Our goal is that you should never need a Wait() in order to make your script run. We do know that there are times when the various elements of the UI (windows, platforms, etc.) need a moment to get themselves fully instantiated before they can respond appropriately to the rest of your JSL. However, we want to address those situations internally so you don't have to worry about it in your JSL.

So, when you run across situations that are resolved by adding a Wait() into your code, please submit them to Tech Support, so we can track them and resolve them.

Thanks!

-Jeff

-Jeff
guy_yosef

Community Trekker

Joined:

Jul 16, 2014

i had several errors when running scripts automaticly, but when i tested them manually it was ok.

for those type of errors, it usually happen to me when i  try to do a plot base on wrong table

now i add  those lines before doing plots/charts in scripts

dt = Data Table( "data table xxx" ) ;

dt << Clear Select;

dt<<Bring Window To Front;

txnelson

Super User

Joined:

Jun 22, 2012

It is a best practice to pass to the data table a message of which platform to run, rather than having to keep track of which table is the current active table.  So rather than:

dt = Data Table( "data table xxx" ) ;

dt << Clear Select;

dt<<Bring Window To Front;

Bivariate(X(.......

dt = Data Table( "data table xxx" ) ;

dt << Bivariate(X(.........

insures the Bivariate Pllatform will run on the data table referenced by "dt"

Jim