Alektra Posted February 15, 2013 Share Posted February 15, 2013 I'm trying to make it click in a program when there is red in the rectangle, I have tried using reds taken from the program and pure red and I can't get it to click unless shade-variation is so large it clicks no matter what.$pixel = PixelSearch ( 390, 340, 410, 343, 0xFF0000, 100) Local $i = 0 Do If IsArray($pixel) = True Then MouseClick("left") Sleep(80) EndIf Until $i = 1 Link to comment Share on other sites More sharing options...
ileandros Posted February 15, 2013 Share Posted February 15, 2013 (edited) $pixel = PixelSearch ( 390, 340, 410, 343, 0xFF0000, 100) Local $i = 0 Do If IsArray($pixel) = True Then MouseClick("left",$pixel[0],$pixel[1]) Sleep(80) EndIf Until $i = 1 Care this code will stuck your script. Your loop is endless Edited February 15, 2013 by ileandros I feel nothing.It feels great. Link to comment Share on other sites More sharing options...
Alektra Posted February 15, 2013 Author Share Posted February 15, 2013 Yes the endless loop was intended. Link to comment Share on other sites More sharing options...
Apples292 Posted February 15, 2013 Share Posted February 15, 2013 (edited) Hi Alektra Is the red that comes from the rectangle always the same? If so you can use the AutoIt Window Info tool to get the Hex code of the colour that actually shows in your program, from there you can change your code so it searches for that instead for example: $hex = 0xFF0000 ;Change this to the hexcode of the colour $pixel = PixelSearch ( 390, 340, 410, 343, $hex, 100) Local $i = 0 Do If IsArray($pixel) = True Then MouseClick("left") Sleep(80) EndIf Until $i = 1 If that doesn't work because the red isn't always the same colour then try investigating pixel checksum, however this would trigger a change no matter what colour shows up. Thanks Apples292 Edited February 15, 2013 by Apples292 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