Application of the vbs popup Method

Source: Internet
Author: User

'Ms-help: // Ms. msdnqtr. v90.en/script56/html/wsmthpopup.htm
'Popup method: displays text in a pop-up message box.
'Intbutton = object. Popup (strtext, [nsecondstowait], [strtitle], [ntype])
'Wshshell object.
'String value containing the text you want to appear in the pop-up message box.
'Optional. Numeric value indicating the maximum length of time (in seconds) You want the pop-up message box displayed.
'Optional. String Value containing the text you want to appear as the title of the pop-up message box.
Const wshokdialg = 0
Const wshokcanceldialog = 1
Const wshabortretryignoredialog = 2
Const wshyesnocanceldialog = 3
Const wshyesnodialog = 4
Const wshretrycanceldialog = 5
Const wshstopmark = 16
Const wshquestionmark = 32
Const wshexclamationmark = 48
Const wshinformationmark = 64
'Optional. Numeric value indicating the type of buttons and icons you want in the pop-up message box.
'These determine how the message box is used.
Const wshok = 1
Const wshcancel = 2
Const wshabort = 3
Const wshretry = 4
Const wshingore = 5
Const wshyes = 6
Const wshno = 7
Const wshdefault =-1
'Integer value indicating the number of the button the user clicked to dismiss the message box.
'This is the value returned by the popup method.
'The popup method displays a message box regardless of which host executable file is running
'(Wscript.exe or cscript.exe). If nsecondstowaitis equals zero (the default ),
'The pop-up message box remains visible until closed by the user. If nsecondstowaitis is greater than zero,
'The pop-up message box closes after nsecondstowait seconds. If you do not supply the argument strtitle,
'The title of the pop-up message box ults to "Windows Script Host ."

Dim wshshell
Set wshshell = Createobject ("wscript. Shell ")
Intreturn = wshshell. Popup ("Do you want to delete this file? ",_
5, "delete file", wshyesnodialog + wshexclamationmark)

Select case intreturn
Case 6 wscript. Echo "Yes BTN clicked ."
Case 7 wscript. Echo "No BTN clicked ."
Case-1 wscript. Echo "the popup timed out ."
End select

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.