MessageBox

Item Description

Use with:

Startup scripts, Terminal Launcher, Web, Windows

SecureLogin Version:

All

Type:

Action

Usage:

MessageBox [-YesNo] [-YesNoCancel] ?Variable [-Background] [-DefaultNo] Data

Arguments:

[-YesNo]


[-YesNoCancel]


?Variable



[-Background]


[-DefaultNo]


Data

Allows the user to select either Yes or No within the message box rather than being limited only to an OK button.

Allows the user to select either Yes, No, or Cancel when a message box is presented.

Required with the -YesNo or -YesNoCancel flag to store the result of the user action.

When specified, allows the user to open an application and work in that application, without having to respond to the MessageBox.

If this parameter is not used, the MessageBox remains the topmost window and the user must respond to the MessageBox before continuing with any other work.

An optional parameter, used only with the -YesNo and -YesNoCancel flags. When the -DefaultNo parameter is set, default focus goes to the No button instead of to the Yes button.

The text to be displayed to the user.

Description:

Displays a dialog box that contains the text specified in the Data variable. The script is suspended until the user reacts to this message. As the following line illustrates, MessageBox can take any number of text arguments, including variables:

MessageBox "The User "$Username" has just been logged into the system"

You can set the -YesNo flag when calling a MessageBox. If the -YesNo flag is set, the MessageBox prompts the user with a box that has a Yes and a No button rather then an OK button.

You can capture the result of the MessageBox immediately after the flag by using a runtime ?Variable. The variable value is set to Yes, No, or Cancel.

Syntax Examples:

MessageBox "Script completed successfully"
MessageBox -YesNo ?Result "Do you want to continue?"
MessageBox -YesNoCancel ?Result -Background -DefaultNo "Do you want to continue?"

Example 1:
Windows Script
SecureLogin detects the password dialog box, asks the user whether the user wants to change the password, and informs the user that the change was successful.

# Change Password Dialog Box 
Dialog
Title "Change Password"
Class #32770
EndDialog
MessageBox -YesNo ?Result "Your password has expired. Would you like to change it now?"
If ?Result Eq "Yes" 
Type $Username #1015
Type $Password #1004
ChangePassword $Password Random
Type $Password #1005
Type $Password #1006
Click #1
MessageBox "Password changed successfully"
Else
Click #2
MessageBox "You elected not to change your password."
EndIf

Example 2:
Terminal Launcher Script

Message boxes can be useful when troubleshooting scripts. The boxes can be displayed before each step in the script to enable the writer to see where the script fails to execute.

NOTE:  The WaitForText command cuts off the first character because it will find both Password and password and respond to all password entry points.

MessageBox "Beginning wait for Login prompt" 
WaitForText "ogin:"
MessageBox "Login detected, now entering Username"
Type $Username
MessageBox "Username entered, now simulating Enter"
Type @E
MessageBox "Enter has been simulated. Now waiting for Password"
WaitForText "assword:"
MessageBox "Password detected, now entering Password"
Type $Password
MessageBox "Password entered, now simulating Enter"
Type @E
MessageBox "Sequence completed. The user should now be logged in"