Yashied Posted March 24, 2010 Posted March 24, 2010 (edited) LAST VERSION - 1.107-Dec-10This library provides a dialog box to select a color in three color models - RGB (Red, Green, Blue), HSL (Hue, Saturation, Lightness), and HSB (Hue, Saturation, Brightness). This is not a program, this is a function that you can use in your scripts. This function is similar to the _ChooseColor() from Misc UDF library that is included in the AutoIt package. UDF is fully compatible with ColorPicker UDF (v1.5) and can be used as a custom function for a Color Chooser dialog box (see examples). Also there is a tool (pipette) to get the color from the screen. I recommend to first read description inside the library. Please play with this UDF and post any comments and suggestions.ColorChooser UDF Library v1.1Previous downloads: 316ColorChooser.au3Example1#Include <ColorChooser.au3> Opt('MustDeclareVars', 1) Global $hForm, $Msg, $Label, $Button, $Data, $Color = 0x50CA1B $hForm = GUICreate('MyGUI', 170, 200) $Label = GUICtrlCreateLabel('', 15, 15, 140, 140, $SS_SUNKEN) GUICtrlSetBkColor(-1, $Color) $Button = GUICtrlCreateButton('Select color...', 35, 166, 100, 23) GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button $Data = _ColorChooserDialog($Color, $hForm) If $Data > -1 Then GUICtrlSetBkColor($Label, $Data) $Color = $Data EndIf EndSwitch WEndExample2 (required ColorPicker UDF)#Include <ColorChooser.au3> #Include <ColorPicker.au3> Opt('MustDeclareVars', 1) Global $hForm, $Msg, $Label, $Picker $hForm = GUICreate('MyGUI', 170, 200) $Label = GUICtrlCreateLabel('', 15, 15, 140, 140, $SS_SUNKEN) GUICtrlSetBkColor(-1, 0x50CA1B) $Picker = _GUIColorPicker_Create('', 55, 166, 60, 23, 0x50CA1B, BitOR($CP_FLAG_CHOOSERBUTTON, $CP_FLAG_MAGNIFICATION, $CP_FLAG_ARROWSTYLE), 0, -1, -1, 0, 'Simple Text', 'Custom...', '_ColorChooserDialog') GUISetState() While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $Picker GUICtrlSetBkColor($Label, _GUIColorPicker_GetColor($Picker)) EndSwitch WEnd Edited December 26, 2013 by Yashied Belini 1 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Yashied Posted March 29, 2010 Author Posted March 29, 2010 The library has been updated. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Shafayat Posted March 29, 2010 Posted March 29, 2010 This is quite nice. And useful. Thanks [Not using this account any more. Using "iShafayet" instead]
Yashied Posted April 20, 2010 Author Posted April 20, 2010 The library has been updated.v1.1ChangesAdded the following flags for more appearance changes and functionality of the dialog box. $CC_FLAG_SOLIDCOLOR $CC_FLAG_CAPTURECOLOR $CC_FLAG_USERCOLOR $CC_FLAG_DEFAULTAdded ability to save up to 20 color values, and use them in other programs that using this library (see $CC_FLAG_USERCOLOR).Fixed several minor bugs. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Beege Posted June 4, 2010 Posted June 4, 2010 Yashid, I get the following errors when running example 1: F:\AutoIt\Other People Projects and Examples\Yasheid\Color Choser UDF\ColorChooser.au3(1295,47) : ERROR: CP_WM_COMMAND(): undefined function. CP_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ F:\AutoIt\Other People Projects and Examples\Yasheid\Color Choser UDF\ColorChooser.au3(1469,59) : ERROR: CP_WM_SETCURSOR(): undefined function. $Result = CP_WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam) Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator
Yashied Posted June 4, 2010 Author Posted June 4, 2010 Yashid, I get the following errors when running example 1... With this code you also get an error, but the code is absolutely correct. Do not pay any attention to it. If (IsDeclared('A')) And ($A = 1) Then MyFunc() EndIf My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Yashied Posted October 12, 2010 Author Posted October 12, 2010 Small update. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
tip Posted November 4, 2010 Posted November 4, 2010 This requires really hard work. Thanks Yashied. I appreciate it... Regards Tip [center]MsgBox_Tipped: Eye candy msgboxes/inputboxes/loginboxes. | CreateBlankBox: Semi-transparent layers with borders and rounded corners.[/center]
Yashied Posted December 7, 2010 Author Posted December 7, 2010 The library has been updated. Now Au3Check shows no errors. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
happytc Posted May 25, 2011 Posted May 25, 2011 when R = 250, G = 250, B = 250, return value of ColorChooser function is H = 160, S = 0, L = 240 why here H = 160, instead of H = 0 ?
PAEz Posted August 23, 2011 Posted August 23, 2011 (edited) when R = 250, G = 250, B = 250, return value of ColorChooser function is H = 160, S = 0, L = 240why here H = 160, instead of H = 0 ?When Saturation is 0 it really doesnt matter what the Hue is because its still going to be grey/black/white and its very common in this instance for the hue to be set to the center of the colour wheel which is 160 in this case.EDIT: Freakn great UDF....the color picker tool is just gravy! Edited August 23, 2011 by PAEz
Andreik Posted December 2, 2013 Posted December 2, 2013 It's possible for _GUIColorPicker_GetColor() to return directly HSL or HSB not just RGB?
Moderators Melba23 Posted December 2, 2013 Moderators Posted December 2, 2013 Andreik,A quick search (you did do one before posting?) brought up this thread which looks as if it could be useful to you. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Andreik Posted December 2, 2013 Posted December 2, 2013 I saw that post but I asked because the UI where you select the color let you see all this color spaces. Following the same logic I asked if wouldn't be good to have an option (second parameter as flag) to get the color in the desired format.
MachinistProgrammer Posted April 11, 2014 Posted April 11, 2014 for some reason the dialog is not returning a proper hexdecemel All my projects live on github
Tiotua Posted September 3, 2014 Posted September 3, 2014 Nice tool, well done At least with AutoIt 3.3.12.0 a little patch is necessary: ; Search: Global Const $CC_WM_SYSCOMMAND = 0x0112 ; Insert below: Global Const $ghGDIPDll = @SystemDir & '\GdiPlus.dll'
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now