Script to utilize Menu options and pressing an incorrect key....
Hi all. I'm getting this scripting thing down, but I can't seem to
find any info on the following:
I have created as script that prompts the user for 4 options. What I
can't figure out though, is how to script it where if the user doesn't
select 0, 1, 2, or 3, the script will prompt the user to input a
correct selection. For example, if a user fat fingers his key and
selects 5 instead of 2, the script just quits. I want it to pop up a
message box saying "Incorrect key pressed, please select again"
My Script is below, keep in mind this is just a snippet of the script.
Thanks in advance.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ROLE.Add "0", "First Option"
ROLE.Add "1", "Second Option"
ROLE.Add "2", "Third Option"
ROLE.Add "3", "Quit"
'Create menu to display.
For Each Key in ROLE
Menu = Menu & Key & " ----> " & ROLE(Key) & vbCRLF & vbCRLF
Next
'Get user choice from menu items.
Choice = InputBox("Text Line 1 " &_
"Text Line 2." & vbCRLF &_
vbCRLF & vbCRLF & Menu, "Message Box Title", "0")
If Choice = "0" Then
wscript.echo "You picked the first option"
end if
If Choice = "1" Then
wscript.echo "You picked the second option"
end if
If Choice = "2" Then
wscript.echo "You picked the third option"
end if
If Choice = "3" Then
wscript.echo "Script has been terminated."
wscript.quit()
end if
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|