Message Box Action

Declaration

<AMMESSAGEBOX WINDOWTITLE="text" BUTTONS="text [options]" POSITION="text [options]" XPOS="number" YPOS="number" DEFAULTBUTTON=number ONFIRSTBUTTONCLICK="text [options]" ONFIRSTBUTTONCLICKTASK="text" ONSECONDBUTTONCLICK="text [options]" ONSECONDBUTTONCLICKTASK="text" ONTHIRDBUTTONCLICK="text [options]" ONTHIRDBUTTONCLICKTASK="text" ICON="text [option]" WINDOWINFRONT="yes/no" RESULTVARIABLE="text" MODAL="yes/no" COUNTDOWNDELAY="number">text</AMMESSAGEBOX>

See Also

Message Box Action-Setting Properties, Choice Action, Common Dialog Action, Input Box Action

Description

Displays a message box using the settings specified. A message box is useful when notification and/or user input is required in a task.

Practical Usage

Message boxes are used to provide informative feedback to the user, or, alternatively, to ask the user a question which requires a "yes, no" or "ok, cancel" type answer.

Parameters

General Tab

Message to display

Text, required
MARKUP: MESSAGETEXT="The contents of the variable is %VARNAME%"

Specifies the text to be displayed in the message box.

 

Title of the message box

Text, optional Default (blank)
MARKUP: WINDOWTITLE="QUESTION"

Specifies the title of the message box dialog.

 

Bring message to front of all other windows

Yes/No, Optional - Default - YES
MARKUP: WINDOWINFRONT="NO"

 

If set to YES, specifies that the input box will appear in front of all other open windows.

 

Buttons Tab

Buttons contained in the message box

Text [options], Optional - Default "ok"
MARKUP: BUTTONS="yes_no"

Specifies the button or array of buttons that should be displayed on the message box. Different parameters appear depending on the option chosen.

The available options are:

 

Button selected by default

Number, Optional - Default 0
MARKUP: DEFAULTBUTTON=2

Specifies number of the button (from left to right) that should be focused by default. The number specified must be the same as or lower than the total number of buttons on the message box. For example, if Yes, No is selected from the Buttons contained in the message box parameter, first specifies the Yes button and second specifies the No button.

 

On First Button Click

text [options], Optional - Default "continue"
MARKUP: ONFIRSTBUTTONCLICK="stop"

Specifies the action that should take place when the first (from left to right) button is clicked.

The available options are:

 

On First Button Click Task to Start

text, Optional - Default (none)
MARKUP: ONFIRSTBUTTONCLICKTASK="c:\foldername\taskname.aml"

Specifies the task that should be run when the button is clicked. Valid only if Start the task parameter is selected.

 

On Second Button Click

text [options], Optional - Default "continue"
MARKUP: ONSECONDBUTTONCLICK="stop"

Specifies the action that should take place when the second (from left to right) button is clicked.

The available options are:

 

On Second Button Click Task to Run

text, Optional - Default (none)
MARKUP: ONSECONDBUTTONCLICKTASK="c:\foldername\taskname.aml"

Specifies the task that should be run when the button is clicked. Valid only if Start the task parameter is selected.

 

On Third Button Click

text [options], Optional - Default "continue"
MARKUP: ONTHIRDBUTTONCLICK="stop"

Specifies the action that should take place when the third (from left to right) button is clicked.

The available options are:

 

On Third Button Click Task to Run

text, Optional - Default (none)
MARKUP: ONTHIRDBUTTONCLICKTASK="c:\foldername\taskname.aml"

Specifies the task that should be run when the button is clicked. Valid only if Start the task parameter is selected.

 

Advanced Tab

Position

Text [options], Optional - Default "center"
MARKUP: POSITION="upper_left"

Specifies the button or array of buttons that should be displayed on the message box.

The available options are:

 

X Pos

Number, Optional - Default 0
MARKUP: XPOS="55"

Specifies the X (horizontal) coordinates of the position that the message box dialog should be displayed on the screen. Move the mouse cursor to the desired location on the screen and press the keyboard's INSERT key to capture the position. This option is only valid if POSITION="custom", otherwise it is ignored.

 

Y Pos

Number, Optional - Default 0
MARKUP: YPOS="55"

Specifies the Y (vertical) coordinates of the position that the message box dialog should be displayed on the screen. Move the mouse cursor to the desired location on the screen and press the INSERT key to capture the position. This option is only valid if POSITION="custom", otherwise it is ignored.

The available options are:

 

Execution of the task will stop until a button on the box is clicked

yes/no, Optional - YES
MARKUP: MODAL="no"

Specifies whether task execution should pause until a button is clicked (i.e. "modal") or the task moves on to the next step immediately (i.e. "modeless").

 

Populate variable with return code

text, Optional - Default (none)
MARKUP: RESULTVARIABLE="varname"

Specifies the name of an already created variable that should be populated with the number of the button (from left to right) that has been clicked. This option is valid only if MODAL=yes.

 

Display the Icon in the message box

text [options], Optional - Default "none"
MARKUP: ICON="exclamation"

If enabled, specifies the icon that should be displayed on the input box next to the icon. The icon helps to determine what type of message is being displayed.

The available options are:

 

Automatically press the default button after

number, Optional - Default 0
MARKUP: COUNTDOWNDELAY="0"

If enabled, specifies the amount of time that should elapse before the input box clears itself. If the value is 0, the input box is displayed indefinitely.

The available time values are:

 

Notes

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

 

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMMESSAGEBOX WINDOWTITLE="AutoMate Version" BUTTONS="ok_cancel" ICON="information" COUNTDOWNDELAY="10" ONSECONDBUTTONCLICK="continue" POSITION="upper_left">%GetAutoMateVersion()%</AMMESSAGEBOX>