SilverSky Posted January 1, 2016 Share Posted January 1, 2016 Hi, I would like to create a program that would do something like this:Check color in x-212 y-157 and if color = red click here(x,y), but if not - click (x,y) and check again color in x-212 y-157, check color untill = red My code, but it doesn't work: $var = PixelGetColor (212,157) If $var = 0xFF6666 Then MouseClick("primary",300,300) Else MouseClick("primary", 755, 618) EndIf Link to comment Share on other sites More sharing options...
Gianni Posted January 1, 2016 Share Posted January 1, 2016 (edited) ?not clear the exact flow, (the color red should be 0xFF0000 instead of 0xFF6666...)maybe something like this?Local $iTargetColor = 0xFF0000 ; the wanted color Do $var = PixelGetColor(212, 157) If $var <> $iTargetColor Then MouseClick("primary", 755, 618) ; not the right color Until $var = $iTargetColor ; repeat this loop until color is the wanted one MouseClick("primary", 300, 300) ; click here and go ahead... Edited January 1, 2016 by Chimp SilverSky 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
SilverSky Posted January 1, 2016 Author Share Posted January 1, 2016 (edited) Ok, but how to stop this line for a few seconds "before next "mouseclick" ?If $var <> $iTargetColor Then MouseClick("primary", 755, 618) ; not the right color or if this possible, write this code on If...Else...EndIf Edited January 1, 2016 by SilverSky Link to comment Share on other sites More sharing options...
Gianni Posted January 1, 2016 Share Posted January 1, 2016 (edited) just insert a delay right after that line,use the Sleep() function with the wanted delaySleep(1000) delays 1 second, Sleep(500) delays half second ...Local $iTargetColor = 0xFF0000 ; the wanted color Do $var = PixelGetColor(212, 157) If $var <> $iTargetColor Then MouseClick("primary", 755, 618) ; not the right color Sleep(1000) ; delay of 1000 milliseconds (that is 1 second) Until $var = $iTargetColor ; repeat this loop until color is the wanted one MouseClick("primary", 300, 300) ; click here and go ahead... <..snip>or if this possible, write this code on If...Else...EndIfLocal $iTargetColor = 0xFF0000 ; the wanted color While 1 $var = PixelGetColor(212, 157) If $var = $iTargetColor Then MouseClick("primary", 300, 300) ; click here... ExitLoop ; and go ahead... (exit the While - Wend loop) Else MouseClick("primary", 755, 618) ; not the right color Sleep(1000) ; delay of 1000 milliseconds (that is 1 second) EndIf WEnd ; repeat this loop until color is the wanted one Edited January 1, 2016 by Chimp SilverSky and Marcelos 2 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
SilverSky Posted January 2, 2016 Author Share Posted January 2, 2016 Thanks for help, like 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