AutoHotkey Community

It is currently May 26th, 2012, 11:36 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: November 6th, 2009, 4:11 am 
Offline

Joined: February 23rd, 2008, 6:52 pm
Posts: 30
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 6:09 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6068
Location: San Diego, California
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 6th, 2009, 6:45 pm 
Offline

Joined: February 23rd, 2008, 6:52 pm
Posts: 30
Correctamundo, thanks Leef_me :D


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Leef_me, Pulover, rbrtryn, XstatyK, Yahoo [Bot] and 52 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group