Subscribe Bookmark RSS Feed

Does JSL provide a "busy" indicator similar to a spinning wheel or bar?

csoon1

Community Trekker

Joined:

Feb 9, 2016

I am processing hundreds of thousands of rows and I wanted something "visual" to tell the user that the script is doing something. I appreciate any hints or tricks to achieve this.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

I use the caption function to let the user know what's going on.  You have to use it in conjunction with the wait() function to force JMP to catch up.  Here's a simple example:

caption("Processing data.  Please be patient.");

wait(0);

d = 0;

for (i = 1, i <= 10000000, i++,

      d = d + i;

      if (mod(i, 10000) == 0,

            caption("Processed " || char(i) || " values");

            wait(0);

      )

);

caption(remove);

wait(0);

13 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

JMP supplies a spinning wheel, etc. when it is processing a JSL script.

Jim
Solution

I use the caption function to let the user know what's going on.  You have to use it in conjunction with the wait() function to force JMP to catch up.  Here's a simple example:

caption("Processing data.  Please be patient.");

wait(0);

d = 0;

for (i = 1, i <= 10000000, i++,

      d = d + i;

      if (mod(i, 10000) == 0,

            caption("Processed " || char(i) || " values");

            wait(0);

      )

);

caption(remove);

wait(0);

csoon1

Community Trekker

Joined:

Feb 9, 2016

@PMRoz thank you very much! I find this as the most intuitive way of showing the status of what I am doing. Just a follow-up question though... would you happen to know how to position the caption at the center of the screen? I know it's a different topic so I'll just lookup if there is a way to get the display resolution from jmp... and work from there.

melaniedrake

Staff

Joined:

May 30, 2014

Starting with JMP 11, there is a JSL function to create a spinning wheel:

New Window( "Example", Busy Light( <<automatic ) );

Messages for the busylightbox it creates are Advance, Disable, automatic, size, and RPM.

Automatic turns it on so that it spins by itself. Automatic(0) stops the spin.

If you don't turn it on, you can use advance, perhaps in a while loop.

Disable hides the busylightbox. You can't get it back. Might be useful just to hide once your operation is finished, if it's in a window you continue to use.

Size only works as an argument to the Busy Light function. Size takes 2 comma-separated arguments - x and y in pixels. I don't recommend going very large, as it's just a little picture and gets very bitmapped at larger sizes.

RPM controls how fast the wheel spins when on automatic.

You can't change the colors - it's just a little picture.

Example:

New Window( "Example",

  blb = Busy Light( <<automatic, size(30, 30) )

);

11082_pastedImage_6.png

theresagoodyear

Community Trekker

Joined:

Sep 21, 2015

I open View:Log to see what is going on behind the scenes.

csoon1

Community Trekker

Joined:

Feb 9, 2016

This is useful as well and actually also works as intended. i just find the caption suggestion more applicable to my application. Thanks for this suggestion though as I'm planning to use this on a separate script.

msharp

Super User

Joined:

Jul 28, 2015

This is very helpful thankyou!  I discovered this feature several months ago, but the documentation on it is rather bare.  I always felt the default size was too small and glad to see you can increase it (even at risk of pixelation).

If you are looking for a loading bar instead of a busy indicator, you can use my code attached.

Craige_Hales

Staff

Joined:

Mar 21, 2013

Made a post Progress Bar

Craige
msharp

Super User

Joined:

Jul 28, 2015

I like your use of functions to accomplish the same thing, makes it cleaner. 

A few things I've learned from when I scripted mine above, if the user decides to close the window it will crash your script.  I'd suggest looking at my code I attached above.  Uses try/catch and allows the user to hit cancel as well.  Also, feel the Show Menu(0), and Show Toolbar(0) makes a loading bar a little cleaner for the window.