Jump to content
Sign in to follow this  
Nahuel

Screen Color Picker

Recommended Posts

Nahuel

NEWEST VERSION HERE! :

http://www.autoitscript.com/forum/index.php?showtopic=53471

___________________________________________________________

I made this little tool because someone asked me something to get the hex code from colors in websites, pictures, videos, whatever...

Unfortunately, my hard disk died yesterday and I lost ALL of my scripts :) Except for a few compiled things that were in the C drive ;)

Oh well, I guess you can all figure out how it works, hehe. I'll try to write the script again.

-edit-

Thanks Zedna! ;)

#include <GUIconstants.au3>
#NoTrayIcon
GUICreate("Pixel Color",200,180,-1,-1,-1,$WS_EX_TOPMOST)
GUICtrlCreateLabel("Mouse Coord.:",10,10)
$MousePos=GUICtrlCreateInput("",100,10,90,20,$ES_READONLY)
GUICtrlCreateLabel("Decimal Code: ",10,40)
$PixelColor=GUICtrlCreateInput("",100,40,90,20,$ES_READONLY)
GUICtrlCreateLabel("Hex Code:",10,70)
$hexColor=GUICtrlCreateInput("",100,70,90,20,$ES_READONLY)
GUICtrlCreateLabel("Color:",10,100)
$MostrarColor=GUICtrlCreateLabel("",100,100,90,20,$ES_READONLY)
GUICtrlCreateLabel("Press F to freeze info",50,135)
GUICtrlSetColor(-1,0x00808080)
GUICtrlCreateLabel("Press R to resume",57,150)
GUICtrlSetColor(-1,0x00808080)
HotKeySet("f","freeze")
HotKeySet("r","continue")
GUISetState()
$loop=1
While 1
    $msg=GUIGetMsg()
    data()
    Select
    Case $msg=$GUI_EVENT_CLOSE
            $loop=0
            Exit
    EndSelect
WEnd
Func freeze()
    $loop=0
EndFunc
Func continue()
    $loop=1
    data()
EndFunc
Func data()
    While $loop=1
        $msg=GUIGetMsg()
            Select
            Case $msg=$GUI_EVENT_CLOSE
                $loop=0
                Exit
            EndSelect
        Sleep(25)
        $pos=MouseGetPos()
        $color=PixelGetColor($pos[0],$pos[1])
        GUICtrlSetData($MousePos,"X="&$pos[0]&" Y="&$pos[1])
        GUICtrlSetData($PixelColor,$color)
        $HEX6=StringRight(Hex($color),6)
        GUICtrlSetData($hexColor,"#"&$HEX6)
        GUICtrlSetBkColor($MostrarColor,"0x"&Hex($color))
    WEnd
