1.

Solve : Problem With VBS script?

Answer»

i made a script like
Code: [Select]rc = MsgBox("TU Esi Ilze?", vbYesNo, "Tu Esi Ilze")
If rc = 6 Then WScript.Echo "Stulbene"
End if
if rc = 7 then rc = MsgBox("Tevi sauc Laura?", vbYesNo, "Tevi sauc Laura")
If rc = 6 Then WScript.Echo "Stulbene"
End if
If rc = 7 Then rc = MsgBox("Tevi Sauc Samanta?", vbYesNo, "Tevi Sauc Samanta")
If rc = 6 Then WScript.Echo "Stulbene"
End if
If rc = 7 Then rc = MsgBox("Tevi Sauc Gabriela?", vbYesNo, "Tevi Sauc Gabriela")
If rc = 6 Then WScript.Echo "Stulbene"
End if
If rc = 7 Then rc = MsgBox("Tevi Sauc Svens?", vbYesNo, "Tevi Sauc Svens")
If rc = 6 Then WScript.Echo "Krutais !"
If rc = 7 Then WScript.Echo "KURAA DIRSAA TAD ES ESU IEMALDIJIES ?"
End if
but it SENDS me an error
i wanted so if the answer to the question is yes the she will have no questions
if answer is no then go to next questionYou need to review the rules about

IF  ... THEN ... END IF

http://www.tizag.com/vbscriptTutorial/vbscriptif.phpWhen you start tripping over your own code, it's time for another approach 

Code: [Select]arrQuestion = Array("Tu Esi Ilze?", "Tevi sauc Laura?", "Tevi Sauc Samanta?", "Tevi Sauc Gabriela?", "Tevi Sauc Svens?")

For i = 0 To UBound(arrQuestion)
rc = MsgBox(arrQuestion(i), vbYesNo, arrQuestion(i))
If rc = 6 Then
WScript.Echo "Stulbene"
EXIT For
End If
Next

If i = UBound(arrQuestion) + 1 Then
If rc = 6 Then WScript.Echo "Krutais !"
If rc = 7 Then WScript.Echo "KURAA DIRSAA TAD ES ESU IEMALDIJIES ?"
End If

As with your previous post, save the snippet with a vbs extension and run from the command prompt as CSCRIPT scriptname.vbs

Good LUCK.



Discussion

No Comment Found