How to get the right color by using pixelgetcolor when the resolution changed?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
woshichuanqilz72
Posts: 117
Joined: 05 Oct 2015, 21:23

How to get the right color by using pixelgetcolor when the resolution changed?

24 Jun 2017, 01:30

I use the code like this, I think that I can get the same result when the resolution changed, but not why is that?

Code: Select all

CoordMode, ToolTip, screen
CoordMode, Pixel, Screen
RatioX := 251 / 1920
RatioY := 203 / 1080

;~ loop
;~ {
    ;~ gosub Timer1
;~ }

;~ Return 
SetTimer, Timer1, 1000 
Return 
Timer1:
{
    SysGet, Monitor, Monitor, 1
    
    X := RatioX * MonitorRight
    Y := RatioY * MonitorBottom
    PixelGetColor, color, %X%, %Y%
    tooltip %MonitorRight%_%MonitorBottom%_%X%_%Y%, 100,100,1
    ;~ MsgBox The color at the current cursor position is %color%.
    tooltip %color%, 500, 500,2
    return
}
Update I guess that the pixel color may change a pixel shift so I capture all the color by using the code bellow. But the two results don't contain the same result I am a little confused here.

Code: Select all

CoordMode, ToolTip, screen
CoordMode, Pixel, Screen
RatioX := 251 / 1920
RatioY := 203 / 1080

SetTimer, Timer1, 1000 
Return 
Timer1:
{
    SysGet, Monitor, Monitor, 1
    
    X := RatioX * MonitorRight
    Y := RatioY * MonitorBottom
    PixelGetColor, color1, X + 1, Y + 1
    PixelGetColor, color2, X + 1, Y - 1
    PixelGetColor, color3, X - 1, Y + 1
    PixelGetColor, color4, X + 1, Y - 1
    PixelGetColor, color5, X, Y
    
    ;~  tooltip %MonitorRight%_%MonitorBottom%_%X%_%Y%, 500,500,1
    tooltip %color1%`n%color2%`n%color3%`n%color4%`n%color5%, 500, 500, 2
    return
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], RandomBoy and 253 guests