Sign in to follow this  
Followers 0
Kreatorul

Msgbox Problem

2 posts in this topic

$input=InputBox("Question", "What is my name?")
$answer="Name here"
If $input=$answer Then MsgBox (0, "Good", "Good answer" )

I need help how to do if $input doesen't match $answer Then MsgBox(0, "Bad", "Bad answer")

I don't know what comand to use if the answer doesen't match...help pls. :think:

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

??

$input = InputBox("Question", "What is my name?")
$answer = "Name here"
If $input = $answer Then 
    MsgBox (0, "Good", "Good answer")
Else
    MsgBox(0, 'Error', 'Wrong Answer')
EndIf

Edit:

If you want them to keep doing the input box until they get it right, I guess you could put it in a loop also.

Local $count = 0
While 1
    Local $input = InputBox("Question", "What is my name?")
    Local $answer = "Name here"
    If $input = $answer Then 
        MsgBox (0, "Good", "Good answer")
        ExitLoop
    Else
        MsgBox(0, 'Error', 'Wrong Answer')
        $count = $count + 1
        If $count = 3 Then
            MsgBox(0, 'Error', 'You have attempted 3 times to enter correct password, you will now be exited')
            Exit
        Else
            ContinueLoop
        EndIf
    EndIf
WEnd
Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0