Jump to content

Recommended Posts

Posted

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?

Posted

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)
EndIf

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

#cs
    [0] = X
    [1] = Y
    [2] = Width
    [3] = Height
#CE
Posted

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?

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
×
×
  • Create New...