Jump to content

Desktop 2 RGB


November
 Share

Recommended Posts

Well, its nothing much, bur someone ask me to do that to capture some colors of some brands logo colors :)

So i made this really simple script, i hope you enjoy.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

        
HotKeySet("^!x" , "getcolor")
HotKeySet("{ESC}" , "fexit")

dim $vdif, $wdif, $r, $g, $b, $hex

$main = GUICreate("Get RGB Color", 105, 35, @DesktopWidth - 145, @DesktopHeight - 95, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
$label = GUICtrlCreateLabel("", 15, 10, 80, 20, $SS_CENTER)
GUISetState()

while 1

$mouse = MouseGetPos()

Select
    case $mouse[0] > @DesktopWidth - 60 And $mouse[1] < @DesktopHeight - 60 
        $wdif = -150
    case $mouse[1] > @DesktopHeight - 60 And $mouse[0] < @DesktopWidth - 60
        $vdif = -50
    case $mouse[0] <= @DesktopWidth - 60
        $wdif = 10
    Case $mouse[1] <= @DesktopHeight - 60 
        $vdif = 40
    case $mouse[0] > @DesktopHeight - 150  AND $mouse[1] > @DesktopHeight - 150 
        $vdif = -50
        $wdif = -150
EndSelect

$var = PixelGetColor( $mouse[0] , $mouse[1])
$background = GUICtrlSetBkColor($main, $var)
GUISetBkColor($var, $main)
middle()
GUICtrlSetData($label, $R & ", " & $G & ", " & $B)
ToolTip("ALT+CTRL+X (Get Color)" & @CRLF & "ESC (Exit Program)", $mouse[0] + $wdif, $mouse[1] + $vdif, "", 0, 0)
$wdif = 5
$vdif = 0
Sleep(10)

WEnd

Func getcolor()
    $output = ""
    $hex = Hex ( $var , 6)
    $output = $output & "RGB Color : " & $R & ", " & $G & ", " & $B
    TrayTip("RGB Color", $output & @CRLF & "Copied to Clipboard", 1)
    ClipPut("R:"& $R & " G:" & $G & " B:" & $B)
EndFunc

func middle()
    $hex = Hex ( $var , 6)
    $HR = StringMid($hex, 1, 2)
    $HG = StringMid($hex, 3, 2)
    $HB = StringMid($hex, 5, 2)
    $R = Dec($HR)
    $G = Dec($HG)
    $B = Dec($HB)
    if $r <= 60 AND $g <= 60 AND $b <= 60 Then GUICtrlSetColor($label, 0xFFFFFF)
    if $r > 60 AND $g > 60 AND $b > 60 Then GUICtrlSetColor($label, 0x000000)
EndFunc

func fexit()
    Exit
EndFunc

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Gostei, foi um ótimo exemplo :)

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

Thats pretty cool. Nice work.

Thank m8, this was a request, and when ideas are given, we work better :mad:

Nice work November...

Thank Gesller, I always try do do something different o:)

Gostei, foi um ótimo exemplo :)

Obrigado A. Percy, volte sempre :) (É bom ouvir um bocado de Portugues neste forum de vez em quando ;) )

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

Obrigado A. Percy, volte sempre :) (É bom ouvir um bocado de Portugues neste forum de vez em quando :) )

Idem! Pode não ser o idioma mais usado no mundo, mas é um dos mais interessantes. Ou seja, somos privilegiados o:)

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

Yes, language is really great. Phonetically one of the most fascinating (to me anyway).

Thanx Trancexx,

I always like to keep it simple... if i know how :) :)

Cheers

nice work, useful script, thanx

Yeah i think its a good script for marketing/webdesign... its was that departement o:)

Thanx m8

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
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
 Share

  • Recently Browsing   0 members

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