EndFuncoÝ÷ Úå)^v÷«²*'o&ñÂ)íz¼oûºÚ"µÍÚ[ÛYH  ÑÕRXÛÛÝ[Ë]LÉÝÂÓÕ^RXÛÛÛØ[ ÌÍÔ]ÙYÝÙ^TÙ]
    ][ÝÞÔUTÑ_I][ÝË    ][ÝÕÙÙÛT]ÙI][ÝÊBÕRPÜX]J   ][ÝÔ^[ÛÛÜ][ÝËNÌ
KLKLKLK ÌÍÕÔ×ÑVÕÔSÔÕ
BÕRPÝÜX]QÜÝ
    ][ÝÈ[ÝÙHÛÛÜ[]È  ][ÝËLLM
L
BÕRPÝÜX]SX[
    ][ÝÖ][ÝËKÌËMKMJBÌÍÓ[ÝÙTÜÖQÕRPÝÜX]R[]
    ][ÝÉ][ÝË
Ì
    ÌÍÑT×ÔPQÓJBÕRPÝÜX]SX[
    ][ÝÖN][ÝËLÌËMKMJBÌÍÓ[ÝÙTÜÖOQÕRPÝÜX]R[]
    ][ÝÉ][ÝËL
KÌ
    ÌÍÑT×ÔPQÓJBÕRPÝÜX]QÜÝ
    ][ÝÈÛÛÜ]H  ][ÝËL
ÌMLL
BÕRPÝÜX]SX[
    ][ÝÑXÚ[X[][ÝËKLË
LMJBÌÍÔ^[ÛÛÜQÕRPÝÜX]R[]
    ][ÝÉ][ÝËL
Ì  ÌÍÑT×ÔPQÓJBÕRPÝÜX]SX[
    ][ÝÒ^][ÝËKLË
LMJBÌÍÚ^ÛÛÜQÕRPÝÜX]R[]
    ][ÝÉ][ÝËL
Ì  ÌÍÑT×ÔPQÓJBÕRPÝÜX]SX[
    ][ÝÐÛÛÜ][ÝËKMLË
LMJBÌÍÓ[ÜÝÛÛÜQÕRPÝÜX]SX[
    ][ÝÉ][ÝËML
Ì  ÌÍÑT×ÔPQÓJBÕRPÝÜX]QÜÝ
    ][ÝÈÛÛÜ[]HÜ[ÛÈ  ][ÝËLNLML
BÌÍÔÑ[HÕRPÝÜX]TY[Ê  ][ÝÈ[ØÜY[][ÝËKLL
BÕRPÝÙ]Ý]JLK    ÌÍÑÕRWÐÒPÒÑQ
BÌÍÔÕÚ[ÝÈHÕRPÝÜX]TY[Ê    ][ÝÈXÝ]HÚ[ÝÉ][ÝËKÌL
BÕRPÝÜX]SX[
    ][ÝÕÚ[ÝÎ][ÝËKMK
LMJBÌÍÕÚ[ÝÈHÕRPÝÜX]SX[
    ][ÝÊ[ØÜY[I][ÝË
ÍKMK
ÌMJBÕRPÝÜX]SX[
    ][ÝÔÜÈUTÑHÈY^KÝ[Y^K][ÝË
HNMK    ÌÍÔÔ×ÐÑSTBÕRPÝÙ]ÛÛÜLK
BÕRTÙ]Ý]J
BÚ[HB  ÌÍÛÙÏQÕRQÙ]ÙÊ
B]J
BÙ[XÝBPØÙH  ÌÍÛÙÏIÌÍÑÕRWÑUSÐÓÔÑB  ÌÍÛÛÜL^][Ù[XÝÑ[[È]J
BÚ[HB  ÌÍÛÙÏQÕRQÙ]ÙÊ
BÙ[XÝØÙH    ÌÍÛÙÏIÌÍÑÕRWÑUSÐÓÔÑB^]BQ[Ù[XÝÛY
JBBRYÕRPÝXY
    ÌÍÔÑ[
HH  ÌÍÑÕRWÐÒPÒÑQ[BBSÜ
    ][ÝÓ[ÝÙPÛÛÜ[ÙI][ÝËJBBBSÜ
    ][ÝÔ^[ÛÛÜ[ÙI][ÝËJBBBQÕRPÝÙ]]J    ÌÍÕÚ[ÝË   ][ÝÊ[ØÜY[I][ÝÊBBBIÌÍÜÜÏS[ÝÙQÙ]ÜÊ
BBBIÌÍØÛÛÜT^[Ù]ÛÛÜ    ÌÍÜÜÖÌK   ÌÍÜÜÖÌWJBBBQÕRPÝÙ]]J   ÌÍÓ[ÝÙTÜÖ    ÌÍÜÜÖÌJBBBQÕRPÝÙ]]J    ÌÍÓ[ÝÙTÜÖK   ÌÍÜÜÖÌWJBBBQÕRPÝÙ]]J   ÌÍÔ^[ÛÛÜ  ÌÍØÛÛÜBBBIÌÍÒV
TÝ[ÔYÚ
^
    ÌÍØÛÛÜK
BBBQÕRPÝÙ]]J ÌÍÚ^ÛÛÜ   ][ÝÌ  ][ÝÉ[ÉÌÍÒV
BBBQÕRPÝÙ]ÐÛÛÜ   ÌÍÓ[ÜÝÛÛÜ   ][ÝÌ  ][ÝÉ[Ò^
    ÌÍØÛÛÜJBBQ[ÙBBBSÜ
    ][ÝÓ[ÝÙPÛÛÜ[ÙI][ÝË
BBBSÜ
    ][ÝÔ^[ÛÛÜ[ÙI][ÝË
BBBQÕRPÝÙ]]J ÌÍÕÚ[ÝËÚ[Ù]]J   ][ÝÉ][ÝÊJBBBIÌÍÝÚ[HÚ[Ù]ÜÊ   ][ÝÉ][ÝÊBBBIÌÍÜÜÏS[ÝÙQÙ]ÜÊ
BBBRY   ÌÍÜÜÖÌH   ÝÏH[  ÌÍÜÜÖÌH   ÏH ÌÍÝÚ[ÌH[   ÌÍÜÜÖÌWH  ÝÏH[  ÌÍÜÜÖÌWH  ÏH ÌÍÝÚ[Ì×H[BBBIÌÍØÛÛÜT^[Ù]ÛÛÜ ÌÍÜÜÖÌK   ÌÍÜÜÖÌWJBBBBQÕRPÝÙ]]J  ÌÍÓ[ÝÙTÜÖ    ÌÍÜÜÖÌJBBBBQÕRPÝÙ]]J   ÌÍÓ[ÝÙTÜÖK   ÌÍÜÜÖÌWJBBBBQÕRPÝÙ]]J  ÌÍÔ^[ÛÛÜ  ÌÍØÛÛÜBBBBIÌÍÒV
TÝ[ÔYÚ
^
    ÌÍØÛÛÜK
BBBBQÕRPÝÙ]]J    ÌÍÚ^ÛÛÜ   ][ÝÌ  ][ÝÉ[ÉÌÍÒV
BBBBQÕRPÝÙ]ÐÛÛÜ  ÌÍÓ[ÜÝÛÛÜ   ][ÝÌ  ][ÝÉ[Ò^
    ÌÍØÛÛÜJBBBQ[ÙBBBBQÕRPÝÙ]]J    ÌÍÓ[ÝÙTÜÖ    ][ÝËKKKI][ÝÊBBBBQÕRPÝÙ]]J    ÌÍÓ[ÝÙTÜÖK   ][ÝËKKKI][ÝÊBBBBQÕRPÝÙ]]J    ÌÍÔ^[ÛÛÜ  ][ÝÉ][ÝÊBBBBQÕRPÝÙ]]J    ÌÍÚ^ÛÛÜ   ][ÝÉ][ÝÊBBBQ[YBQ[YÑ[[[Â[ÈÙÙÛT]ÙJ
B   ÌÍÔ]ÙYHÕ   ÌÍÔ]ÙYÚ[H  ÌÍÔ]ÙYÛY
L
BBIÌÍÛÙÏQÕRQÙ]ÙÊ
BÙ[XÝØÙH    ÌÍÛÙÏIÌÍÑÕRWÑUSÐÓÔÑB^]BQ[Ù[XÝÑ[[[

Pixel_Get_Color.exe

Edited by Nahuel

Share this post


Link to post
Share on other sites
xwinterx

Pretty cool man.

Share this post


Link to post
Share on other sites
xwinterx

Slightly modified. Removes the need for 2 hotkeys. Just press the PAUSE key to freeze and unfreeze the gui data

#include <GUIconstants.au3>
#NoTrayIcon

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")

GUICreate("Pixel Color", 200, 180, -1, -1, -1, $WS_EX_TOPMOST)
GUICtrlCreateLabel("Mouse Coord.:", 10, 10)
$MousePos=GUICtrlCreateInput("", 100, 10, 90, 20, $ES_READONLY)
GUICtrlCreateLabel("Decimal Code: ", 10, 40)
$PixelColor=GUICtrlCreateInput("", 100, 40, 90, 20, $ES_READONLY)
GUICtrlCreateLabel("Hex Code:", 10, 70)
$hexColor=GUICtrlCreateInput("", 100, 70, 90, 20,$ES_READONLY)
GUICtrlCreateLabel("Color:", 10, 100)
$MostrarColor=GUICtrlCreateLabel("", 100, 100, 90, 20,$ES_READONLY)
GUICtrlCreateLabel("Press PAUSE to freeze/unfreeze data.", 0, 140 ,200, 15, $SS_CENTER)
GUICtrlSetColor(-1,0x00808080)


GUISetState()
While 1
    $msg=GUIGetMsg()
    data()
    Select
        Case $msg=$GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd


Func data()
    While 1
        $msg=GUIGetMsg()
            Select
            Case $msg=$GUI_EVENT_CLOSE
                $loop=0
                Exit
            EndSelect
        Sleep(25)
        $pos=MouseGetPos()
        $color=PixelGetColor($pos[0],$pos[1])
        GUICtrlSetData($MousePos,"X="&$pos[0]&" Y="&$pos[1])
        GUICtrlSetData($PixelColor,$color)
        $HEX6=StringRight(Hex($color),6)
        GUICtrlSetData($hexColor,"#"&$HEX6)
        GUICtrlSetBkColor($MostrarColor,"0x"&Hex($color))
    WEnd
EndFunc

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(10)
    WEnd
EndFunc
Edited by xwinterx

Share this post


Link to post
Share on other sites
xwinterx

So I am really bored and decided to add something more to this. Thanks for originally posting this cuz it will actually become a quite handy tool for me. Anyhow, here is what I added:

Coordinate Options (radio box group):

Full Screen - Just what it says, gets the color anywhere on the screen and returns the X,Y coordinates accordingly.

Active Window - Returns coordinates in the active window only. Handy if you are needing to find coordinates of colors relative to the active window only. "Blanks" out all values if the mouse exceeds the boundaries of the given active window. Enjoy!

color_tool.au3

Share this post


Link to post
Share on other sites
Nahuel

haha, very nice! thank you, it is handy.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×