HAWKZX Posted January 13, 2007 Share Posted January 13, 2007 My only other idea, which i am not sure where to look, or how to do it is ...."DO" ABC"UNTIL" DEF"OR UNTIL" X timer (ie 10 mins expires) original thread http://www.autoitscript.com/forum/index.php?showtopic=39393 but the topic changed after it was answered.expandcollapse popupFunc cycle() Sleep(150000) Send("{F1}") ;turn off then back on MouseMove(851, 647) Sleep(5000) If (PixelGetColor(851, 647) > 10000000) Then empty() Sleep(500) MouseMove(1704,82) ; target 1 MouseDown("left") MouseUp("left") Send("{F1}") If (PixelGetColor(1509, 62) = 0) Then target() Sleep(11000) Send("{F2}") ;turn off then back on MouseMove(851, 647) Sleep(5000) If (PixelGetColor(851, 647) > 10000000) Then empty() Sleep(500) MouseMove(1591,70) ; target 2 MouseDown("left") MouseUp("left") Send("{F2}") If (PixelGetColor(1509, 62) = 0) Then target() Sleep(11000) Send("{F3}") ;turn off then back on MouseMove(851, 647) Sleep(5000) If (PixelGetColor(851, 647) > 10000000) Then empty() Sleep(500) MouseMove(1493,77) ; target 3 MouseDown("left") MouseUp("left") Send("{F3}") If (PixelGetColor(1509, 62) = 0) Then target() Sleep(500) cycle() EndFuncJust looking to add a "if" 10 minutes pass "Then empty()" just not sure how to set up the timer or add the second varable. Link to comment Share on other sites More sharing options...
HAWKZX Posted January 14, 2007 Author Share Posted January 14, 2007 next day bump for ideas Link to comment Share on other sites More sharing options...
BALA Posted January 14, 2007 Share Posted January 14, 2007 Perhaps have a loop that sleeps for 1 second, then adds 1 to a variable and when that variable reaches how every many seconds are in time minutes, you have it do something. [font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com Link to comment Share on other sites More sharing options...
McGod Posted January 14, 2007 Share Posted January 14, 2007 expandcollapse popupFunc cycle() $timer = TimerInit () Sleep(150000) Send("{F1}") ;turn off then back on MouseMove(851, 647) Sleep(5000) If (PixelGetColor(851, 647) > 10000000) Then empty() Sleep(500) MouseMove(1704,82) ; target 1 MouseDown("left") MouseUp("left") Send("{F1}") If (PixelGetColor(1509, 62) = 0) Then target() Sleep(11000) Send("{F2}") ;turn off then back on MouseMove(851, 647) Sleep(5000) If (PixelGetColor(851, 647) > 10000000) Then empty() Sleep(500) MouseMove(1591,70) ; target 2 MouseDown("left") MouseUp("left") Send("{F2}") If (PixelGetColor(1509, 62) = 0) Then target() Sleep(11000) Send("{F3}") ;turn off then back on MouseMove(851, 647) Sleep(5000) If (PixelGetColor(851, 647) > 10000000) Then empty() Sleep(500) MouseMove(1493,77) ; target 3 MouseDown("left") MouseUp("left") Send("{F3}") If (PixelGetColor(1509, 62) = 0) Then target() Sleep(500) If TimerDiff ( $timer ) = 10000 Then empty() cycle() EndFunc Untested but should work [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
HAWKZX Posted January 14, 2007 Author Share Posted January 14, 2007 $timer = TimerInit () If TimerDiff ( $timer ) = 10000 Then empty() i moved starter to the end of the targeting and had to change to If TimerDiff ( $timer ) > 10000 Then empty() as the odds of ending on exactly 10000 (XYZ) are really slim. Thanks for the help IT WORKS! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 14, 2007 Moderators Share Posted January 14, 2007 If that script runs for more than an hour or so, you'll probably get a recursion error. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
HAWKZX Posted January 14, 2007 Author Share Posted January 14, 2007 I have yet to have that happen, as the loop is usually less then 10 mins, but this why I was seeking a second "out" of the loop. Works great if it is in the same function, but as soon as i move the "$timer = TimerInit ()" to the end of the function before this one i get an error on the "If TimerDiff ( $timer ) > 10000 Then empty()" is not defined. I only want the time to be set once per cycle I figured the easiest way to do that was to put it before this cycle. Any thoughs? Link to comment Share on other sites More sharing options...
HAWKZX Posted January 15, 2007 Author Share Posted January 15, 2007 next day bump Link to comment Share on other sites More sharing options...
xcal Posted January 15, 2007 Share Posted January 15, 2007 My only other idea, which i am not sure where to look, or how to do it is .... "DO" ABC "UNTIL" DEF "OR UNTIL" X timer (ie 10 mins expires) Haven't really looked much at your script, but here's one way to do what you asked above. HotKeySet('{F2}', 'var2true') $counter = 1 $timer = TimerInit() $var = False Do ToolTip('Loop iteration: ' & $counter) $counter += 1 Sleep(50) Until TimerDiff($timer) > 600000 Or $var = True Func var2true() $var = True EndFunc 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