Our Newsletter


Subscribe to our Newsletter and we'll keep you notified of new products, giveaways and discounts.

We respect your email privacy and will never sell or share your details with anyone.


Knowledgebase Home | Glossary | Favorites | Contact | Login Knowledgebase Home | Glossary | Favorites | Contact | Login
Search the Knowledgebase Browse by Category
VBScript PopUp Function
Article Details

Last Updated
23rd of February, 2009

User Opinions (0 votes)
No users have voted.

How would you rate this answer?
Helpful
Not helpful
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)






     
For more information about VBScript, check out our VBScript Training Videos
VBScript Training Videos
     



Visitor Comments
No visitor comments posted. Post a comment
Post Comment for "VBScript PopUp Function"
To post a comment for this article, simply complete the form below. Fields marked with an asterisk are required.
   Your Name:
   Email Address:
* Your Comment:
* Enter the code below:
 
Related Articles
No related articles were found.
Attachments
No attachments were found.