Jump to content

Get Color


Valuater
 Share

Recommended Posts

UPDATED - Dec 19, 2007

At times I have wanted to know the RGB Hex Color for

PixelSearch()

GUICtrlSetBkColor ()

GUICtrlSetColor()

GUISetBkColor()

_GUICtrlMonthCalSetColor ()

and many other controls....

So I have created a Very Handy color finder. there are two options

F8

opens a color dialog box and you can choose any color you would like

F9

Gets the color under the mouse pointer

These colors and mouse coordinates are placed in a gui for you to clearly see which color you have chosen...

and

The color is copied to the ClipBoard so you can easily paste it right into your script

F7

Checks that positiojn to see if the color changes, notify on change ( added 2-8-2006)

hope it's helpful to you all...... Enjoy!!!!!!

;*********** Use **************
; Press Esc to terminate script
; Press F8 to open a color dialog box and choose a color
; Or
; Press F9 to get the color under the mouse pointer
; Then press F7 to watch for color change
;
; by Valuater...... Enjoy!!! 
;******************************
#include <GuiConstants.au3>
#include <Misc.au3>

; BE SURE TO CHECK THESE TWO ***************************************************
Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client
Opt("PixelCoordMode", 0) ;1=absolute, 0=relative, 2=client


Global $var, $Color_win, $pos, $my_color, $check

HotKeySet("{ESC}", "Terminate")
HotKeySet("{F9}", "Get_Color")
HotKeySet("{F8}", "Color_Box")
HotKeySet("{F7}", "Check_Color")

ToolTip('Get Color - is Running',0,0)
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func Color_Box()
    $var = _ChooseColor (2)
    $pos = MouseGetPos()
    Show_Color()
EndFunc
Func Terminate()
    Exit 0
EndFunc
Func Get_Color()
    $pos = MouseGetPos()
    $Svar = PixelGetColor(  $pos[0] , $pos[1])
    $var = "0x" & Hex($Svar,6)
    Show_Color()
EndFunc
Func Show_Color()
    GUIDelete($Color_win)
    ClipPut($var)
    $my_color = $var
    $Color_win = GUICreate("RGB Color = " & $var, 290, 150, -1, -1)
    GUISetBkColor($var)
    GUISetFont(9, 400, -1, "MS Sans Serif")
    GUICtrlCreateLabel(" This Color has been Copied to the ClipBoard  " & @CRLF & @CRLF & "  Just Paste it wherever you would like"& @CRLF & @CRLF & @CRLF & " Mouse position X=" & $pos[0] & "  Y=" & $pos[1]   , 10, 10, 270, 100)
    GUICtrlSetFont(-1, 9, 650)
    If $var = 0x000000 Then GUICtrlSetColor( -1, 0xFFFFFF)
    $OK_Btn = GUICtrlCreateButton("&OK", 100, 110, 80, 30)
    GUISetState()
    While 2
        $msg1 = GUIGetMsg()
        If $msg1 = $OK_Btn Or $msg1 = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete($Color_win)   
EndFunc
Func Check_Color()
    $check = NOT $Check
    If $check Then ToolTip('Get Color - is Checking Color',0,0)
    While $check
        $var2 = PixelGetColor(  $pos[0] , $pos[1])
        If $my_color <> $var2 Then
            MsgBox(262208, "Color Check", " the Color has changed   ")
            ExitLoop
        EndIf
    WEnd
    ToolTip('Get Color - is Running',0,0)
EndFunc

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Combine this script with...

< http://www.autoitscript.com/forum/index.ph...wtopic=6015&hl= >

... add a crosshair to the magnify box and you have the sweetest screen color picker goin.

p.s. also the option to return decimal color values too ( I have been using decimal forever. )

[edit]

If it was me I would also add some splash text that is updated constantly with current pixel location, color in rgb and decimal and whatever other info you think is relevent.

Edited by Hooch
Link to comment
Share on other sites

Game Bots Can you make one that auto aimes at the color?;)

Yes I could, however the intent of this little script is to get the correct RGB Hex color for YOU to be able to look for in the game

I hope you found the beta as suggested by gafrost

