user1914378
user1914378

Reputation:

Remove countdown from vbscript yes-no Box

I have this script that will display a yes-no box with a 30 second countdown, and if the user has not selected an option after the time is up, then the VBScript automatically selects the option "Yes" and returns to a Batch Script.

How do I remove the countdown part from the script, so that it will not default to "Yes", but instead wait until input is given.

Many Thanks

Option Explicit
Dim oShell, retCode
Set oShell = WScript.CreateObject("WScript.Shell")

retCode = oShell.Popup("Place your question here?", 30, "Title", 4 + 32)

Select Case retCode
case 6, -1
    WScript.quit(0) 'Yes or time-out was chosen
case 7
    WScript.quit(1) 'No was chosen
End Select

vbscript taken from http://www.msfn.org/board/topic/138818-vbscript-msgbox-with-auto-select-countdown-and-batch-script-input/

Upvotes: 2

Views: 1451

Answers (1)

user1914378
user1914378

Reputation:

This should be the answer, for more reference: WScript.Shell.Popup

Dim oShell, retCode
Set oShell = WScript.CreateObject("WScript.Shell")

retCode = oShell.Popup("Place your question here?", 0, "Title", 4 + 32)

Select Case retCode
case 6, -1
WScript.quit(0) 'Yes or time-out was chosen
case 7
WScript.quit(1) 'No was chosen
End Select`

Upvotes: 1

Related Questions