layer Posted January 25, 2005 Share Posted January 25, 2005 (edited) hey folks, could someone explain to me why this loop hapens for ever?!?!?!? Func Generate () $read= GUICtrlRead ($char) GUICtrlSetLimit ($pw, $read) For $i = $read to 1 Step -1 $pass= Chr(Random(Asc("a"), Asc("z"), 1)) Next GuictrlSetData ($pw, $pass, 1) ControlClick ("Random Generator", "Make", $make, "left", 1) EndFunc it seems the contolclick never stops... please help thanks -layer o ney ney EDIT: and removing the ControlClick... when the number is generated, that just keeps doing numbers and skips the letters Edited January 25, 2005 by layer FootbaG Link to comment Share on other sites More sharing options...
CyberSlug Posted January 25, 2005 Share Posted January 25, 2005 The For-Next loop won't happen forever. How are you calling the Generate() function? Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
layer Posted January 25, 2005 Author Share Posted January 25, 2005 #include <GUIConstants.au3> GUICreate ("Random Generator", 200, 100) GUISetState () $char= GUICtrlCreateInput ("# of characters outputted", 10, 20, 140) $make= GUICtrlCreatebutton ("Make", 10, 60) $pw= GUICtrlCreateEdit ("", 70, 63.5, 125, 20, $ES_READONLY) GUICtrlCreateLabel ("Output:", 135, 40) GUICtrlSetState ($char, $GUI_FOCUS) Send ("^a") While 1 $get= GUIGetMsg () If $get= $make then Generate () If $get= -3 then Exit WEnd Func Generate () $read= GUICtrlRead ($char) GUICtrlSetLimit ($pw, $read) For $i = $read to 1 Step -1 $pass= Chr(Random(Asc("a"), Asc("z"), 1)) Next GuictrlSetData ($pw, $pass, 1) ControlClick ("Random Generator", "Make", $make, "left", 1) EndFunc FootbaG Link to comment Share on other sites More sharing options...
CyberSlug Posted January 25, 2005 Share Posted January 25, 2005 Why do you call ControlClick inside the Generate function? By doing that you ensure that If $get= $make is always true (because you keep feeding it it button click notifications). Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
layer Posted January 25, 2005 Author Share Posted January 25, 2005 but i need it there unless i want the user to keep pressing make for how ever many characters they want any suggestions FootbaG Link to comment Share on other sites More sharing options...
layer Posted January 25, 2005 Author Share Posted January 25, 2005 HAHA stupid me.... #include <GUIConstants.au3> GUICreate ("Random Generator", 200, 100) GUISetState () $char= GUICtrlCreateInput ("# of characters outputted", 10, 20, 140) $make= GUICtrlCreatebutton ("Make", 10, 60) $pw= GUICtrlCreateEdit ("", 70, 63.5, 125, 20, $ES_READONLY) GUICtrlCreateLabel ("Output:", 135, 40) GUICtrlSetState ($char, $GUI_FOCUS) Send ("^a") While 1 $get= GUIGetMsg () If $get= $make then Generate () ControlClick ("Random Generator", "Make", $make, "left", 1) EndIf If $get= -3 then Exit WEnd Func Generate () $read= GUICtrlRead ($char) GUICtrlSetLimit ($pw, $read) For $i = $read to 1 Step -1 $pass= Chr(Random(Asc("a"), Asc("z"), 1)) Next GuictrlSetData ($pw, $pass, 1) EndFunc thanks CS FootbaG Link to comment Share on other sites More sharing options...
layer Posted January 25, 2005 Author Share Posted January 25, 2005 actually no.... i didnt... any suggestions FootbaG Link to comment Share on other sites More sharing options...
SlimShady Posted January 25, 2005 Share Posted January 25, 2005 (edited) Fixed. #include <GUIConstants.au3> GUICreate ("Random Generator", 200, 100) $char= GUICtrlCreateInput ("# of characters outputted", 10, 20, 140) $make= GUICtrlCreatebutton ("Make", 10, 60) $pw= GUICtrlCreateEdit ("", 70, 63.5, 125, 20, $ES_READONLY) GUICtrlCreateLabel ("Output:", 135, 40) GUISetState () GUICtrlSetState ($char, $GUI_FOCUS) While 1 $get= GUIGetMsg () If $get= $make then Generate () EndIf If $get= -3 then Exit WEnd Func Generate () $read= GUICtrlRead ($char) If NOT StringIsDigit($read) Then Return $read= Number($read) GuictrlSetData ($pw, "") GUICtrlSetLimit ($pw, $read) For $i = 1 To $read $pass= Chr(Random(Asc("a"), Asc("z"), 1)) GuictrlSetData ($pw, $pass, 1) Next EndFunc Edited January 25, 2005 by SlimShady Link to comment Share on other sites More sharing options...
layer Posted January 25, 2005 Author Share Posted January 25, 2005 thanks slim, i see what the problem was now FootbaG 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