cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
jjswan33
Level III

Problem closing image obj in JSL

Hello,  Hoping to get some help with a JSL script.  I am having issues with a newImage object staying open but is completely hidden.  Only way I know it is open is because windows fails to delete the file because it says it is open in another program which is fixed by closing JMP.  Here is a snippet of my code, I have tried a few obj << close() and obj << close window() but the object remains.

 

img_t = newImage(path_to_results||"/"||subfolder_list[k]||"/"||image) 
w2 = new window("Image", Show Toolbars(0), Show Menu(0), img_t); 
w2 << Add Simple ShapeAnnotation(Oval(PX-25,PY-25,PX+25,PY+25 ),color("Yellow"),raised(1)); 
img= w2 << getpicture(); 
img_t << Close Window; 
w2 << Close Window; 
img<<set size({800, 800});

Any suggestions?

 

1 ACCEPTED SOLUTION

Accepted Solutions
gzmorgan0
Super User (Alumni)

Re: Problem closing image obj in JSL

If you start with a new session in JMP, try this script:

 

Names Default to here(1);
img_t = New Image( "$SAMPLE_IMAGES/tile.jpg" );
w2 = new window("Image", Show Toolbars(0), Show Menu(0), img_t); 
{PX,PY} = w2 << get size;
w2 << Add Simple ShapeAnnotation(Oval(PX-25,PY-25,25,25 ),color("Yellow"),raised(1)); 
img= w2 << get picture(); 
w2 << Close Window;
//the image objects still exist 
//show(img);
//show(img_t);
img = empty();
img_t = empty();
show(img, img_t); //see LOG: img = Empty(); img_t = Empty();
 
delete symbols({img, img_t});
show symbols();

Then look at the LOG window. You will see this: three show results.  Symbols/objects can be local, Here, and global. Note I have one global that you likely wll not have.  So the key is to replace a variable with a new value and delete the name (symbol).  You might want to learn more about Namespaces in the JMP Scripting Guide.

 

img = Empty();
img_t = Empty();
// Here

img = Empty();
img_t = Empty();
PX = 451;
PY = 451;
w2 = DisplayBox[];

// 5 Here

// Global

com.jmp.wmurph.crashrpt.flag = 0;

// 1 Global

 

View solution in original post

1 REPLY 1
gzmorgan0
Super User (Alumni)

Re: Problem closing image obj in JSL

If you start with a new session in JMP, try this script:

 

Names Default to here(1);
img_t = New Image( "$SAMPLE_IMAGES/tile.jpg" );
w2 = new window("Image", Show Toolbars(0), Show Menu(0), img_t); 
{PX,PY} = w2 << get size;
w2 << Add Simple ShapeAnnotation(Oval(PX-25,PY-25,25,25 ),color("Yellow"),raised(1)); 
img= w2 << get picture(); 
w2 << Close Window;
//the image objects still exist 
//show(img);
//show(img_t);
img = empty();
img_t = empty();
show(img, img_t); //see LOG: img = Empty(); img_t = Empty();
 
delete symbols({img, img_t});
show symbols();

Then look at the LOG window. You will see this: three show results.  Symbols/objects can be local, Here, and global. Note I have one global that you likely wll not have.  So the key is to replace a variable with a new value and delete the name (symbol).  You might want to learn more about Namespaces in the JMP Scripting Guide.

 

img = Empty();
img_t = Empty();
// Here

img = Empty();
img_t = Empty();
PX = 451;
PY = 451;
w2 = DisplayBox[];

// 5 Here

// Global

com.jmp.wmurph.crashrpt.flag = 0;

// 1 Global