Sign in to follow this  
Followers 0
Wath

PixelSearch

8 posts in this topic

Hi!

How could I check one for example 10*10px large black square is on the screen or not?

I thought the way is PixelSearch but it is checking one pixel.

$coord = PixelSearch( $X1, $Y1, $X2, $Y2, 0x000000,99 )

Share this post


Link to post
Share on other sites



Does it have to be an exactly 10x10 square?

Would checking for say a 5x5 square be adequate?

Does the black square always appear in the same spot, or even in the same general area?

If there's a 100x100 black square, should that be ignored, or recognized as 100 of the 10x10 squares?

Is it important to have this checked quickly, or accurately? (you'll probably only get one or the other)

Does the entire 10x10 area have to be the exact same shade, or just close?

Does the 10x10 square have to be completely black? Or just its perimeter? Or just 50% of it?

That's about what went through my mind when I read your post, so if you can answer a little bit of that, I might be able to offer a little more help.

About all I can offer at this point is this: Use PixelSearch() to write your own function that checks the screen for the parameters you're looking for.

Share this post


Link to post
Share on other sites

Does it have to be an exactly 10x10 square?

Would checking for say a 5x5 square be adequate?

Does the black square always appear in the same spot, or even in the same general area?

If there's a 100x100 black square, should that be ignored, or recognized as 100 of the 10x10 squares?

Is it important to have this checked quickly, or accurately? (you'll probably only get one or the other)

Does the entire 10x10 area have to be the exact same shade, or just close?

Does the 10x10 square have to be completely black? Or just its perimeter? Or just 50% of it?

That's about what went through my mind when I read your post, so if you can answer a little bit of that, I might be able to offer a little more help.

About all I can offer at this point is this: Use PixelSearch() to write your own function that checks the screen for the parameters you're looking for.

Hello bwochinski!

So here is my answer for you :)

-Yes it's doesn't have to be exactly 10*10

-I think 5*5 it's enough

-It's appear usually somewhere the middle of the screen.This is a small window which have a total black background. I need to find that small window and move it away.So I think the best way to make a narrow column from the top of the screen until the bottom of the screen which one is 300-400px width. In that case the window will be definitely there.

-100*100 ignored

-If it's possible check asap

-It's pure 100% black so yes all of the 10*10 have to be the same shade

I think thats all what you asked. And thanks for helping me out. :)

I attached one paint layout. You can see the little black box at the middle. The one what I need to find. The red column is the target zone where this window open somewhere.

And after I have to move it to 0,0 coords. As you can see there is other black area which is bigger and pleased to ignored.

Thx

post-63830-0-23962300-1301558510_thumb.j

Share this post


Link to post
Share on other sites

Well before I go too deeply into how you'd write a function to try and efficiently search that space for black pixels, are you sure you can't refer to it by title or text in the WinMove() function?

If it's actually a window, the AutoIt Window Info tool should be able to tell you some way of identifying it.

Share this post


Link to post
Share on other sites

Well before I go too deeply into how you'd write a function to try and efficiently search that space for black pixels, are you sure you can't refer to it by title or text in the WinMove() function?

If it's actually a window, the AutoIt Window Info tool should be able to tell you some way of identifying it.

I would pleased If i can refer to it but unfortunately AutoIt Window Info doesn't show anything. Like on a Java application window.

I'm attached the window only.

Maybe is easier to find the folder icon at the top left (blue and blue shades)?

post-63830-0-00718700-1301567700_thumb.j

Share this post


Link to post
Share on other sites

I do think that searching for the blue of that icon would be better. Fewer chances for false positives when looking for black.

I have to be going at the moment, but what I would suggest working on is setting up a search for the blue of the top-left of that icon. When the blue is found, see if you can use the PixelChecksum() function to compare the area found against a checksum you've pre-generated against the folder icon. That should allow you to search a fairly small area around the center of the screen but still avoid false positives by using the checksum.

I'll be offline for around 12 hours, so see if you can work something like that out. I'll check back on here when I return.

Share this post


Link to post
Share on other sites

when I search an area, I set a two dimensional array with my coordinates then search each value.

Share this post


Link to post
Share on other sites

I do think that searching for the blue of that icon would be better. Fewer chances for false positives when looking for black.

I have to be going at the moment, but what I would suggest working on is setting up a search for the blue of the top-left of that icon. When the blue is found, see if you can use the PixelChecksum() function to compare the area found against a checksum you've pre-generated against the folder icon. That should allow you to search a fairly small area around the center of the screen but still avoid false positives by using the checksum.

I'll be offline for around 12 hours, so see if you can work something like that out. I'll check back on here when I return.

After all I did the easiest method and It's worked. :)

;Try find the opened window
                $X1 = 35
                $X2 = 1000 
                $Y1 = 0 
                $Y2 = 760 
                ;blue?
                $coord = PixelSearch( $X1, $Y1, $X2, $Y2, 0x75BCF8 )
                If Not @error Then
                    MouseMove($coord[0], $coord[1], 10)
                    MouseDown("left")
                    MouseMove("48","8", 10) ; Move it to corner
                    sleep(500)
                    MouseUp("left")
                EndIf

It's working in any position I think i'm lucky because no other pixel which is 0x75BCF8. :P

Thanks for the replies and If u have other ways please write it. :)

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