????

there are all kinds of bots in this forum have you searched the "name" of the game bot you would like to see

8)

NEWHeader1.png

Link to comment
Share on other sites

  • 3 months later...
  • 4 months later...

I didn't know about this your, and I made my own last week.

It has:

- SpashText with HEX,RGB,INT

- hotkeys F5/F6/F7 for copy to clipboard these 3 values

- traymenu for Enable/disable hotkeys/SplashText and Exit

Here is it:

#Compiler_Icon=get_color.ico

#include <color.au3>
#include <Constants.au3>

Opt("TrayAutoPause",0)
Opt("TrayMenuMode",1); no default menu (Paused/Exit)

HotKeySetOn()

If @Compiled Then 
    $ico = @ScriptName
Else
    $ico = "get_color.ico"
EndIf

$EnableItem = TrayCreateItem("Enable")
TrayItemSetState(-1 ,$TRAY_CHECKED)
TrayCreateItem("")
$EndItem = TrayCreateItem("End")
TraySetIcon($ico)
TraySetToolTip('Color (RGB)')
TraySetState()
TraySetClick(8); Pressing secondary mouse button

Global $is_enabled = 1
$hwnd = SplashTextOn('Color (RGB)','',150,60, @DesktopWidth - 160, @DesktopHeight - 120, 16)

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = $EnableItem
            Enable()
        Case $msg = $EndItem
            Exit
    EndSelect
    
    ControlSetText($hwnd, "", "Static1", GetColors())
    Sleep(15)
WEnd

Func GetColors()
    $pos = MouseGetPos()
    $color = PixelGetColor($pos[0], $pos[1])
    $color_txt = StringFormat('%03i %03i %03i', _ColorGetRed($Color), _ColorGetGreen($Color), _ColorGetBlue($Color))
    $color_hex = "0x" & Hex($color, 6)
    
    Return $color_hex & @CRLF & $color_txt & @CRLF & $color
EndFunc

Func GetColor($index)
    $color = GetColors()
    $color = StringSplit($color, @CRLF, 1)
    Return $color[$index]
EndFunc

Func Copy1()
    ClipPut(GetColor(1))
EndFunc

Func Copy2()
    ClipPut(GetColor(2))
EndFunc

Func Copy3()
    ClipPut(GetColor(3))
EndFunc

Func Enable()
    $is_enabled = Not $is_enabled

    If $is_enabled Then
        WinSetState($hwnd, '', @SW_SHOW)
        HotKeySetOn()
    Else
        WinSetState($hwnd, '', @SW_HIDE)
        HotKeySetOff()
    EndIf
EndFunc

Func HotKeySetOn()
    HotKeySet("{F5}", "Copy1")
    HotKeySet("{F6}", "Copy2")
    HotKeySet("{F7}", "Copy3")
EndFunc

Func HotKeySetOff()
    HotKeySet("{F5}")
    HotKeySet("{F6}")
    HotKeySet("{F7}")
EndFunc

Func OnAutoItExit()
    HotKeySetOff()
EndFunc

get_color.ico

EDIT: changed code to AutoIt

Edited by Zedna
Link to comment
Share on other sites

  • 1 year later...

mod. ı m new . And ı want to learn thıs programme.

ı m lookıng for ko scrıpts (auto attack and auto loot box )

ıf we get box's color and wrıte thıs ın scrıpt of autoloot ; scrıpt can be fınd box can clıck and loot them ??

how ı do ıt .. ; can you help me pls ?

Link to comment
Share on other sites

Zedna

Change the main loop to this:

$OldGetColors = ""

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = $EnableItem
            Enable()
        Case $msg = $EndItem
            Exit
    EndSelect
    
    $GetColors = GetColors()
    
    If $GetColors <> $OldGetColors Then
        ControlSetText($hwnd, "", "Static1", $GetColors)
        $OldGetColors = $GetColors
    EndIf
        
    Sleep(15)
WEnd

This will avoid from "flicking text".

psreauk

Please post in the General Help and Support for getting help.

Edit: Corrected Zedna's nick name :">

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

  • 6 months later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...