Jump to content

Password Problem !!


Guest AX5
 Share

Recommended Posts

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
Link to comment
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
Link to comment
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
Link to comment
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:

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...