_Kurt Posted November 3, 2006 Share Posted November 3, 2006 (edited) I basically need to know if the user pressed the button 5 times with no success. Think of it as 5 attempts to log on and no success. How do I make this 'If' statement? Do I use If, Else, EndIf? Select, Case, EndSelect?Need some help,Kurt*EDIT: Spelling* Edited November 3, 2006 by _Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
Rad Posted November 3, 2006 Share Posted November 3, 2006 I basically need to know if the user pressed the button 5 times with no success. Think of it as 5 attempts to log on and no success.Do you mean you log on in your script, or in another program?The way I would do it, use a timer when you first press a button, set a boolean to true, if they press the button again before the timer is say... 500ms, then it restarts and adds 1 to a variable(counter). If the counter makes it to 5, then.. do your stuff, if the timer exceeds 500 then they werent in synch (i guess)Sry I dont have time to make a script with this though Link to comment Share on other sites More sharing options...
NELyon Posted November 3, 2006 Share Posted November 3, 2006 (edited) Global $Count = 0 While 1 If @Error then $Count =+1 If $Count = 5 Then MsgBox(0, "", "Error, maximum errors exceeded") WEnd Untested EDIT: Darn, Rad was too fast Edited November 3, 2006 by codemyster Link to comment Share on other sites More sharing options...
_Kurt Posted November 3, 2006 Author Share Posted November 3, 2006 (edited) Do you mean you log on in your script, or in another program?In my script, and could you give me a little more detail for an example please?Thanks,Kurt Edited November 3, 2006 by _Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
Rad Posted November 3, 2006 Share Posted November 3, 2006 (edited) Ugh alright this is all I can give you, now I gotta go ... May need some tweaking, but it worked #include <misc.au3> $i = 0 ;While this is 1 its ready to start the button press thing.. Hotkeyset("x", "xpress") $timer = TimerInit() TimerStop($timer) ;enable the timer, and disable so it doesnt start $presscount = 3 ;number of times to press the button While 1 If TimerDiff($timer) > 800 Then ;delay between successful clicking... thing $i = 0 $count = 0 TimerStop($timer) EndIf WEnd func xpress() ;lol express If $i = 0 Then $timer = TimerInit() ;starts the timer $i = 1 ;enables the counter Else TimerStop($timer) $timer = TimerInit() ;restart the timer $count = $count + 1 if $count >= $presscount Then ;basically if you pressed the number x times $i = 0 $count = 0 TimerStop($timer) msgbox(0, "Done", "You pressed x " & $presscount & " times") EndIf Endif EndFunc Good luck edit- added some comments maybe its more understandable. Also, if you have to press it 4 times instead of 3, then make it add 1 in the If...(here)...else...endif of the func (It doesnt add 1 when you first click) Edited November 3, 2006 by Rad Link to comment Share on other sites More sharing options...
_Kurt Posted November 3, 2006 Author Share Posted November 3, 2006 (edited) Thanks for the help Rad, but Codemyster's code helped me the most, and it was alot shorter too I just made some slight modifications: Global $Count = 0 While 1 If $Count = 5 Then MsgBox(0, "", "Error, maximum errors exceeded") Select Case $msg = $login ;If user clicks on Login Button If GUICtrlRead($text) = $pass Then ;whatever you want Else $Count = $Count + 1 EndIf EndSelect WEnd Thanks for all your help Rad and Codemyster!! Kurt Edited November 3, 2006 by _Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
Rad Posted November 3, 2006 Share Posted November 3, 2006 Oh... I thought you meant pressing a button ie.. a key =( Oh well glad its working for you 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