Hawkwing Posted January 20, 2009 Share Posted January 20, 2009 I am trying to make a script end with a password, but it won't recognize when I press the button. CODEFunc end () GUICreate ("Password", 435, 30, 570, 50) $input = GUICtrlCreateInput ("", 5, 5, 400, "", $ES_PASSWORD) $ok = GUICtrlCreateButton ("OK", 410, 03) GUICtrlSetOnEvent (-1, "guiokpress") GUISetState (@SW_SHOW) EndFunc Func guiokpress () If GUICtrlRead ($input) = "password" Then Exit Else ToolTip ("Incorrect password") EndIf EndFunc The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
rasim Posted January 20, 2009 Share Posted January 20, 2009 @pigeekYou forgotten to change the event mode:Opt("GUIOnEventMode", 1) Link to comment Share on other sites More sharing options...
Hawkwing Posted January 20, 2009 Author Share Posted January 20, 2009 Thanks, I can't believe it was such a simple mistake. The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
Hawkwing Posted January 20, 2009 Author Share Posted January 20, 2009 I finally got it to work. CODEFunc end () Opt ("GUIOnEventMode", 1) GUICreate ("Password", 435, 30, 570, 50) $input = GUICtrlCreateInput ("", 5, 5, 400, "", $ES_PASSWORD) $ok = GUICtrlCreateButton ("OK", 410, 03) GUICtrlSetOnEvent (-1, "guiokpress") GUISetState (@SW_SHOW) EndFunc Func guiokpress () local $input If GUICtrlRead ($input) = "password" Then ;for some reason you must have the "password" in this line. For instance, if you wanted your password to be "iwantthisscripttoend" you would have to have ($input) = "passwordiwantthisscripttoend. Exit Else ToolTip ("Incorrect password") EndIf EndFunc The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
Hawkwing Posted January 20, 2009 Author Share Posted January 20, 2009 Never mind, I didn't test it thoroughly. Now it accepts anything as the correct password. The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
Hawkwing Posted January 20, 2009 Author Share Posted January 20, 2009 I have this: CODEFunc end () Opt ("GUIOnEventMode", 1) GUICreate ("Password", 435, 30, 570, 50) $input = GUICtrlCreateInput ("", 5, 5, 400, "", $ES_PASSWORD) $ok = GUICtrlCreateButton ("OK", 410, 03) GUICtrlSetOnEvent (-1, "guiokpress") GUISetState (@SW_SHOW) EndFunc Func guiokpress () If GUICtrlRead ($input) = "password" Then Exit Else ToolTip ("Incorrect password") EndIf EndFunc but when I press OK it says that I used a variable that wasn't stated. The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again. Link to comment Share on other sites More sharing options...
rasim Posted January 20, 2009 Share Posted January 20, 2009 pigeekMake a small and working example, which duplicate the problem. 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