Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

None

<intro text>

Trigger Setup

This page will look at some of the basic messaging options available in native VBScript. The MsgBox control can be used in several ways for messaging in VBScript.

We will cover the following:

  • Basic Message

  • Basic Message with Title and Button

  • Basic Message with Feedback from the User

  • Basic Message

To start things off, the first script we will get into is a simple message to the operator in the form of a message box window. In its most basic form, we only need to supply one parameter, that is the message to be displayed.

VBScript

MsgBox “This is a simple message to the Operator.”

Parameters

“This is a simple message to the Operator” – Message to display in the window.

Output

Image Added
Info

If you don’t like reading, you can watch the video.

Panel
panelIconId1f3a5
panelIcon:movie_camera:
panelIconText🎥
bgColor#DEEBFF

No videohttps://youtu.be/o7haVa5T-Uw

premium_VBSCRIPTING_product_userguide_UG - v0.12.pdf

Try it!

<content>

Basic Message with Title & Buttons

In this example, we will take the message box a little further, by making it look like a little button with a title as well as specifying the buttons we want to show to the operator. In this case we will stick to the Ok button, but as shown below the value supplied in the second parameter will determine the button(s) that will be displayed.

VB Script

MsgBox “This is a simple message to the Operator”,0,“Title”

Parameters

“This is a simple message to the Operator” – Message to display in the window.

0 – Ok Button (other options shown below)

Image Added

“Title” – Title to display at the top.

Output

Image Added

Basic Message with Feedback from the user

In this example we will take the message box one step further, asking the operator for some input. In this case a Yes/No answer. For this script we will need a variable to be defined to store the response. Once the input is obtained it will be placed into that variable and then the variable will be shown using a message box so we can see its value. The response values work in a similar way to the buttons with a numeric value representing the response options, mapping shown below.

VBScript

    dim answer

    answer = msgbox “Would you like to continue?”,4,“Confirmation”

    msgbox “You answered: “ & answer.

Parameters:

“Would you like to continue?” – Message to display in the window

4 – Yes/No button

“Confirmation” – Title of the widow

Output

Image Added

Click “Yes”

Image Added

Click “No”

Image Added

Output values are based on the following mapping.

Image Added

Let’s review sample Scripts of how other functions within VBScripting works - Before/After Events