Thursday, May 15, 2008

Windows Script 2

'**************************************
'File : UserInput.vbs
'
'The Script implement user Input
'& MessageBox with VBScript
'**************************************

Option Explicit
'declare several variable
Dim Msg, Result
Dim Title, Text1, Text2
Dim Check

Check = TRUE

'define dialog box variables

Msg = "Please Input your Name."
Title = "WSH Sample User Input"
Text1 = "User Input is canceled!"
Text2 = "Hi "

do while Check=TRUE
'Using the InputBox function
Result = InputBox(Msg, Title, "Inge", 100, 100)

'Evaluate input
If Result = "" then
WScript.Echo Text1
Else
WScript.Echo Text2 + Result + "!"
End If

Msg = "Try Again."
Title = "MsgBoxDemo"

if MsgBox(Msg, _
vbYesNo + vbQuestion, _
Title) = vbYes then
Check = TRUE
Else
Check = FALSE
MsgBox "Bye-bye!"
End If
Loop

WScript.Quit()

'End

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...