VBScript Pop-Up DialogsVBScript provides two built-in functions that allow you to add pop-up dialogs that you can use in your VBScripts to communicate with users. You can call on these functions to execute within your scripts just like you would any function that you wrote yourself.These two functions are available regardless of whether you are embedding your VBScripts into HTML pages or writing WSH scripts. Both of these functions are described here.
· MsgBox(). A procedure that executes and then returns a result to the statement that called it.
· InputBox(). A procedure that executes but that does not return a result.
§ The types of buttons to display
§ The type of icon to be displayed in the dialog
§ The button to be selected by default
§ The modality of the dialog
· MsgBox(). A procedure that executes and then returns a result to the statement that called it.
· InputBox(). A procedure that executes but that does not return a result.
The VBScript MsgBox Function
The MsgBox function provides a way for you to display a pop-up dialog and ask the user to respond by clicking the appropriate button. The syntax of the MsgBox function is shown here.MsgBox(prompt [, buttons] [, title] [, helpfile, context])Prompt is the text message displayed by the dialog and can be as many as 1,024 characters long. Button is a numeric expression or value that is the sum of a number of other values that specify.§ The types of buttons to display
§ The type of icon to be displayed in the dialog
§ The button to be selected by default
§ The modality of the dialog
Option Explicit Dim myResponse myResponse = MsgBox("Do you wish to quit?", 1, "What do you wish to do?")
The VBScript InputBox Function
The InputBox() function provides a way for you to display a pop-up dialog that prompts the user to supply text input. The InputBox allows you to ask the user questions and collect text input. The syntax of the InputBox() function is shown here.InputBox(prompt [, title] [, default] [, xpos] [, ypos] [, helpfile, context])For example, the following statements prompt the user to type the name of the country in which he or she resides.Option ExplicitDim myInput myInput = InputBox("What country do you reside in?")
No comments:
Post a Comment