 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
drmartell
Joined: 23 Feb 2008 Posts: 27
|
Posted: Fri Nov 06, 2009 3:11 am Post subject: PixelSearch only working with certain window locations |
|
|
I am trying to use PixelSearch to find a window control regardless of the window location on the screen.
The window is a Citrix application.
Strangely (at least to me) I have a small test script that works correctly when the window is in some locations, and not when it is in others.
| Code: | CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
WinGetPos, X, Y, Width, Height, ahk_class WindowsForms10.Window.8.app.0.33c0d9d
PixelSearch, Px, Py, X, Y, Width, Height, 0xE22B8A, 10, Slow
if ErrorLevel
{
MouseMove, X, Y
MsgBox, That color was not found: %x% %y% %width% %height%.
}
else
{
MouseMove, Px, Py
MsgBox, Your color was found at X%Px% Y%Py%.
} |
For example, when the window is docked at the top of the screen, it correctly locates the control. However when the window is docked at the bottom of the screen, it locates the window correctly, but not the control.
According to WindowSpy, neither the window name or class nor the target pixel color change depending upon where the window is docked.
Additionally, when the window is not docked, if I have it roughly on the left hand side of my screen, the above script locates the control; if I move the window to the right hand side, it fails to find the control, and only finds the correct coord of the window.
What might be causing this behavior? |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 5336 Location: San Diego, California
|
Posted: Fri Nov 06, 2009 5:09 am Post subject: |
|
|
You have misunderstood the parameters for PixelSearch
Instead of:
| Code: | | PixelSearch, Px, Py, X, Y, Width, Height, 0xE22B8A, 10, Slow | try this: | Code: | PixelSearch, Px, Py, X, Y, X+Width, Y+Height, 0xE22B8A, 10, Slow
|
|
|
| Back to top |
|
 |
drmartell
Joined: 23 Feb 2008 Posts: 27
|
Posted: Fri Nov 06, 2009 5:45 pm Post subject: |
|
|
Correctamundo, thanks Leef_me  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|