Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Select Option Popup Dialogue
 

Vbscript / User Interaction / Select Option Popup Dialogue

Use the Shell Popup method to get user input in a variety of ways. The input options are listed below:

Icons  =  Constant Name - Constant Value
STOP  =  vbCritical  - 16
QUESTION MARK =  vbQuestion  - 32
EXCLAMATION MARK = vbExclamation  - 48
INFORMATION  = vbInformation -  64

Buttons = Constant Name - Constant Value
OK = vbOKOnly -  0
OK and CANCEL =  vbOKCancel -  1
ABORT, RETRY and IGNORE = vbAbortRetryIgnore - 2
YES, NO and CANCEL = vbYesNoCancel -  3
YES and NO = vbYesNo -  4
RETRY and CANCEL = vbRetryCancel  - 5


Set objShell = WScript.CreateObject("WScript.Shell")

Timeout = 5

var = "Yes"

Msg = "Choose an option to continue. If you do not choose in " & Timeout & " seconds, the default option of " & var & " will be used"
Title = "Select Option"

iRetVal = objShell.Popup(Msg,Timeout,Title,vbYesNo + vbQuestion)

Select Case iRetVal

 Case vbYes
 
 var = "Yes"

 Case vbNo

 var = "No"

 Case -1    

Wscript.Echo "Time out!"
  
End Select

Wscript.Echo "You chose " & var





Please note that a disclaimer applies to any code on this page.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
     - Exchange
     - Files And Folders
     - General
     - Ms Office
     - Operating System
     - Processes And Services
     - Text Processing
     - User Interaction
          - Browse For File Dialogue Box
          - Browse For Folder Dialogue Box
          - Convert Byte Value To Kb-mb-gb-tb
          - Copy Text To Clipboard
          - Select Option Popup Dialogue
     - Web Servers