Sign in to follow this  
Followers 0
Alektra

Pixel Search

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by ileandros

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites

Yes the endless loop was intended.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Apples292

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0