I am writing a script that does the following:
The calculation that is performed when Run is clicked is produced by a script stored in the Run button. This script produces a report, which is what the user should see. However, because the script is added to the Run button, that desired report appears, but is then followed by the Fit Least Squares report that Run produces on its own. The Fit Least Squares report is meaningless to the user.
The script below illustrates the problem. In that script, the expression in the Run button, "runExpr", simply creates a clone data table; this is to simplify the illustration. In the actual script, that expression (runExpr) performs a lot of analysis based on the effects entered in the Fit Model window. Also, in the actual script, the user populates the Fit Model window interactively; I populated the Fit Model window in the script below for convenience.
Names Default To Here( 1 );
runExpr = Expr(
// Creates a clone data table for illustration;
dt << Subset( Output Table( "Clone Table" ), All rows );
);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
fmSLS = Fit Model(
Y( :weight ),
Effects( :age, :height, :age * :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
);
r = fmSLS << Report;
r[Button Box( 9 )] << Set Script( runExpr);When you click Run, as a user would, the clone table appears, but the window on top is the Fit Least Squares report produced by the Run command. I would like to prevent that report from appearing.
To that end:
Any thoughts or help would be greatly appreciated!
Names Default To Here( 1 );
runExpr = Expr(
// Creates a clone data table for illustration;
dt << Subset( Output Table( "Clone Table" ), All rows );
fm_Flag = 1
);
fm_Flag = 0; // Sets flag for timing
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
fmSLS = Fit Model(
Y( :weight ),
Effects( :age, :height, :age * :height ),
Personality( "Standard Least Squares" ),
Emphasis( "Minimal Report" ),
);
r = fmSLS << Report;
r[Button Box( 9 )] << Set Script( runExpr; fm_Flag = 1 );
For( i = 1, i <= 100, i++,
If(fm_Flag < 1, Wait(0.5), windowsopen = Get Window List(); windowsopen[nItems(windowsopen)] << Close Window; Stop() )
);
Mark, you raise a very good question and you make a good point. Maybe there is a better way to get achieve my goal. Please see my reply to "ih" above. I need the Fit Model window simply because of its flexibility in allowing users to construct effects. The script that I am writing uses those effects to construct models using fractional bootstrap weights. (Anyway, there are more details in the Reply to "ih" above.)
I know that there are scripting functions that help construct model effects, but one would really need to replicate a lot of the functionality that exists in the Fit Model window. I wish that one could use that window for effect construction without having to fit a model!