PopUp
Use PopUp to display a popup message box.
Dim WshShell, BtnCode
Set WshShell = WScript.CreateObject("WScript.Shell")
BtnCode = WshShell.Popup("Is your name Bob?", 5, "Answer This Question:", 4 + 32)
Select Case BtnCode
case 6 WScript.Echo "Hello Bob."
case 7 WScript.Echo "Oh, I must have you confused with someone else."
case -1 WScript.Echo "Hello, are you there?"
End Select
This statement will popup a dialog box with the following attributes:
Body Text: "Is your name Bob?"
Title Bar Text: "Answer this Question"
Icon: "Question Mark"
Buttons: "Yes and No"
Timout After: "5 seconds"
The exit codes for this PopUp box will be:
6: "The YES button was clicked"
7: "The NO button was clicked"
-1: "No buttons were clicked, and the popup box timed out after 7 seconds"
Where the 5 appears in the above example, this is the timeout value. It is optional.
You can use the following values with a PopUp Function
Buttons
(Displayed in PopUp Window)
Button Value |
Buttons Displayed in PopUp Window |
0 |
Show OK button. |
1 |
Show OK and Cancel buttons. |
2 |
Show Abort, Retry, and Ignore buttons. |
3 |
Show Yes, No, and Cancel buttons. |
4 |
Show Yes and No buttons. |
5 |
Show Retry and Cancel buttons. |
Icons
(Displayed in PopUp Window)
| Icon Value |
Icon Displayed in PopUp Window |
16 |
Show "Stop Mark" icon. |
32 |
Show "Question Mark" icon. |
48 |
Show "Exclamation Mark" icon. |
64 |
Show "Information Mark" icon. |
Exit Codes
(These values will be produced when a button is clicked or timeout occurs)
Exit Code Produced |
Button Clicked or Timeout |
1 |
OK button |
2 |
Cancel button |
3 |
Abort button |
4 |
Retry button |
5 |
Ignore button |
6 |
Yes button |
7 |
No button |
-1 |
Timeout (no button click) |
Become a Member
Start learning about VBScript right now!
Become a Member and begin downloading our VBScript Videos Immediately!
These VBScript Videos are from our VBScript Product
|