Cotino Posted April 13, 2015 Share Posted April 13, 2015 (edited) 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 April 13, 2015 by Cotino Link to comment Share on other sites More sharing options...
JohnOne Posted April 13, 2015 Share Posted April 13, 2015 Where did you see that, that function takes a rect as a parameter? 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 More sharing options...
Cotino Posted April 13, 2015 Author Share Posted April 13, 2015 On the header file. AU3_API void WINAPI AU3_PixelSearch(LPRECT lpRect, int nCol, /*default 0*/int nVar, /*default 1*/int nStep, LPPOINT pPointResult); Link to comment Share on other sites More sharing options...
JohnOne Posted April 13, 2015 Share Posted April 13, 2015 OK, maybe the help file has not been updated. 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 More sharing options...
Cotino Posted April 13, 2015 Author Share Posted April 13, 2015 What do you mean, it's not supposed to be a rect ? It kinda works that way on very small rect. Link to comment Share on other sites More sharing options...
JohnOne Posted April 13, 2015 Share Posted April 13, 2015 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 More sharing options...
Cotino Posted April 14, 2015 Author Share Posted April 14, 2015 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 More sharing options...
Cotino Posted April 14, 2015 Author Share Posted April 14, 2015 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 More sharing options...
JohnOne Posted April 14, 2015 Share Posted April 14, 2015 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 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