Sign in to follow this  
Followers 0
careca

Color picker

8 posts in this topic

Hello, is there anything like a color picker?

I would like to implement something that would allow me to choose a color i want, but instead of having a palette of 5 or 6 fixed colors, would be good to pick the exact color i want at that moment.

See attachment for what i mean, it's the picker from "paint".

post-68092-0-87940700-1405281990_thumb.p


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites



Or search the forum for "color picker". You will find a lot of examples.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thank you fellas, it's late, and i didn't see _ChooseColor() that in the help file, thank you.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

_ChooseColor() is in my help file.  I have the version 33.12.0

REB

Edit  sorry i thought you could not find it but you said "i didn't see".  I need to read closer  :

Edited by reb

MEASURE TWICE - CUT ONCE

Share this post


Link to post
Share on other sites

How do you retrieve the "add to custom colors" data?


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

This is how I do it..

; ColorChooser() By Cor
;
; An alternative version of the system color chooser dialog function.
; This version can store and retrieve the 16 custom colors. Nifty.
;
; Send an array of 17 AutoIt RGB (e.g. 0xF0EBC3) colors, the first $array[0] being the
; color you wish to initially set in the picker, and the other 16, any custom colors
; you want to set. Empty values can be set to 0.
;
; Returns an array of 17 colors, $array[0] being the color "picked", and the other 16,
; any custom colors the user may have chosen. You can, of course, store these and then
; send them back to the color picker the next time it is called. At last! Store them
; in an ini file or wimilar and use them after next launch.
;
; NOTE: This function accepts and returns AutoIt RGB colors. If you need to convert to
; and from other color values, use ConvertColorValue(above)
;
func ColorChooser($CustomColors=0, $hWndOwnder=0)

    if not IsArray($CustomColors) or Ubound($CustomColors) < 17 then
        $CustomColors = StringSplit("0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", ",", 2)
    endif

    local $ret_array[17], $color_picked, $aResult

    local $custcolors = "int ccolors[16]"
    local $col_STRUCT = "dword Size;hwnd hWndOwnder;handle hInstance;dword rgbResult;ptr CustColors;dword Flags;lparam lCustData;ptr lpfnHook;ptr lpTemplateName"
    local $tChoose = DllStructCreate($col_STRUCT)
    local $tcc = DllStructCreate($custcolors)

    $CustomColors[0] = '0x' & StringMid($CustomColors[0], 7, 2) & StringMid($CustomColors[0], 5, 2) & StringMid($CustomColors[0], 3, 2)

    DllStructSetData($tChoose, "Size", DllStructGetSize($tChoose))
    DllStructSetData($tChoose, "hWndOwnder", $hWndOwnder)
    DllStructSetData($tChoose, "rgbResult", $CustomColors[0])
    DllStructSetData($tChoose, "CustColors", DllStructGetPtr($tcc))
    DllStructSetData($tChoose, "Flags", BitOR($__MISCCONSTANT_CC_ANYCOLOR, $__MISCCONSTANT_CC_FULLOPEN, $__MISCCONSTANT_CC_RGBINIT))

    for $i = 1 to 16 ; set the custom colors..
        $ccolor = Dec(StringMid($CustomColors[$i], 7, 2) & StringMid($CustomColors[$i], 5, 2) & StringMid($CustomColors[$i], 3, 2))
        DllStructSetData($tcc, "ccolors", $ccolor, $i)
    next

    $aResult = DllCall("comdlg32.dll", "bool", "ChooseColor", "struct*", $tChoose)
    if ($aResult[0] == 0) then return SetError(-3, -3, -1)
    if @error then return SetError(@error, @extended, -1)

    $color_picked = Hex(String(DllStructGetData($tChoose, "rgbResult")), 6)
    if $color_picked < 0 then return SetError(-4, -4, -1)

    $ret_array[0] = '0x' & StringMid($color_picked, 5, 2) & StringMid($color_picked, 3, 2) & StringMid($color_picked, 1, 2)
    for $i = 1 to 16 ; create custom color array for return
        $cc = Hex(DllStructGetData($tcc, "ccolors", $i), 6)
        $ret_array[$i] = '0x' & StringMid($cc, 5, 2) & StringMid($cc, 3, 2) & StringMid($cc, 1,   2)
    next
    return $ret_array
endfunc

#cs

; a full implementation..


; to store any system picked custom colors..
global $MyColors[17] = [""]


; System Color Picker..

func HotKeySystemPicker()
    SystemPicker($current_color)
endfunc

func SystemPicker($color)
    UnSetHotKeys()
    LoadCustomColors()
    $MyColors[0] = '0x' & $color
    $ret_colors = ColorChooser($MyColors, $MyGUI)
    if @error then return false
    switch $ret_colors[0]
        case -1, -3, -4, ""
            SetHotKeys()
            return false
        case else
            $MyColors = $ret_colors
            $new_color = StringTrimLeft($MyColors[0], 2)
            SaveCustomColors()
            SetHotKeys()
    endswitch
endfunc

func SaveCustomColors()
    if not IsArray($MyColors) or UBound($MyColors) < 17 then return false
    local $color_str
    for $i = 1 to 16
        $color_str &= $MyColors[$i] & ","
    next
    $color_str = StringTrimRight($color_str, 1)
    if IniWrite($cpc_ini_path, $cpc_my_name, "custom_colors", $color_str) then return true
endfunc

func LoadCustomColors()
    local $color_str = IniRead($cpc_ini_path, $cpc_my_name, "custom_colors", "")
    $MyColors = StringSplit($color_str, ",")
endfunc


All the above and more, here: http://corz.org/public/machine/source/windows/AutoIt%20Includes/corz_colors.au3
Note: some of those includes need updating!

#ce

;o) Cor

 

1 person likes this

nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites

Oh i see, thank you, i was thinking i could i do the same for the existing colorpicker, but can't retrieve the colors.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

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  
Followers 0