Sign in to follow this  
Followers 0
Justforfun

Pixel Search

10 posts in this topic

Hello,

I have made a gui that is a 120x120 pixel square is there away to pixel search with in the square only so when I move it it will pixel search where I put the square instead of having locked pixel search coords.

Any Idea's

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

PixelCoordMode option << helpfile

edit:

Infact there is a parameter for defining which window to search in the pixelsearch function.

Ok I will look again mabye I missed it on the coord mode Opt("PixelCoordMode", 3) would be for the client window yes?

I seen where it says you can select window handle to search but not sure exactly how to set left top right bottom coords for the window if I am going to be moving it.

Edited by Justforfun

Share this post


Link to post
Share on other sites

Use WinGetPos to find the current location of your window and then update the coords for your pixelsearch accordingly.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I think Opt("PixelCoordMode", 2) for the clent area of the window, and you also have to define that window in the pixelsearch function.

Your top left coords will always be 0,0 .

Edited by JohnOne

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

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Use WinGetPos to find the current location of your window and then update the coords for your pixelsearch accordingly.

PixelSearch ask for PixelSearch( Left, Top, Right, Bottom, Color, Shade, Step, Handle)

Where WinGetPos(Handle, Text) Returns X, Y, Width, and Height, so how would I enter left top right bottom with only Knowing left and top from wingetpos.

Share this post


Link to post
Share on other sites

I think Opt("PixelCoordMode", 2) for the clent area of the window, and you also have to define that window in the pixelsearch function.

Your top left coords will always be 0,0 .

Its not 3 I think I said 3 I ment 2 thanks for the correction

0 = relative coords to the defined window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the defined window

Also If I set my sqaure top left to screens 0,0 then I can get the right and bottom for pixel search this is the part I am not understanding is how to set the right and bottom for my gui window is that correct.

Share this post


Link to post
Share on other sites

X and Y from WinGetPos are the top left coords for the window. Width and Height are the pixel width and height of the window.

While 1
    $pos = WinGetPos($mywindow)
    If @error Then
        MsgBox(0,"Error","Window not found.")
    EndIf
    $coords = PixelSearch($pos[0],$pos[1],($pos[0]+$pos[2]),($pos[1]+$pos[3]),$hex,$variation)
    If Not @error Then
        ;Found.
    ElseIf @error Then
        ;Not found.
    EndIf
WEnd

Share this post


Link to post
Share on other sites

Great guys It works thanks to both of you, :blink: I think I just had a dummy moment. Thanks again.

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