Jump to content
Sign in to follow this  
CodyBarrett

how to GET color values

Recommended Posts

CodyBarrett

lol yes simple question isnt it? i ahve checked the forums.. did'nt even get a single topic.... so howdo i find out what a color value is... say black=?? :) lol

Share this post


Link to post
Share on other sites
Tomb

black is 0x000000

#Include <Misc.au3>

$Color = _ChooseColor(1)
MsgBox(0, "", $Color)

Share this post


Link to post
Share on other sites
Tomb

here is another example i found.

#include <GuiConstants.au3>
Global $Progress[4], $C_set = 0
$gui = GUICreate("Color handler", 390, 140, -1, -1)
GUISetBkColor(0x00FC00, $gui); *********** for testing
$Progress[1] = GUICtrlCreateProgress(10, 10, 330, 20)
$Progress[2] = GUICtrlCreateProgress(10, 40, 330, 20)
$Progress[3] = GUICtrlCreateProgress(10, 70, 330, 20)
$Label_4 = GUICtrlCreateLabel("Red", 350, 10, 50, 20)
GUICtrlSetColor($Label_4, 0xff0000)
$Label_5 = GUICtrlCreateLabel("Green", 350, 40, 60, 20)
GUICtrlSetColor($Label_5, 0x00ff00)
$Label_6 = GUICtrlCreateLabel("Blue", 350, 70, 50, 20)
GUICtrlSetColor($Label_6, 0x0000ff)

$Label_7 = GUICtrlCreateLabel("", 50, 110, 350, 20)

GUISetState()
While GUIGetMsg() <> -3
    For $iCC = 1 To 3
        If sliderprobar($Progress[$iCC], $Progress[$iCC]) Then GUISetBkColor(setcolor())
        
    Next
WEnd

Func sliderprobar($prog_name, $prog_ID)
    $aCPos = GUIGetCursorInfo()
    $cpos = ControlGetPos($gui, "", $prog_name)
    If $aCPos[4] = $prog_ID And _IsPressed("01") Then
        GUICtrlSetData($prog_name, $aCPos[0]/ ($cpos[2] / 100) - 2)
        Sleep(100)
        Return 1
    EndIf
    Return 0
EndFunc  ;==>sliderprobar

Func _IsPressed($s_hexKey, $v_dll = 'user32.dll')
    Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey)
    If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1
    Return 0
EndFunc  ;==>_IsPressed

Func setcolor()
    Local $hexnum, $nnum
    For $iCC = 1 To 3
        $hexnum = (255 / 100) * Number(GUICtrlRead($Progress[$iCC]))
        $nnum &= Hex($hexnum, 2)
    Next
    GUICtrlSetData($Label_7, "The color copied to the clipboard is... " & (('0x' & $nnum)))
    ClipPut('0x' & $nnum)
    Return Execute('0x' & $nnum)
EndFunc  ;==>setcolor

Share this post


Link to post
Share on other sites
CodyBarrett

omg thank you man :) how did i miss that :)

Share this post


Link to post
Share on other sites
CodyBarrett

i did the first one and it helped lol thanks anyway

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.