PixelGetColor does not work !

Get help with using AutoHotkey and its commands and hotkeys
techniker_rentner
Posts: 5
Joined: 18 Feb 2020, 04:09

PixelGetColor does not work !

18 Feb 2020, 04:43

Hi, I'm a newcomer, so please be patient!
Since years I work with AHK and found always, somehow, a solution. But now I simply try to find out the color under my cursor but it does not work!

Code: Select all

CoordMode, Mouse Pixel, Screen
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
MouseGetPos, MouseX, MouseY
PixelGetColor, color, MouseX, MouseY, RGB
MsgBox The color at the current cursor position is %color%.
return
[Mod edit: Codebox fixed.]

I tried it in many ways, but it simly does not work! It shows always the same "0xffffff". I tried to use other commands, using the "windows spy" mouse position and control to reach my target, but they also did not work in the one or the other way:
ControlGetPos
WinGetTitle
WinGetClass

Where is my mistake?
I#m using WIN7, AHK 1.1.30.2
User avatar
Yakshongas
Posts: 481
Joined: 21 Jan 2020, 08:41
Facebook: Yakshongas

Re: PixelGetColor does not work !

18 Feb 2020, 08:49

Try this.

Code: Select all

SetWorkingDir %A_ScriptDir%

Loop
{
MouseGetPos, PosX, PosY
PixelGetColor, colors, %PosX%, %PosY%
ToolTip, X: %PosX% Y: %PosY% `nColor: %colors%
}
F5::
Clipboard = %PosX%, %PosY%, %colors%
return
Please mark your topics as solved if you don't need any further help. ✅
scriptor2016
Posts: 646
Joined: 21 Dec 2015, 02:34

Re: PixelGetColor does not work !

18 Feb 2020, 09:14

Code: Select all

#Persistent
CoordMode Pixel, Screen 
CoordMode Mouse, Screen 
SetTimer, WatchCursor, 100
return

WatchCursor:
MouseGetPos X, Y 
PixelGetColor Color, %X%, %Y%, RGB
ToolTip, %Color%
techniker_rentner
Posts: 5
Joined: 18 Feb 2020, 04:09

Re: PixelGetColor does not work !

18 Feb 2020, 09:53

It still shows color 0xFFFFFFFF !
techniker_rentner
Posts: 5
Joined: 18 Feb 2020, 04:09

Re: PixelGetColor does not work !

18 Feb 2020, 10:01

Thank you scriptor2016 and Yakshongas! It seems that the "PixelGetColor" itself does not work!? Any other possibilities?
User avatar
Hellbent
Posts: 1057
Joined: 23 Sep 2017, 13:34

Re: PixelGetColor does not work !

19 Feb 2020, 06:31

techniker_rentner wrote:
18 Feb 2020, 10:01
Thank you scriptor2016 and Yakshongas! It seems that the "PixelGetColor" itself does not work!? Any other possibilities?
See if this script works for you.

https://www.autohotkey.com/boards/viewtopic.php?f=6&t=60942
techniker_rentner
Posts: 5
Joined: 18 Feb 2020, 04:09

Re: PixelGetColor does not work !

19 Feb 2020, 09:23

Thank you Hellbent,
I just extracted the section "GETCOLORFROMSCREEN" from your script, modified it and - surprise - it worked!! I compared it with my script, but I did'nt find any error! I modified it in a lot of ways, but it never worked. Anyway, it works now and I thank you very much!
techniker_rentner
Posts: 5
Joined: 18 Feb 2020, 04:09

Re: PixelGetColor does not work !

19 Feb 2020, 11:30

To all who helped and to all who may have similar problems!
I found the problem why my script did not work properly! My firewall blocked it (COMODO)! Somehow the message service was deactivated, so that COMODO did not report it to me! Nevertheless I could start the script, but it showed wrong results. Sometimes, but not everytime, during the starting process, AUTOHOTKEY sent a warning: The keyboard and/or mouse hook could not be activated. Ignoring this warning brought the same wrong results!
After deleting the script from COMMODO's blocking list and mark it as trustworthy, it worked perfectly!

Return to “Ask For Help”

Who is online

Users browsing this forum: euras, Rohwedder and 258 guests