To have a New Window() script automatically return the results after the user clicks OK, include the Return Result message after the Modal message.
win = New Window( "Set a Value",
	<<Modal,
	<<Return Result,
	Text Box( "Set this value" ),
	variablebox = Number Edit Box( 42 ),
	Button Box( "OK" ),
	Button Box( "Cancel" )
);
Write( win["variablebox"] ); // create a subscript to the variablebox variable
33 // the user typed "33" in the number edit box
Include the Get message to return 1 for a selected checkbox and 0 for a deselected checkbox. To view the selection, add a Show() expression at the end of the script.
win = New Window( "V List Box",
	<<Modal,
	V List Box(
		kb1 = Check Box( "a" ),
		kb2 = Check Box( "b" ),
		kb3 = Check Box( "c" )
	),
	Button Box( "OK",
		val1 = kb1 << Get; // get the value of the first check box
		val2 = kb2 << Get;
		val3 = kb3 << Get;
	)
);
Show( val1, val2, val3 ); // return variables after window closes
val1 = 1; // first and second checkboxes are selected
val2 = 1;
val3 = 0; // third checkbox is not selected
Include the Get Selected message to return the selected column names and then insert the columns in a Bivariate plot.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
xvar = .;
yvar = .;
win = New Window( "Return Values",
	<<Modal,
	<<On Validate(
	// require the user to select two variables before clicking OK
		Show( xvar, yvar );
	 		If( Is Missing( xvar ) | Is Missing( yvar ),
				0, // if xvar or yvar are missing, do nothing when OK is clicked
			1
		);
	),
	Text Box( " Select two numeric columns. " ),
	H List Box(
		Text Box( " X, Factor " ),
		x = Col List Box(
			dt, // data table reference
			all, // display all columns from the data table
			xvar = (x << Get Selected)[1];
			// get the name of the selected column before the window closes
			Show( xvar );
		),
		Text Box( "Y, Response" ),
		y = Col List Box(
			dt,
			all,
			yvar = (y << Get Selected)[1];
			Show( yvar );
		)
	)
);
xcol = Column( dt, xvar ); //  get the columns
ycol = Column( dt, yvar );
 
dt << Bivariate( Y( ycol ), X( xcol ) ); // create a Bivariate plot