Guest AX5 Posted January 14, 2010 Share Posted January 14, 2010 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 More sharing options...
Developers Jos Posted January 14, 2010 Developers Share Posted January 14, 2010 what exactly "gets error" ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Guest AX5 Posted January 14, 2010 Share Posted January 14, 2010 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 More sharing options...
Developers Jos Posted January 14, 2010 Developers Share Posted January 14, 2010 where is $text set? What is the error? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
playlet Posted January 14, 2010 Share Posted January 14, 2010 (edited) --- Edited August 18, 2016 by playlet Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 14, 2010 Share Posted January 14, 2010 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 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 More sharing options...
Guest AX5 Posted January 14, 2010 Share Posted January 14, 2010 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 it Works Thx all Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now