Skip to main content
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
Show menu Show menu

Scripts - Dialogs


Alert(message[,buttons]) generates a message on the screen. The optional parameter buttons can be OK, OKCANCEL, YESNO or YESNOCANCEL. The function returns a value corresponding with the button clicked on:





Script generated message box.

When Yes is clicked then the variable a contains 1; when No is clicked, a contains 2.

Custom dialogs

A script can define a custom dialog between <dialog> and </dialog> tags.

Each row in the <dialog> </dialog> block consists of a system variable followed by a description.

The following can be included:

  • $dlgvar1, $dlgvar2, $dlgvar3, $dlgvar4: includes a variable selector in the dialog box
  • $dlgfilter: includes a filter selector in the dialog box
  • $covariates: includes a covariates selector in the dialog box
  • $option1, $option2, option3, $option4, $option5: includes options in the dialog box
  • $input, $input2, $input3, $input4: includes input fields in the dialog box

The dialog box is displayed with the Dialog() function. The Dialog() function takes no parameters and returns 1 when OK was clicked or 0 when Cancel was clicked.

When the dialog box is closed, and OK was clicked, the corresponding system variables contain the selections made in the dialog box.


$dlgvar1 Select a variable
$dlgvar2 Select a variable
$dlgfilter Filter
$option1 Log transformation
$input1 Enter the test value

This creates the following dialog box:

Script generated dialog box.

When the dialog box is completed as follows:

Script generated dialog box.

then, when OK is clicked:

  • the variable m contains the result of the Dialog() function, 1 (when Cancel is clicked, m is 0)
  • the system variable $dlgvar1 will contain the string "Height", and $dlgvar2 will contain "Weight"
  • $dlgfilter will contain "group='a'"
  • $option1 will be 1
  • $input1 will be 25.6.


Input(message,type) is a function that creates a dialog box for a single input. The function returns the value entered in the dialog box.

The parameter type can be:

  • TEXT
  • REAL
  • DATE
  • TIME


m=Input("Enter a percentage: ",PERCENTAGE);

This creates the following dialog box:

Script input box.

In the example, 5 is entered in the dialog box, and when OK is clicked, the variable m contains the value 5.

See also