cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Jackie_
Level VI

Open() , save and close while script is running

Hi,

 

Is there a way I could open the data table, save in the variable and close it while the script is running? It's annoying sometimes because the input data table will pop up. I tried using close window, close() but they didn't seem to work.

Names Default To Here( 1 );
Clear Globals();
Clear Log();
dt2 = Current Data Table();
nw = New Window( "New window",
			<<modal(),
			Text Box(
				"Tests", 
			
				<<Set Font Style( "Bold" ),
				<<Set Wrap( 1000 )
			), 
	
			Spacer Box( Size( 20, 20 ) ), 
               
			H List Box(
				Panel Box( "Input JMP file",
					<<set font style( "Bold" ),
					Button Box( "Select file", dt1 = Open(), <<setIcon( "ListItemAdd" ) ) // Can I use close window syntax? here
				)),
				Spacer Box( Size( 20, 10 ) ),
			Panel Box( "Actions", 

				H List Box(
					align( center ), 

					Button Box( "OK", 
						keep_going = 1;
						todo_list = my_cb << get selected, <<setIcon( "CheckCircle" );
					), 

					Button Box( "Cancel", keep_going = 0, <<setIcon( "ErrorSmall" ))

				), 

			),
			<<Size Window( 340, 430 )
		);



 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Open() , save and close while script is running

Could hiding the window work (make it invisible). Then if you need to make it visible you can use << Show Window(1);.

Here is how to set invisible directly in Open function, but I think this requires you to have the path

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp", invisible);
wait(2);
dt << Show Window(1);

In your case you might have to first let the table open as visible and then use << Show Window(0); to hide it

Names Default To Here(1);
dt = Open();
dt << Show Window(0);

Even better might be using file_path = Pick File with Open(file_path, invisible):

dt_path = Pick File("Select JMP File",
	"",
	{"JMP Files|jmp"}
);
If(!IsMissing(dt_path),
	dt1 = Open(dt_path, invisible);
);
View more...
Names Default To Here(1);
dt2 = Current Data Table();
nw = New Window("New window",
	<<modal(),
	Text Box(
		"Tests", 
			
		<<Set Font Style("Bold"),
		<<Set Wrap(1000)
	), 
	
	Spacer Box(Size(20, 20)), 
               
	H List Box(
		Panel Box("Input JMP file",
			Button Box("Select file", 
			dt_path = Pick File("Select JMP File",
				"",
				{"JMP Files|jmp"}
			);
			If(!IsMissing(dt_path),
				dt1 = Open(dt_path, invisible);
			);
				,<<setIcon("ListItemAdd")
			) // Can I use close window syntax? here
		)
	),
	Spacer Box(Size(20, 10)),
	Panel Box("Actions", 

		H List Box(
			align(center), 

			Button Box("OK",
				keep_going = 1;
				todo_list = my_cb << get selected;,
				<<setIcon("CheckCircle")
			), 

			Button Box("Cancel", keep_going = 0, <<setIcon("ErrorSmall"))

		), 

	),
	<<Size Window(340, 430)
);
-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Open() , save and close while script is running

Could hiding the window work (make it invisible). Then if you need to make it visible you can use << Show Window(1);.

Here is how to set invisible directly in Open function, but I think this requires you to have the path

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp", invisible);
wait(2);
dt << Show Window(1);

In your case you might have to first let the table open as visible and then use << Show Window(0); to hide it

Names Default To Here(1);
dt = Open();
dt << Show Window(0);

Even better might be using file_path = Pick File with Open(file_path, invisible):

dt_path = Pick File("Select JMP File",
	"",
	{"JMP Files|jmp"}
);
If(!IsMissing(dt_path),
	dt1 = Open(dt_path, invisible);
);
View more...
Names Default To Here(1);
dt2 = Current Data Table();
nw = New Window("New window",
	<<modal(),
	Text Box(
		"Tests", 
			
		<<Set Font Style("Bold"),
		<<Set Wrap(1000)
	), 
	
	Spacer Box(Size(20, 20)), 
               
	H List Box(
		Panel Box("Input JMP file",
			Button Box("Select file", 
			dt_path = Pick File("Select JMP File",
				"",
				{"JMP Files|jmp"}
			);
			If(!IsMissing(dt_path),
				dt1 = Open(dt_path, invisible);
			);
				,<<setIcon("ListItemAdd")
			) // Can I use close window syntax? here
		)
	),
	Spacer Box(Size(20, 10)),
	Panel Box("Actions", 

		H List Box(
			align(center), 

			Button Box("OK",
				keep_going = 1;
				todo_list = my_cb << get selected;,
				<<setIcon("CheckCircle")
			), 

			Button Box("Cancel", keep_going = 0, <<setIcon("ErrorSmall"))

		), 

	),
	<<Size Window(340, 430)
);
-Jarmo
Jackie_
Level VI

Re: Open() , save and close while script is running

It worked. Thanks @jthi 

Jackie_
Level VI

Re: Open() , save and close while script is running

Hi @jthi , Quick question. I am trying to bring the variability chart window in the front or maximize it after clicking on button box "Plot". I tried using bring window to front but it's not working. Can you suggest what other syntax can be use?

 

Here's my script: 

Names Default To Here( 1 );
dt2 = Open( "$SAMPLE_DATA/Big Class.jmp" );
nw = New Window( "New window",
	<<modal(),
	Text Box(
		"Tests", 
			
		<<Set Font Style( "Bold" ),
		<<Set Wrap( 1000 )
	), 
	
	Spacer Box( Size( 20, 20 ) ), 
               
	H List Box(
		Panel Box( "Input JMP file",
			Button Box( "Select file",
				dt_path = Pick File( "Select JMP File", "", {"JMP Files|jmp"} );
				If( !Is Missing( dt_path ),
					dt1 = Open( dt_path, invisible )
				);,
				<<setIcon( "ListItemAdd" )
			) // Can I use close window syntax? here
		)
	),
	V List Box(
		aa = Panel Box( "Variablity chart",
			Button Box( "   Plot   ",
				vc = dt2 << Variability Chart(
					Y( :height ),
					X( :sex ),
					Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
					Show Range Bars( 0 ),
					Std Dev Chart( 0 ),
					Points Jittered( 1 )
				);
				aa << close window;
				vc << Show window( 1 );
						
						
			,
				<<setIcon( "VariChart" )	
									
									
			)
		)
									
									
									
	)
,
	Spacer Box( Size( 20, 10 ) ),
	Panel Box( "Actions", 

		H List Box(
			align( center ), 

			Button Box( "OK",
				keep_going = 1;
				todo_list = my_cb << get selected;,
				<<setIcon( "CheckCircle" )
			), 

			Button Box( "Cancel", keep_going = 0, <<setIcon( "ErrorSmall" ) )

		), 

	),
	<<Size Window( 340, 430 )
);
jthi
Super User

Re: Open() , save and close while script is running

I think you started new topic related to this question (Bring window to front) , so we can continue discussion there, most likely related to you using modal window.

-Jarmo