Hest Posted May 5, 2009 Share Posted May 5, 2009 (edited) Inspired by this: http://www.autoitscript.com/forum/index.php?showtopic=93250 (Pixel Grab) I made an extended version.Might be usefull to someone.expandcollapse popup#include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> Global $pixel_last Global $color_label[8] Global $label_color[8] = [1, 2, 3, 4, 5, 6, 7] Global $last_label = 1 HotKeySet("{F11}","clip") HotKeySet("{ESC}","endme") #Region ### START Koda GUI section ### Form= $Pixelgrab_form = GUICreate("Color Grab", 177, 85, 797, 354) GUISetBkColor(0xFFFFFF) $font_group = GUICtrlCreateGroup("Color", 12, 8, 148, 65) $font_label = GUICtrlCreateLabel("", 46, 32, 90, 21) GUICtrlSetFont(-1, 12, 800, 0, "Verdana") ;GUICtrlCreateGroup("", -99, -99, 1, 1) For $i = 1 To 7 Local $step = 20 $color_label[$i] = GUICtrlCreateLabel("", $step * $i, 56, 12, 12, $SS_SUNKEN) Next GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 sleep(100) Call("grab") $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func grab() $pos = MouseGetPos() $pixel_hex = Hex(PixelGetColor($pos[0],$pos[1]), 6) If $pixel_last <> $pixel_hex Then GUICtrlSetData($font_label, "#" & $pixel_hex) EndIf $pixel_last = $pixel_hex EndFunc Func clip() ClipPut ("#" & $pixel_last) Local $color = "0x" & $pixel_last If $last_label > 7 Then $last_label = 7 For $i = 2 To 7 GUICtrlSetBkColor($color_label[$i - 1], $label_color[$i]) $label_color[$i - 1] = $label_color[$i] Next EndIf GUICtrlSetBkColor($color_label[$last_label], $color) $label_color[$last_label] = $color $last_label = $last_label + 1 EndFunc Func endme() Exit EndFunc Edited May 5, 2009 by Hest Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
KaFu Posted May 5, 2009 Share Posted May 5, 2009 I like they way you record the past colors, will "borrow" it for the next release of COP ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
FinalVersion Posted May 5, 2009 Share Posted May 5, 2009 Gj, better then mine [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
Hest Posted May 5, 2009 Author Share Posted May 5, 2009 (edited) I like they way you record the past colors, will "borrow" it for the next release of COP ...Glad you like it. Not sure if I have done it the best way though still learning. Edited May 5, 2009 by Hest Software:Model Train Calculator (Screen)Autoit3 beginner! Link to comment Share on other sites More sharing options...
FinalVersion Posted May 5, 2009 Share Posted May 5, 2009 Glad you like it. Not sure if I have done it the best way though still learning.Quick Tips: When posting soure code use [-autoit] [-/autoit] ( without - ) tags. And tidy it up a lil expandcollapse popup#include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIConstants.au3> Global $pixel_last Global $color_label[8] Global $label_color[8] = [1, 2, 3, 4, 5, 6, 7] Global $last_label = 1 HotKeySet("{F11}","clip") HotKeySet("{ESC}","endme") $Pixelgrab_form = GUICreate("Color Grab", 177, 85, 797, 354) GUISetBkColor(0xFFFFFF) $font_group = GUICtrlCreateGroup("Color", 12, 8, 148, 65) $font_label = GUICtrlCreateLabel("", 46, 32, 90, 21) GUICtrlSetFont(-1, 12, 800, 0, "Verdana") ;GUICtrlCreateGroup("", -99, -99, 1, 1) For $i = 1 To 7 Local $step = 20 $color_label[$i] = GUICtrlCreateLabel("", $step * $i, 56, 12, 12, $SS_SUNKEN) Next GUISetState(@SW_SHOW) While 1 sleep(100) Call("grab") $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd func grab() $pos = MouseGetPos() $pixel_hex = Hex(PixelGetColor($pos[0],$pos[1]), 6) If $pixel_last <> $pixel_hex Then GUICtrlSetData($font_label, "#" & $pixel_hex) EndIf $pixel_last = $pixel_hex EndFunc ;==>Grab Func clip() ClipPut ("#" & $pixel_last) Local $color = "0x" & $pixel_last If $last_label > 7 Then $last_label = 7 For $i = 2 To 7 GUICtrlSetBkColor($color_label[$i - 1], $label_color[$i]) $label_color[$i - 1] = $label_color[$i] Next EndIf GUICtrlSetBkColor($color_label[$last_label], $color) $label_color[$last_label] = $color $last_label = $last_label + 1 EndFunc ;==>Clip Func endme() Exit EndFunc ;==>EndMe [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
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