cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
vince_faller
Super User (Alumni)

Get batch/interactive mode

I'm wondering if there's a way to get suppress modal windows natively.  Batch interactive doesn't seem to.  

 

Names default to here(1);
batch interactive(1);

new window("Test", <<Modal, 
	Textbox("I don't want this to show up if in batch interactive")
);
batch interactive(0);

So I'm wondering if there's a way to get the current batch interactive mode so I can do something like this.  

Names default to here(1);
batch interactive(1);
if(batch interactive(), // or some other internal variable
	print("YAY")
, // else
	new window("Test", <<Modal, 
		Textbox("I don't want this to show up if in batch interactive")
	);
); 
batch interactive(0);

Obviously I can make my own batch variable but I'm wondering if there's anything built in.  

 

Vince Faller - Predictum
4 REPLIES 4
hogi
Level XII

Re: Get batch/interactive mode

Thanks for the info.

With some help of JMP support : )

batch interactive(boolean) returns the previous setting.


Names default to here(1);

//works for both options 
//batch interactive(0);
//batch interactive(1);

last setting = batch interactive(1); // return value is last setting
batch interactive(last setting); //  reset it in case we set it erroneously
if(last setting,
	print("YAY")
, // else
	new window("Test", <<Modal, 
		Textbox("I don't want this to show up if in batch interactive")
	);
);   

 

vince_faller
Super User (Alumni)

Re: Get batch/interactive mode

Mine always starts with 1, which makes me think JMP is in batch.  Which it's definitely not.  When you start up does the first return give you 0? 

Vince Faller - Predictum
hogi
Level XII

Re: Get batch/interactive mode

good point ...

It seems that when we run a script, JMP automatically starts with “Batch Interactive” set to 1 by default

- such that no warning message appears and interferes with the script.


Which it's definitely not.

Maybe there are different kinds of "warnings"? - and some of them ignore this default “Batch Interactive” ~  1 setting and therefore need an explicit batch interactive(1)sent via JSL to "shut up"?

 

Like Eval(arg) vs. Eval(Eval Expr( .... Expr(arg) ...):
One part of JMP platforms and functions just need Eval() around an argument to fix variable reference issues.
For the other part, the Eval(arg) approach will fail and the user has to fall back to Eval(Eval Expr( .... Expr(arg) ... ).
... and it's the daily fun of JSL scripters  & JMP support to find out which function belongs to which group.

hogi
Level XII

Re: Get batch/interactive mode

examples for the different behaviors of batch interactive - and the different "default" modes:

 

Names Default To Here( 1 );
testMarkup = Function( {},
       text = Text Box("Bad XML <");
       text << markup;
);
 
// Run the next four lines individually
testMarkup(); // no special setting: default
batch interactive(1);testMarkup(); // batch interactive is turned "on" so we see an error
batch interactive(0);testMarkup(); // batch interactive is turned off so we can show an error
 
new window("test",buttonbox("Test", testMarkup())); // running jsl in response to a click is not batch interactive mode
new window("test",buttonbox("Test", batch interactive(1);testMarkup())); // set batch interactive to 1 so the error message goes to the log and there is no modal dialog
// the findings:
// default -> no dialog
// 1       -> no dialog
// 0       -> dialog
 
 
// Run the next 3 lines individually to check if formula errors behave the same as above
:col1 << remove formula(); // no special setting: default
batch interactive(1);:col1 << remove formula(); // batch interactive is turned "on"" so we see an error
batch interactive(0);:col1 << remove formula(); // batch interactive is turned off so we can show an error
// the findings:
// default -> dialog (!!!!!)
// 1       -> no dialog
// 0       -> dialog

From JMP support, I got the info:
The Batch Interactive() function is undocumented.  The behavior may differ in different situations, and it may change in the future. In effect, it can be considered experimental and unsupported.