BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
AApperson
Community Trekker

Adding a graphics script in JMP 7; "Current window()" workaround

Hi all, finally broke down and made an account.  Thanks for all the time you guys put into generating solutions and answering questions. 

 

Problem:  Cannot use "Current Window()" command in JMP 7.  Is there an equivalent?  Alternatively is there a clean way to perform this same task of adding a graphics script to the current plot in JMP 7?  Is there a JSL syntax/command guide somewhere for JMP 7 I can peruse?

 

Background:

I generated the following script for JMP 13 that adds a graphics script to the current plot.  I do this by including a file on the server and then calling an expression/function from the menu code to add the graphics script.

Some users want backwards compatibility to JMP 7.  It doesn't appear that Current Window() is an avalible command in JMP 7.  Help.

 

Script that does the work (and works in JMP 13)

win = Current Window();

sel = win[FrameBox( 1 )];  //for reports with frame 1 as the bivariate fit

sel << Add Graphics Script(

   Description("FooBar Boxes"),

   // Code for Foobar Boxes goes here

   // This is the same as the code pasted into a plot under right-click > Customize > +

)

 

 

Error code from JMP 7:

Name Unresolved: Current Window in access or evaluation of 'Current Window' , Current Window()

 

In the following script, error marked by /*###*/

win = Current Window()/*###*/;

 

Thanks,

-AA

0 Kudos
4 REPLIES 4

Re: Adding a graphics script in JMP 7; "Current window()" workaround

the larger context of the problem would help. for example, does your script launch the platform with the frame box or does it run after the platform was created?

Learn it once, use it forever!
0 Kudos
julian
Staff

Re: Adding a graphics script in JMP 7; "Current window()" workaround

Hi @AApperson,

JMP 7 supports a reference to a window by number, and the current window is number 0, so it seems that the following should point you to the same place as Current Window() does in JMP 13.

win = Window(0);

Does this help?

Julian

0 Kudos

Re: Adding a graphics script in JMP 7; "Current window()" workaround

That direction is where I was going if the reference to the window was not already directly available.

In the case that you can be sure that the current window is the target, you can get the number of open windows and iterate over them, checking the window title to find the one you need.

Learn it once, use it forever!
0 Kudos
AApperson
Community Trekker

Re: Adding a graphics script in JMP 7; "Current window()" workaround

Thanks for the reply guys.  Some feedback.

 

When I run the following code snipit in JMP 7 to verify Window(0) is the current window, the most recent window is the largest integer.  Window(0) appears to be the first window opened.  If the newest window was always the window that needed the graphics script added, I could use this, but that isn't guaranteed to be the case.  I need the user's active window.

k = nItems (Window());
for (i=0, i<k, i++,
	print(i);
	print(Window(i) << get window title());
);

 

More background:

This script would run after the platform has been created.  The idea is that a report/plot has been created and the user then decides they need additional reference information in the plot.  So, my script is intended to 1. find a reference to the Current Window the user has active, then 2. add a graphics script that contains reference information (lines, words, etc.) to the plot.

 

I intend to have a menu/toolbar item run the script.

0 Kudos