Hello all.
I have the need to use GetpixelColor on a specific window. Say x50 Y10 of a specific window like "ahk_exe testwin.exe"
I know this has something to do with coordmode but I am just nut understanding. I have searched around and not found what I am looking for.
I know one of you could whip this out in a second.
I appreciate the help!
Thanks!
Need to get pixelcolor in a window
Re: Need to get pixelcolor in a window
It's already done for you.
https://www.autohotkey.com/docs/commands/PixelGetColor.htm#ExBasic
You can WinActivate the window if needed, or CoordMode, Pixel.
https://www.autohotkey.com/docs/commands/PixelGetColor.htm#ExBasic
You can WinActivate the window if needed, or CoordMode, Pixel.
Code: Select all
winTitle = ahk_exe testwin.exe
x = 50
y = 10
#If WinExist(winTitle)
F3::
WinActivate
MouseMove, x, y
PixelGetColor, bgr, x, y
MsgBox, 64, Color (BGR), Blue-Green-Red = %bgr%
Return
#If
Re: Need to get pixelcolor in a window
Thanks for the reply!
Is there a way for this to work without the Hotkey? I commented out F3:: and that broke it. I need to be able to read the color without user interaction.
Thanks again for your help.
Is there a way for this to work without the Hotkey? I commented out F3:: and that broke it. I need to be able to read the color without user interaction.
Thanks again for your help.
Re: Need to get pixelcolor in a window
Code: Select all
winTitle = ahk_exe testwin.exe
x = 50
y = 10
If WinExist(winTitle) {
WinActivate
MouseMove, x, y
PixelGetColor, bgr, x, y
MsgBox, 64, Color (BGR), Blue-Green-Red = %bgr%
} Else MsgBox, 48, Error, Window not found.`n`n%winTitle%
Return