obelisk282 Posted February 7, 2008 Posted February 7, 2008 I am trying to make something that follow the pixel and click it so far i have this #include <Array.au3> $j = "3B8090" $w = "i" ;WinWaitActive($w) ;WinMove($w, "", 0, 0) While 1=1 $array = PixelSearch(770, 520, 790, 585, "0x" & $j, 20) ConsoleWrite (@error & @CRLF) if Not @error Then $x = $array[0] $y = $array[1] MouseClick( "left", $x, $y) Sleep(2000) EndIf WEnd i have a problem, if it do not detect the pixel it ends, how do i make it so it keep trying to detect the pixel or do something else if the pixel is not found?
Kademlia Posted February 7, 2008 Posted February 7, 2008 $array = PixelSearch(770, 520, 790, 585, "0x" & $j, 20) ConsoleWrite (@error & @CRLF) if Not @error Then The "If not @error" reacts on the line before it. What means in your case: ConsoleWrite (@error & @CRLF) <-- if this got an error then do not go into the IF function. As this never will have a error you always go into the IFfunction: Must be like this: $array = PixelSearch(770, 520, 790, 585, "0x" & $j, 20) if Not @error Then [...] endif ConsoleWrite (@error & @CRLF)
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