- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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