jpnguyen21 Posted December 10, 2011 Posted December 10, 2011 (edited) Having trouble trying to figure out how to restart a script. I'd like the script to start at the beginning assuming the color is found. I've tried searching and haven't found something similar. ; Find a pure red pixel in the range 0,0-20,300 $coord = PixelSearch( 747, 69, 777, 85, 0xff1f00 ) If Not @error Then sleep ("5000") Mouseclick ("left", "740", "571", "1", "1") Mouseclick ("left", "1095", "655", "1", "1") EndIf ; Find a pure red pixel in the range 0,0-20,300 $coord = PixelSearch( 747, 69, 777, 85, 0x2B2F18 ) If Not @error Then sleep ("5000") Mouseclick ("left", "740", "571", "2", "4") Mouseclick ("left", "1095", "655", "2", "4") Endif Sleep ("10000") ; Find a pure red pixel in the range 0,0-20,300 $coord = PixelSearch( 747, 69, 777, 85, 0xff1f00 ) If Not @error Then [u](What do I put here to get the script to start at line 1 again)[/u] EndIf Edited December 10, 2011 by jpnguyen21
ChrisN Posted December 10, 2011 Posted December 10, 2011 Use a While/WEnd loop. While ; Find a pure red pixel in the range 0,0-20,300 $coord = PixelSearch( 747, 69, 777, 85, 0xff1f00 ) If Not @error Then sleep ("5000") Mouseclick ("left", "740", "571", "1", "1") Mouseclick ("left", "1095", "655", "1", "1") EndIf ; Find a pure red pixel in the range 0,0-20,300 $coord = PixelSearch( 747, 69, 777, 85, 0x2B2F18 ) If Not @error Then sleep ("5000") Mouseclick ("left", "740", "571", "2", "4") Mouseclick ("left", "1095", "655", "2", "4") Endif Sleep ("10000") ; Find a pure red pixel in the range 0,0-20,300 $coord = PixelSearch( 747, 69, 777, 85, 0xff1f00 ) if @error then exitloop WEnd
somdcomputerguy Posted December 10, 2011 Posted December 10, 2011 Having trouble trying to figure out how to restart a script.(What do I put here to get the script to start at line 1 again)Perhaps this'll help - Re-Start your Program. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
kylomas Posted December 10, 2011 Posted December 10, 2011 (edited) jpnguyen21,If you use the loop that ChrisN is suggesting put a sleep(100) stmt within the loop and outside of the if stmts to control CPU usage.kylomasEdit: Opps, I see that ChrisN has the correct code... Edited December 10, 2011 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
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