Save as .jrp with some interactivity:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate( Y( :Weight ), X( :Height ) );
Wait(1);
biv<< Bring Window To Front;
Main Menu( "Save As" );
Save as .jrp automatically:
A .jrp appears to be just a .jsl that autoruns. The code contains 1) a reference to a saved data table or to an embedded data table, and 2) the code to generate the report. Hence, it should be quite straightforward to script the saving of a .jrp.
Here is one way that seems to work:
// Function to save .jrp
Save_jrp = Function( {dt, obj, dir, filename},
{embed_data = 0}, // Switch between embedded and referenced data table.
Save Text File(
dir || filename || ".jrp",
If( embed_data,
Char(
Eval Expr(
Expr( dt << get script );
Expr( obj << get script );
)
),
Char(
Eval Expr(
Open( Expr( dt << get path ) );
Expr( obj << get script );
)
)
)
)
);
// Define example input data: data table, report, path and file name
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate( Y( :Weight ), X( :Height ) );
dt = biv << get data table;
biv << set window title( "MyReport" );
fname = biv << get window title;
path = Get Default Directory();
// Run function
Save_jrp( dt, biv, path, fname );
// Test if it worked
Close( dt, no save );
Wait( 1 );
Open( path || fname || ".jrp" );