Jump to content

AutoitX PixelSearch acting weird


Cotino
 Share

Recommended Posts

Hi, first time posting here.

I'm trying to use PixelSearch into finding a moving pixel.  However, it can't even find a static pixel ...

If the rectangle is too wide, it doesn't find the pixel, however i tried with a 10*10 rectangle, and here it works.

I'm confused, is there a max size for the rectangle ? I'm looking for a 1280*800 rectangle.

Is there any other way i could do that ? I thought about doing a PixelGetColor over the whole screen, but that would take too much time. It has to search 5 times in 1sec.

Am i missing something ?

POINT pos = { 0, 0 };
RECT rect = { 0, 0, 1280, 800 };
int color = 0xFF00FF;

AU3_PixelSearch(&rect, color, 0, 1, &pos);
std::cout << pos.x << " " << pos.y;

Edit : Even weirder now, i search on a rectangle 1000,400,1100,500 and it finds a pixel on 447,403.

How is that even possible ? It shouldn't have checked that pixel at all.

Edited by Cotino
Link to comment
Share on other sites

In help file it says (left, top, right, bottom, colour) 

Set oAutoIt = WScript.CreateObject("AutoItX3.Control")

value = oAutoIt.PixelSearch(0,0, 100, 100, 0)
If oAutoIt.error = 1 Then
  WScript.Echo "Color not found"
Else
  WScript.Echo "Color found at: " & value(0) & "," & value(1)
End If

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I just figured it out.

Autoit reversed the left and right var of the rect. So, right is left, and left is right.

I wonder how it's possible that no one else made a thread about this. I can't be the only one to use pixelsearch, am i ?

Link to comment
Share on other sites

New problem now.

If i loop pixelsearch for a long time on a pixel, it will find that pixel at a certain position, usually max x and random y, and the only way to make it work again is to restart the computer. However, if i change the pixel, it works just fine.

Maybe it uses some kind of buffer that gets full if you use it too much, and using another pixel use another buffer ?

Link to comment
Share on other sites

I just figured it out.

Autoit reversed the left and right var of the rect. So, right is left, and left is right.

I wonder how it's possible that no one else made a thread about this. I can't be the only one to use pixelsearch, am i ?

I have noticed it in the past, and also figured the solution I'm sorry to admit, my memory is not what it used to be.

 

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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...