Getting Input (Prompt)
'==========================================================================
'
' NAME: GettingInput02.vbs
' AUTHOR: Neal Walters
' DATE : 2/15/2005
' http://VBScript-Training.com
'
' COMMENT:
'
'==========================================================================
buttons = vbOKOnly ' this is the default, has numeric value of 0
showmsg(buttons)
'------ adding standard icons ----------------
buttons = vbInformation
showmsg(buttons)
buttons = vbExclamation
showmsg(buttons)
buttons = vbQuestion
showmsg(buttons)
buttons = vbCritical
showmsg(buttons)
'------ Changing Buttons Available ----------------
buttons = vbOKCancel
showmsg(buttons)
buttons = vbAbortRetryIgnore
showmsg(buttons)
buttons = vbYesNoCancel
showmsg(buttons)
buttons = vbYesNo
showmsg(buttons)
buttons = vbRetryCancel
showmsg(buttons)
'------ Combining Options ----------------
buttons = vbOKCancel + vbExclamation
showmsg(buttons)
buttons = vbAbortRetryIgnore + vbQuestion
showmsg(buttons)
Function showmsg(buttons)
resultNumber = MsgBox ("your message",buttons,"your title")
Select Case resultNumber
Case vbOK
resultMsg = "OK"
Case vbCancel
resultMsg = "Cancel"
Case vbAbort
resultMsg = "Abort"
Case vbRetry
resultMsg = "Retry"
Case vbIgnore
resultMsg = "Ignore"
Case vbYes
resultMsg = "Yes"
Case vbNo
resultMsg = "No"
End Select
WScript.Echo "Result Number=" & resultNumber & " message=" & resultMsg
End Function
'==========================================================================
'
' NAME: GettingInput03.vbs
' AUTHOR: Neal Walters
' DATE : 2/15/2005
' http://VBScript-Training.com
' COMMENT:
'
'==========================================================================
Dim WshShell, BtnCode
Set WshShell = WScript.CreateObject("WScript.Shell")
BtnCode = WshShell.Popup("Do you feel alright? (You have 4 seconds to answer)", _
4, "Answer This Question:", vbYesNo + vbQuestion)
Select Case BtnCode
case 6 WScript.Echo "Glad to hear you feel alright."
case 7 WScript.Echo "Hope you're feeling better soon."
Case -1 WScript.Echo "You were slow to respond, I assume you are sick!"
End Select
|