Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
SteveTerry
Level III

Data table screen size set by JSL script is not always saved with .jmp file

I find that, when I set the window size of a data table with JSL, then save it out, there's at least one mode where the window size settings don't seem to have been saved with the .jmp file.  Instead, it seems that the window size settings from the last manually saved settings, (i.e., via the UI), are used for (or saved with) the .jmp file.  The following code is made up of snippets from my JSL script, so has not been tested by itself, but is representative:

 

dt = Current Data Table();
window = Get Window( dt );
window << Set Window Size( 1300, 700 );
dt << Save( "myTable.jmp" ); dt << Close Window;

I have also tried using Set Content Size() instead of Set Window Size(), and it seems to behave the same way.  (It's not clear to me from the docs which is more appropriate for this purpose;  perhaps someone could comment on the specific difference between the two.)

 

I am experiencing this behavior running JMP 14.2 under Windows 7.  However, I notice that, with Mac OS (running 14.3), I'm not able to reproduce the issue, and the JMP table window sizes always get saved as expected by the JSL script.  This makes me wonder whether there might be any User Preferences settings that are overriding the script's parameters.  (I've encountered this before with Open().)

 

The only other discussion I could find on this subject generally was screen size, but it does not seem to be directly relevant.

 

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted

Re: Data table screen size set by JSL script is not always saved with .jmp file

Hi,

 

I believe this is a Windows issue, but here is a workaround:

 

dt = Current Data Table();
dt << New Script(
"OnOpen", // create the script
window = Get Window( Current Data Table() );
window << Set Window Size( 1300, 700 );
);
dt << Save( "myTable.jmp" );
dt << Close Window;

Please try this and let me know if it works for you.

View solution in original post

Highlighted
SteveTerry
Level III

Re: Data table screen size set by JSL script is not always saved with .jmp file

Hey Hadley, Craige, and JMP Community–  I believe I've tracked the issue down to a bug in my code.  I had originally noted that I had also tried using Set Content Size() instead of Set Window Size().  But, in fact, my original code on both the Mac and Windows sides were using Set Content Size(), and I had only recently transitioned the Mac code over to using Set Window Size() — (probably as part of my effort to debug this issue).  But now, after also applying Set Window Size() to the Windows code, I find that the window size is persistent and always as expected when the file is opened.  Likely, the reason I didn't make this connection sooner was that Set Content Size() seemingly works just as well for this purpose in a Mac environment, and that's where I do most of my development.

View solution in original post

4 REPLIES 4
Highlighted

Re: Data table screen size set by JSL script is not always saved with .jmp file

Hi,

 

I believe this is a Windows issue, but here is a workaround:

 

dt = Current Data Table();
dt << New Script(
"OnOpen", // create the script
window = Get Window( Current Data Table() );
window << Set Window Size( 1300, 700 );
);
dt << Save( "myTable.jmp" );
dt << Close Window;

Please try this and let me know if it works for you.

View solution in original post

Highlighted
SteveTerry
Level III

Re: Data table screen size set by JSL script is not always saved with .jmp file

Hi Hadley– that's a very clever workaround!  I wasn't aware that JMP will automatically run a script named 'OnOpen' if it finds it upon opening a data table file.  It's a very nice feature, and I'm starting to think of other, unrelated applications of its use!

 

Before I accept this as a solution, I'd like to find out if this is a known issue with JMP 14 running on Windows, and, if so, has it been addressed in JMP 15 or planned for JMP 16.  If you or one of your colleagues could find that out, that would be very helpful.

Highlighted
Craige_Hales
Staff (Retired)

Re: Data table screen size set by JSL script is not always saved with .jmp file

JMP keeps a list of recent window positions/sizes (in the Windows registry, separate from the size in the table) so it can reopen scripts and tables in the same location and size as before.  They compete with whatever the table knows about its preferred size. @jschroedl 

Craige
Highlighted
SteveTerry
Level III

Re: Data table screen size set by JSL script is not always saved with .jmp file

Hey Hadley, Craige, and JMP Community–  I believe I've tracked the issue down to a bug in my code.  I had originally noted that I had also tried using Set Content Size() instead of Set Window Size().  But, in fact, my original code on both the Mac and Windows sides were using Set Content Size(), and I had only recently transitioned the Mac code over to using Set Window Size() — (probably as part of my effort to debug this issue).  But now, after also applying Set Window Size() to the Windows code, I find that the window size is persistent and always as expected when the file is opened.  Likely, the reason I didn't make this connection sooner was that Set Content Size() seemingly works just as well for this purpose in a Mac environment, and that's where I do most of my development.

View solution in original post

Article Labels

    There are no labels assigned to this post.