Andrew Chen Posted December 2, 2006 Share Posted December 2, 2006 Hello, I was just wondering how I would spam this one command in a loop for 30 seconds. So far I have this: while 1 MouseClick("left", 500, 500) Sleep(5) Wend What would I have to change to make it repeat itself like so, but only for 30 seconds? Link to comment Share on other sites More sharing options...
xcal Posted December 2, 2006 Share Posted December 2, 2006 $start = TimerInit() Do MouseClick("left", 500, 500) Sleep(5) Until TimerDiff($start) > 30000 How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Andrew Chen Posted December 2, 2006 Author Share Posted December 2, 2006 $start = TimerInit() Do MouseClick("left", 500, 500) Sleep(5) Until TimerDiff($start) > 30000 Thanks a lot. O and is there a way to reset this timer? Link to comment Share on other sites More sharing options...
Markus Posted December 2, 2006 Share Posted December 2, 2006 $start = TimerInit() Do MouseClick("left", 500, 500) Sleep(5) If TimerDiff($start) >10000 Then $start = TimerInit() Until TimerDiff($start) > 30000 After 10 seconds you'll get a new timestamp ($start = TimerInit()) and so it will take again 30 seconds until TimerDiff($start) > 30000, but as after 10 seconds, you will have a new timestamp again and again you will never reach TimerDiff($start) > 30000 Of course that's senseless that way, but if you enter a senseful statement for If TimerDiff($start) >10000... it will be useful for your problem. "It's easier to disintegrate an atom than a prejudice." (A.Einstein)---------------------------------------------------------------------------My C++ - tools:Tidy tool-->indents your c++ sourceCleanscript --> cleans autoit-code before compiling (co-author: peethebee)My tools:GUIBuilder-->build your window and get the source; german versionMy Games:OnlineGameCenter-->Online Chess and Connect4 with a rtf-chatSnake-->including a level editor to build your own levelsTetris-->the well known game, big funOther things:Tower of Hanoi-->perfect riddler with graphic output Link to comment Share on other sites More sharing options...
xcal Posted December 3, 2006 Share Posted December 3, 2006 (edited) HotKeySet('!c', 'toggle') ;ALT + c to toggle HotKeySet('{ESCAPE}', 'quit') ;ESC to exit Global $stopped = True ;the script doesn't start immediately While 1 $start = TimerInit() While Not $stopped ToolTip(StringFormat('%.2f', TimerDiff($start) / 1000)) ;YOUR Sleep(50) ;STUFF If TimerDiff($start) > 30000 Then $start = TimerInit() ;HERE WEnd Sleep(100) ToolTip('Script Paused') WEnd Func toggle() $stopped = Not $stopped EndFunc Func quit() ToolTip('Exiting!') Sleep(2000) Exit EndFunc edit - lining up the word "stuff" Edited December 3, 2006 by xcal How To Ask Questions The Smart Way 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