Jump to content

Pixel Search


Alektra
 Share

Recommended Posts

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

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...