Sign in to follow this  
Followers 0
Guest AX5

Password Problem !!

7 posts in this topic

Im having problem to add more then 1 password to my script.

I try ed

And $text <>
but it gets error

Case $Button2
            If GUICtrlRead($Input1) <> "123" Then
                GUICtrlSetData($Input1, "")
                If MsgBox(4096+1, "Error", "Password is incorrect. Try One More Time?") = 2 Then
                    Exit
                Else
                    GUICtrlSetState($Input1, $GUI_FOCUS)
                EndIf
            Else
                GUICtrlSetState($Button1, $GUI_ENABLE)
                GUICtrlSetState($Button2, $GUI_HIDE)
                GUICtrlSetState($Input1, $GUI_HIDE)
                MsgBox(0, "Valid Key", "You enter a valid key")
            EndIf

Share this post


Link to post
Share on other sites



This

Case $Button2
            If GUICtrlRead($Input1) <> [b]"123" And $text <> "124563" And $text <> "124564563"[/b] Then
                GUICtrlSetData($Input1, "")
                If MsgBox(4096+1, "Error", "Password is incorrect. Try One More Time?") = 2 Then
                    Exit
                Else
                    GUICtrlSetState($Input1, $GUI_FOCUS)
                EndIf
            Else
                GUICtrlSetState($Button1, $GUI_ENABLE)
                GUICtrlSetState($Button2, $GUI_HIDE)
                GUICtrlSetState($Input1, $GUI_HIDE)
                MsgBox(0, "Valid Key", "You enter a valid key")
            EndIf

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

---

Edited by playlet

Share this post


Link to post
Share on other sites

It would help if you posted the rest of he script. Anyway, try this:

If $guictrlread <> "123" Or $guictrlread <> "124563" Or $guictrlread <> "124564563" Then
That's a logic error. The string will always NOT be one of them, so it evaluates always true. You had the right idea about reading the control into a variable first. Might be easier syntax with Switch:
Case $Button2
    Switch GUICtrlRead($Input1)
        Case "123", "124563", "124564563"
            GUICtrlSetState($Button1, $GUI_ENABLE)
            GUICtrlSetState($Button2, $GUI_HIDE)
            GUICtrlSetState($Input1, $GUI_HIDE)
            MsgBox(0, "Valid Key", "You enter a valid key")
        Case Else
            GUICtrlSetData($Input1, "")
            If MsgBox(4096 + 1, "Error", "Password is incorrect. Try One More Time?") = 2 Then
                Exit
            Else
                GUICtrlSetState($Input1, $GUI_FOCUS)
            EndIf
    EndSwitch

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

That's a logic error. The string will always NOT be one of them, so it evaluates always true. You had the right idea about reading the control into a variable first. Might be easier syntax with Switch:

Case $Button2
    Switch GUICtrlRead($Input1)
        Case "123", "124563", "124564563"
            GUICtrlSetState($Button1, $GUI_ENABLE)
            GUICtrlSetState($Button2, $GUI_HIDE)
            GUICtrlSetState($Input1, $GUI_HIDE)
            MsgBox(0, "Valid Key", "You enter a valid key")
        Case Else
            GUICtrlSetData($Input1, "")
            If MsgBox(4096 + 1, "Error", "Password is incorrect. Try One More Time?") = 2 Then
                Exit
            Else
                GUICtrlSetState($Input1, $GUI_FOCUS)
            EndIf
    EndSwitch

:D

it Works Thx all :huggles:

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