earthwarder Posted July 11, 2015 Share Posted July 11, 2015 (edited) Global $iLoop = True HotKeySet("{ESC}", "_ExitLoop") Func Button1() $iLoop = True While $iLoop Sleep(2500) MouseClick ("left") WEnd $iLoop = False EndFunc Func _ExitLoop() $iLoop = False EndFuncI want this to left click in a loop until I hit the key esc but it doesnt seem to be working. Although it does left click, i just cant get it to stop! Edited July 11, 2015 by earthwarder Link to comment Share on other sites More sharing options...
Developers Jos Posted July 11, 2015 Developers Share Posted July 11, 2015 (edited) This script never starts Button1(), so please shown a script that actually demonstrates the problem.Jos Edited July 11, 2015 by Jos 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...
earthwarder Posted July 11, 2015 Author Share Posted July 11, 2015 (edited) oops Edited July 13, 2015 by earthwarder Link to comment Share on other sites More sharing options...
Developers Jos Posted July 11, 2015 Developers Share Posted July 11, 2015 I have no idea why you changed the script to what you show in the last post and all I was saying is that your first script was not complete and can never have done a mouseclick as the Button1() func was never called.This works fine for me:Global $iLoop = True HotKeySet("{ESC}", "_ExitLoop") Func Button1() $iLoop = True While $iLoop ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $iLoop = ' & $iLoop & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Sleep(2500) ;~ MouseClick ("left") WEnd $iLoop = False EndFunc Func _ExitLoop() $iLoop = False EndFunc Button1()Jos 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...
earthwarder Posted July 13, 2015 Author Share Posted July 13, 2015 (edited) Oh, yes that totally makes sense. Thank you.I have taken it a little further with another hotkey for starting it and exiting, but I wanted to try to add a pause. I can play and exit just fine, but the pause I'm trying to implement isn't working. Here's what I got so far.HotKeySet("{F1}", "PlayScript") HotKeySet("{ESC}", "ExitScript") HotKeySet("{F2}", "PauseScript") Global $iLoop = True Global $Pause While 1 WEnd Func Playscript() $iLoop = True While $iLoop Sleep(2500) MouseClick("left") WEnd $iLoop = False EndFunc Func ExitScript() $iLoop = False Exit EndFunc Func TogglePause() $Paused = Not $Paused While $Paused sleep(100) ToolTip("Script is Paused!,0,0) WEnd ToolTip() EndFunc Edited July 13, 2015 by earthwarder 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