cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
SpannerHead
Level IV

Script to Edit a Script

I have a script that takes a standard contour plot output and rearranges the plots into columns.

 

Goes from

SpannerHead_0-1735914715797.png

 

to

 

SpannerHead_1-1735914961605.png

The placement of the text boxes is causing the script to misfire.

 

Is there a different way to get the result?  If not, can I adjust the present script somehow to sort it?  I was wondering if the parent script could execute a find/replace on the child script to perform some adjustments?

 

clear Globals();
Delete Symbols();
window = Get Window List();
wName = window << Get Window Title;
nWindows = N Items( window );
For( i = nWindows, i > 0, i--,
	If( Contains( wName[i], "Contour Plot" ),
	
		obj = window[i]["Contour Plot?"] << Get Scriptable Object;
		Show(obj);
		obj << Save Script for All Objects;
obj << Close Window;
Break();
	);
);
spt = Window( "Script Window" );
spt << Bring Window To Front;
spt2 = spt[Script Box(1)];
spt2 << Get Line Text( 3 );
spt2 << Set Line Text (3, "Line Up Box( N Col( 3 ), Spacing( 2 ),");
spt2 << run();
spt2 << Close Window;

  


Slán



SpannerHead
1 ACCEPTED SOLUTION

Accepted Solutions
hogi
Level XII

Re: Script to Edit a Script

Closer to the original approach with the ... Script for all Objects:

 

// there is no
// myScript =  (current report()[OutlineBox(1)] << get scriptable object) <<  get Script for All Objects;
// : (

(current report()[OutlineBox(1)] << get scriptable object) <<  save Script for All Objects;
sw = Window( "Script Window" );
myScript = Parse(sw[Script Box(1)] << get text);

//--------------------------

// prepare a Template for the Line Up Box myExpr = Expr( Line Up Box( N Col( 3 ), Spacing( 2 )));
// take the V list Box - it contains the Countour Plot commands myScript = (Extract Expr(myScript, V List Box (Wild List()))); // cycle through Contour Plot commands, "wrap" with V List Box and insert into template For each({command}, Name Expr(myScript), // an I-DONT-CARE of VLBs wrapped = Insert (Expr(V list Box ()), Name Expr(command)); Insert Into(myExpr, Name Expr(wrapped)) ); // generate the report New Window("overview", myExpr);

 

 

Many many Thanks to the programmer of the  For Each function !! 
wonderful : )
It works with any Expression, not just with List, Associative Array and Matrix : )

hogi_0-1735929022906.png

View solution in original post

7 REPLIES 7
jthi
Super User

Re: Script to Edit a Script

If you can use JMP18 you can just modify the layout from the highest level red triangle

jthi_0-1735919444431.png

 

I don't have access to JMP17 anymore and I'm not sure if I can even get similar result in JMP18 to test out different options but you could take those text boxes into account (increase ncol to 6 and hide them / keep ncol as 3 and remove them). You could also determine which column is being used as the by column and rebuild the platform using that information WITHOUT using By (run it multiple times and format as you want to).

-Jarmo
hogi
Level XII

Re: Script to Edit a Script

current report()["Conto?"]

thanks, very useful

hogi
Level XII

Re: Script to Edit a Script

You could collect the scripts of the OutlineBoxes, encapsulate every (Where information + plot)  inside a  V List Box and arrange the V List Boxes via the Lineup Box :

// ask every Outline Box for a scriptable object
obs = (current report() << xpath("//OutlineBox")) << get scriptable object;

// ask the scriptable objects for a script
scripts = obs  << get Script;

// prepare a template LineUp Box
myExpr = Expr( Line Up Box( N Col( 3 ), Spacing( 2 )));

// wrap the scripts with V List Box and put them into the template
For each({script}, scripts, 
Eval (Substitute(Expr(Insert Into(myExpr, Expr(V list Box (_content_)))), Expr(_content_), Name Expr(script)))
);

// use the template in a new window
New Window("overview", myExpr);

 

hogi
Level XII

Re: Script to Edit a Script

Closer to the original approach with the ... Script for all Objects:

 

// there is no
// myScript =  (current report()[OutlineBox(1)] << get scriptable object) <<  get Script for All Objects;
// : (

(current report()[OutlineBox(1)] << get scriptable object) <<  save Script for All Objects;
sw = Window( "Script Window" );
myScript = Parse(sw[Script Box(1)] << get text);

//--------------------------

// prepare a Template for the Line Up Box myExpr = Expr( Line Up Box( N Col( 3 ), Spacing( 2 )));
// take the V list Box - it contains the Countour Plot commands myScript = (Extract Expr(myScript, V List Box (Wild List()))); // cycle through Contour Plot commands, "wrap" with V List Box and insert into template For each({command}, Name Expr(myScript), // an I-DONT-CARE of VLBs wrapped = Insert (Expr(V list Box ()), Name Expr(command)); Insert Into(myExpr, Name Expr(wrapped)) ); // generate the report New Window("overview", myExpr);

 

 

Many many Thanks to the programmer of the  For Each function !! 
wonderful : )
It works with any Expression, not just with List, Associative Array and Matrix : )

hogi_0-1735929022906.png

txnelson
Super User

Re: Script to Edit a Script

I have done this a little different.  I generated the contour plots from the Semiconductor Capability data table, and then ran the following script

Clear Globals();
Delete Symbols();
window = Get Window List();
wName = window << Get Window Title;
nWindows = N Items( window );
For( i = nWindows, i > 0, i--,
	If( Contains( wName[i], "Contour Plot" ), 
		obj = window[i]["Contour Plot?"] << Get Scriptable Object;
		Break();
	)
);

script = Char( obj << get bygroup script );
obj << Close Window;
Eval( Parse( "New Window(\!"Contours\!",lineupbox(ncol(3), spacing(2)," || script || "));" ) );

to get this output

txnelson_0-1735960939603.png

 

Jim
hogi
Level XII

Re: Script to Edit a Script

Ah, right, the get bygroup script() was already there. Indeed, much easier this way : )

 

(current report()["Contour?"] << get scriptable object) << get by group script

Is quite robust.

It works with JMP17 (talking to the first plot)

hogi_0-1735970665960.png

... and JMP18 (talking to the Group Platform):

hogi_1-1735970726383.png

 

If you use the return value of the report command, you have to be careful to get the script only 1x:

cp =Contour Plot( ... ,By() ); // returns a list
//cp << get script; // 1 script per plot (N times, message sent to a list)
// cp << get bygroup script; // returns the by group Script N times (message sent to a list) cp[1] << get bygroup script; // 1x 

 

hogi
Level XII

Re: Script to Edit a Script


@hogi wrote:

... Is quite robust. It works with JMP17 (talking to the first plot)... and JMP18 (talking to the Group Platform)


Oh, this statement just refers to the way how to get the groupby script:

 

(current report()["Contour?"] << get scriptable object) << get by group script

not for the complete thing ...

In JMP 18 and later, the script returns a GroupPlatform - and Lineup Box is no longer possible to control the layout.
Then you can skip this outer part and directly use the GroupPlatform to control the layout (red triangle options mentioned by @jthi ).

Tree structure via Lineup Box (group by script)

hogi_8-1735975114911.png

[selected Outlinebox = 1st plot]

Tree structure via the previous approaches:

hogi_10-1735975604423.png