cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
lala
Level VIII

How does JSL get the file name of an image already opened with JMP?

Thanks!

//img=Open("$SAMPLE_IMAGES/tile.jpg");
pp= Current Window();
na=pp << Window Class Name();//??
1 ACCEPTED SOLUTION

Accepted Solutions
lala
Level VIII

Re: How does JSL get the file name of an image already opened with JMP?

名= Get Window List() << Get Window Title();i=1;For(i=1,i<=NItems(名),i++,aa=名[i];if(right(aa,3)=="jpg"|right(aa,3)=="png",pp=left(aa,length(aa)-4);Break()));

View solution in original post

8 REPLIES 8
txnelson
Super User

Re: How does JSL get the file name of an image already opened with JMP?

I am not sure what you mean when you specify "an image".  Is this a displayed data table window?  Or is it the output from JMP Platform?  Or is it an actual image display of a .jpg or .png file?

 

<< Get Path will give you the full file name of the data table.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
path = dt << Get Path();
Show( path );

<< Get Datatable will return the name of the data table associated with the Display Output from a JMP Platform.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj = dt << Distribution( Column( :Age, :Weight ) );
t = obj << Get Datatable;
Show( N Rows( t ) );
Jim
lala
Level VIII

Re: How does JSL get the file name of an image already opened with JMP?

Thank Jim!

  • I just get the picture window title like this JSL

    Open( "$SAMPLE_IMAGES/tile.jpg" );
    
    pp = Current Window();
    na = pp << Window Class Name();//??

    2024-07-16_11-02-17.png

lala
Level VIII

Re: How does JSL get the file name of an image already opened with JMP?

OK

2024-07-16_11-18-06.png

jthi
Super User

Re: How does JSL get the file name of an image already opened with JMP?

You know the name of the image if you are opening it -> get it from the filename/path. There isn't a window when you use Open() on image, it will just return the image object (at least doesn't seem to create a window in JMP17/JMP18 when run from script editor).

jthi_1-1721104869276.png

But you can send << Get Path to that 

Names Default To Here(1);
img = Open("$SAMPLE_IMAGES/windmap.png", "png");
//Show(Get Window List() << get window title, img << Get Path);
nw = New Window(img << Get Path,
	img
);

And if you have already open windows, Get Window List() << Get Window Title works but you might not know which is your image (last opened window is the last in list). 

-Jarmo
lala
Level VIII

Re: How does JSL get the file name of an image already opened with JMP?

I opened the png file with JMP by default, so I need to get the name this way.

2024-07-16_13-14-05.png

lala
Level VIII

Re: How does JSL get the file name of an image already opened with JMP?

名= Get Window List() << Get Window Title();i=1;For(i=1,i<=NItems(名),i++,aa=名[i];if(right(aa,3)=="jpg"|right(aa,3)=="png",pp=left(aa,length(aa)-4);Break()));
jthi
Super User

Re: How does JSL get the file name of an image already opened with JMP?

Using Word() or Words() can usually make getting filenames a bit easier. This will return all the window titles which end in "jpg", "jpeg" or "png"

pngs = Filter Each({windowtitle}, Get Window List() << Get Window Title,
	Ends With({"jpg", "jpeg", "png"}, Word(-1, windowtitle, "."))
);
-Jarmo
lala
Level VIII

Re: How does JSL get the file name of an image already opened with JMP?

Thank jthi!

 

Each()

It not work in jmp 14

Recommended Articles