Choose Language Hide Translation Bar
0 Kudos

Calling native platforms with required user input from scripting

I think it would be absolutely awesome, if I could do something like this.  

Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
biv = dt << Bivariate();

Now biv is a "Scriptable[]", and that's okay.  But when I push okay, I'd love it if biv became the expression that you would get if you saved script to script window.  

That way I can do something like 

while(type(biv)!= "Expression", 
	if(biv == "User Canceled", stop());
	wait(.3);
);
biv = Eval(biv);

And it would wait as long as necessary for the user to input what  they needed to.  

I put in a statement that would check if the user canceled assuming that the user canceling would have some effect as well.  

The obvious problem with this is that I would be doing the analysis twice.  

 

This is related to this community item , I just really don't like rewriting the UI for platforms.  

Tracking Number:

Defect ID:

1 Comment
Super User

@vince_faller ,

 

I agree that enabling the JMP platform interface would be cool.  Even though I like the non-Modal  platform interface, what you are describing is something like 

biv = dt << Bivariate( <<Modal, <<Return Result );
// or alternately 
biv = dt << Bivariate Dialog();  //just the script expression is returned

That said, JMP  enabling winlist = Get Window List () with a type option and Save ByGroup Script to Data Table( "name", <<Prompt(0|1), <<Replace(0|1) ) will allow yo to do what you want, but with a bit of work. Just add what you want to do (your script, as an expression or include file)  to the doSomething expression: just as you would do for any non-modal dialog.  

 

Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
biv = dt << Bivariate( );
opt = 0;
onCancel = Expr( opt = -1 );
onOK     = Expr( opt = 1 ); 
doSomething = Expr(
  winlist = (Get Window List(Type("Reports")) << Get Window Title());
  If (nitems(winlist) >0, 
       win = Window(winlist[nitems(winlist)]); 
   // should have an error check for Bivariate, this assumes the last report is the report you want 
       biv = win[OutlineBox(1)] << get scriptable object;
       biv << Save By Group Script to Data Table("user",<<Prompt(0), <<Replace(1)) ;
       snames = dt << Get Table Script Names;
       s = dt << Get Script( snames[nitems(snames)] );
       // or use s= dt << Get Table Script("user") since you specified a name	
       show(s);
  );
);
dlgs = Get Window List(Type("Dialogs"));
biv_dlg = dlgs[nitems(dlgs)];
biv_dlg[Button Box(7)] << set script (onCancel);
biv_dlg[Button Box(6)] << set script (onOK);

biv_dlg << On Close( 
   show(opt);
   if(opt < 1, 
      Beep(); Caption("User Cancelled"); wait(1); Caption(remove); Stop(),
  //else
      doSomething    	
      );
);