Current time: 02-05-2012, 04:10 PM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need a little help.
09-12-2009, 10:40 PM (This post was last modified: 09-12-2009 10:42 PM by hondabones.)
Post: #1
Need a little help.
I was playing around with this script below. I would assume when the user inputs nothing that the script would instruct the user to try again (line 6). It doesn't seem to work that way. Also how do I get the cancel button and/or "x" button to close and end the script rather than continue with the next line of code.

    VBS Programming
  1. Dim strPassword
  2. strPassword = LCase (InputBox ("Guess the Secret Word!"))
  3. If strPassword = "scripting" Then
  4. MsgBox "Correct"
  5. ElseIf strPassword = " " Then
  6. MsgBox "You have to try, silly."
  7. Else
  8. MsgBox "NOPE!"
  9. End If


undefined
Find all posts by this user
Quote this message in a reply
09-12-2009, 11:27 PM
Post: #2
RE: Need a little help.
You're saying that the user is entering a single space " ". What you want is an empty string "".

Also, pressing the Cancel button returns an empty string as well.

Scripting problems? Windows questions? Ask the Windows Guru!

Stay up to date with all of my latest content. Follow me on Twitter!
[Image: tsig.php]
Help us help you! Post your exact error message with these easy tips!
Visit this user's website Find all posts by this user
Quote this message in a reply
09-12-2009, 11:47 PM
Post: #3
RE: Need a little help.
(09-12-2009 11:27 PM)Nilpo Wrote:  You're saying that the user is entering a single space " ". What you want is an empty string "".

Also, pressing the Cancel button returns an empty string as well.

OK. I will fix the code. As far as the cancel button if it is returning an empty string shouldn't it run line 6 to instruct the user to try? It doesn't however end the script. It treats it as a wrong input and continues with the next line of code.

undefined
Find all posts by this user
Quote this message in a reply
09-13-2009, 10:11 AM
Post: #4
RE: Need a little help.
Read my last post again.

You're also not instructing your script to end anywhere. Trying using WScript.Quit wherever you want it to end.

Scripting problems? Windows questions? Ask the Windows Guru!

Stay up to date with all of my latest content. Follow me on Twitter!
[Image: tsig.php]
Help us help you! Post your exact error message with these easy tips!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


Forum Permissions
You cannot post new threads.
You cannot post replies.
You cannot post attachments.
HTML is turned off.
MyCode is turned on.
Smilies are turned on.
[img] is turned on.