Sign in to follow this  
Followers 0
lod3n

Get Color

1 post in this topic

#1 ·  Posted (edited)

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]

Share this post


Link to post
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
Sign in to follow this  
Followers 0