| View previous topic :: View next topic |
| Author |
Message |
Mayhem
Joined: 21 Aug 2004 Posts: 104
|
Posted: Sat Aug 21, 2004 12:49 am Post subject: PixelColor |
|
|
I'm trying to get the pixel color of an inactive window.
This window is completely showing, but I have something else running that needs the focus instead (100%) of the time.
Can someone give me a quick example how this can be done?
I'm assuming i'll have to change my coord mode for mouse and pixel to "screen". I just don't know how to get the "X,Y" of the inactive screen and mousemove / get color inside it (without using relative coord mode).
Please help!
Thanks |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
|
| Back to top |
|
 |
Mayhem
Joined: 21 Aug 2004 Posts: 104
|
Posted: Sat Aug 21, 2004 1:38 am Post subject: |
|
|
I've read through that ..
That requires the window to be in focus. I'm trying to get the color without it being in focus.
Thank anyways tho. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Sat Aug 21, 2004 1:49 am Post subject: |
|
|
If the inactive window is always in the same place on the screen, you don't need to do anything other than switch to screen coordinates:
CoordMode, Pixel, Screen
However, if it's position varies, use WinGetPos to help convert the relative coordinates of the target pixel (which are constant) to screen coordinates (which vary depending on the position of the window's upper-left corner):
WinGetPos, iax, iay, , , WinTitle
; Convert from relative to absolute/screen:
iax += 150 ; In this example, 150 is the known relative x position
iay += 100 ; And 100 is the relative Y position (also constant)
CoordMode, Pixel, Screen
PixelGetColor, color, %iax%, %iay% |
|
| Back to top |
|
 |
Mayhem
Joined: 21 Aug 2004 Posts: 104
|
Posted: Sat Aug 21, 2004 4:43 am Post subject: |
|
|
Thank you chris!
This is exactly what i was looking for! |
|
| Back to top |
|
 |
|