PixelGetColor

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kestak
Posts: 40
Joined: 15 Aug 2018, 06:35

PixelGetColor

08 Jan 2020, 10:37

Greetings,

I have an issue with my code.

When I use that code by itself it returns the correct 0x292EFE code when I press <ALT>-<o>:

!o::
PixelGetColor, couleur, 1244, 44
MsgBox The color at the current cursor position is %couleur%.
Return

When I integrate the pixelgetcolor in my main macro, it returns 0xFFFFFF. Here is the part of the cde where I use i, it is a simple counter that goes downt:
.....
secsLeft--
PixelGetColor, couleur, 1244, 44
MsgBox The color at the current cursor position is %couleur%. ;This is just to check the code passed to the if
If (Couleur != 0x292EFE and secsLeft < 280)
{
MsgBox In the loop and color is %couleur%.
SetTimer ShowTimer,Off
Gui, Destroy
exit
}
.....
I have no global variable settings like coormode in my main macro. Any idea why it does not return the right code? I read that the coordinate taken under the mouse is not the same than PixelGetColor. But it works with my first code and not the second one....

Thank you
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: PixelGetColor

08 Jan 2020, 10:53

use CoordMode Screen or make absolutely sure ur coords are correct, otherwise u might be sampling areas which are offscreen

if ure trying this out in a fullscreen game, change it to fullscreen borderless or it wont work ever
kestak
Posts: 40
Joined: 15 Aug 2018, 06:35

Re: PixelGetColor

08 Jan 2020, 11:58

Thank you for your answer.

If I use Coordmode, will it be the same coordinates? I have no way to know the exact coordinates except using my mouseclick and record it and use the coordinates.

Thank you
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: PixelGetColor

08 Jan 2020, 12:08

also make sure your main script doesn't move any windows above your coordinate location, because they you'd get the wrong color


Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: bowie1123 and 331 guests