Example - Recording a Simple Macro with Modal Dialog Specifications

Occasionally, in some Statistical analysis modules, the user interface will include modal dialog boxes to set some specifications. Modal dialog boxes are those that will not minimize when you click on the background behind them, but instead will stay on the screen until you explicitly close them; practically all results dialog boxes in Statistica are modeless, i.e., they will minimize (to an icon on the status bar at the bottom of the application) when you click on the application background, or (by default) when a results spreadsheet or graph is produced.

The recording of modal dialog box specifications is illustrated in this example. Run Statistica and open the example data file Exp.sta. Select 2D Graphs - Scatterplots from the Graphs menu. Then on the 2D Scatterplot Quick tab, click the Variables button and select variables Stress_r as the X variable, and Correct1 through Correct3 as the Y variables, respectively. Click OK to produce the graphs. Create the SVB program as a stand-alone macro (see Example: Recording a Simple Macro), and name it MyMacro2.

The first line in the recorded macro creates the analysis object:

Set newanalysis = Analysis (sc2dScattterplots)

The next block defines the specifications (properties) for this specific plot (scatterplot).

With newanalysis.Dialog

.Variables = "5 | 6 7 8 | "

'... '...

.DocumentStyle = 1

End With

The following block defines common options that will apply to various (2D) graphs; these options are set by (1) declaring an object of type StatsGraphsOptions, and (2) setting the desired options.

Dim OptionProperty As StatsGraphsOptions Set OptionProperty = newanalysis.Dialog.Options With OptionProperty

.DisplayDefaultTitle = True

'... '...

.RandomSamplingSubsetSize = 100

End With

Finally the results object collection (collection of graph objects, containing three objects in this case, since three 2d Scatterplot's were specified) will be created (see also Example: Recording a Simple Macro).

newanalysis.Dialog.Graphs.Visible = True

To run this macro, press F5 or click the Run Macro button on the SVB toolbar.