Jump to content

Get Color


lod3n
 Share

Recommended Posts

Someone's probably already posted something similar, but I thought this worth posting:

#include <GUIConstants.au3>
#include <Color.au3>
#Include <Misc.au3>
#include <String.au3>

$gui = GUICreate ( "Get Color - Press ESC when ready", 200 , 50 , 100 , 100 ,$WS_CAPTION ,$WS_EX_TOOLWINDOW )
WinSetOnTop ($gui, "", 1)
GUISetState(@SW_SHOW)

$user32 = dllopen("user32.dll")
while not _IsPressed("1B", $user32)
    sleep(100)
    $color = getmousecolor()
    GUISetBkColor ($color, $gui )
WEnd
DllClose($user32)

$r = hex(_ColorGetRed( $color),2)
$g = hex(_ColorGetGreen( $color),2)
$b = hex(_ColorGetBlue( $color),2)
$hexcolor = "#"&$r&$g&$b
clipput($hexcolor)
WinActivate($gui)
msgbox(0,"Get Color","Placed in clipboard: "&$hexcolor)

func getmousecolor()
    $pos = MouseGetPos()
    return PixelGetColor ( $pos[0],$pos[1] )
EndFunc

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/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...