I assume the error you get relates to needing a scriptable object. Right now you send a message to the window and save the result of the sent message to window_DATA. You instead want to save a reference to the window itself and then send a message to it. Two options are to:
- Do it all in one 'line', similar to your code now, but use order of operations to make sure the variable is defined before sending a message to the window, or
- Do this in two lines.
I recommend the latter as it is more readable.
Names default to here( 1 );
dt = Open("$Sample_data/iris.jmp");
//All at once
( window_DATA_1 = New Window( "NAMES SHOW",
Bivariate(
Y( :Name( "Sepal length" ) ),
X( :Name( "Petal length" ) ),
Fit Line( {Line Color( {100, 50, 50} )} )
)
) ) << Maximize Display << Set Window Icon( "FitYByX" );
window_DATA_1 << save picture( "$Desktop\Picture_1.JPG", JPEG );
//In two steps
window_DATA_2 = New Window( "NAMES SHOW",
Bivariate(
Y( :Name( "Sepal length" ) ),
X( :Name( "Petal length" ) ),
Fit Line( {Line Color( {100, 50, 50} )} )
)
);
window_DATA_2 << Maximize Display << Set Window Icon( "FitYByX" );
window_DATA_2 << save picture( "$Desktop\Picture_2.JPG", JPEG );