Jump to content

Recommended Posts

Posted (edited)

I had this problem with PixelGetColor not giving me the same HEX Color as the AU3Info Tool and searched every were with no luck then had a OH DA moment LoL.

The problem is that the

"PixelGetColor ($mouseX[0], $mouseY[1])"

is looking rite at the very tip of the mouse pointer not under it.  So you have to set a -3 after the [0] and [1].  

"PixelGetColor ($mouseX[0] -3, $mouseY[1] -3)"

to make it search next to the pointer not on the pointer.  You may have to adjust this a bit for your display but you should not have  to go more then -5.  -3 seems to work best for me.

Example.au3

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 141, 127, 276, 231)
$Input1 = GUICtrlCreateInput("", 8, 8, 121, 21)
$Label1 = GUICtrlCreateLabel("Press or Hold F1 to get Hex color at Mouse X -3, Y-3 Pos,", 8, 40, 124, 73)
GUISetState(@SW_SHOW)

HotKeySet("{f1}","MousePos")

Func MousePos()
    $aPos = MouseGetPos()
    $PGC = PixelGetColor($aPos[0] -3, $aPos[1] -3)
    GUICtrlSetData($Input1, "0x" & Hex($PGC, 6))

EndFunc

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

 

Edited by Nitrolord
Posted
10 hours ago, JLogan3o13 said:

So, is this you asking a question (which I am not seeing) or are you posting an example - maybe better suited for the Examples forum?

No I posted this as a Help Forum for those who cant figure out why there AU3Info Tool is returning a different HEX Color then the PixelGetColor.

But if you prefer I post it in the Examples Forum then no problem.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...