Jump to content
Sign in to follow this  


Recommended Posts

How would I be able to get PixelSearch() to Search for a pixel based on a window. Say you have multiple windows and you only want it to search within say the web browser and not the entire screen?

Share this post

Link to post
Share on other sites

Get the position and size of the window you want to search using WinGetPos, using the values returned from this you can figure out where to search.

ShellExecute(@WindowsDir & "\Notepad.exe")
WinWait("Untitled - Notepad")
WinActivate("Untitled - Notepad")

$PositionAndSize = WinGetPos("Untitled - Notepad")
If IsArray($PositionAndSize) Then
    $Result = PixelSearch($PositionAndSize[0], $PositionAndSize[1], $PositionAndSize[0] + $PositionAndSize[2], $PositionAndSize[1] + $PositionAndSize[3], 0x5A5E59)

If IsArray($Result) Then MouseMove($Result[0], $Result[1])

    [0] = X
    [1] = Y
    [2] = Width
    [3] = Height

Share this post

Link to post
Share on other sites

Thanks guys, I think both ways would work, using handle or getting the position, ill just figure out what is easier though I haven't worked with handle's of windows so Ill figure out something. This will at least get me started. Maybe someone could give me and example handle?

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...