Code: Select all
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.8.1
Name: GetColor.exe for Rainmeter 2.3.3
Author: KreAch3R | kredoc.deviantart.com
Script Function:
Gets the Pixel Color of your mouse coordinates.
#ce ----------------------------------------------------------------------------
#include <SendMessage.au3>
If $CmdLine[0] = 4 Then
$ConfigToSet = $CmdLine[1]
$VarToSet = $CmdLine[2]
$FileToSet = $CmdLine[3]
$Format = $CmdLine[4]
Else
Exit
EndIf
$mouse = MouseGetPos()
$DecColor = PixelGetColor ( $mouse[0], $mouse[1])
$HexColor = Hex($DecColor, 6)
;~ Hex to RGB:
$nHex = "0x" & $HexColor
$Blue = BitAND($nHex, 0xFF)
$Green = BitAND(BitShift($nHex, 8), 0xFF)
$Red = BitAND(BitShift($nHex, 16), 0xFF)
if $Format = "HEX" then
$Color = $HexColor
elseif $Format = "RGB" Then
$Color = $Red & ',' & $Green & ',' & $Blue
EndIf
Sendbang("!WriteKeyValue Variables " & $VarToSet & " " & $Color & " " & $FileToSet & "")
Sendbang("!RefreshApp")
Exit
;~ FUNCTION: Send Rainmeter !bangs
Func SendBang($szBang)
Local Const $hWnd = WinGetHandle("[CLASS:RainmeterMeterWindow]")
If $hWnd <> 0 Then
Local Const $iSize = StringLen($szBang) + 1
Local Const $pMem = DllStructCreate("wchar[" & $iSize & "]")
DllStructSetData($pMem, 1, $szBang)
Local Const $pCds = DllStructCreate("dword;dword;ptr")
DllStructSetData($pCds, 1, 1)
DllStructSetData($pCds, 2, ($iSize * 2))
DllStructSetData($pCds, 3, DllStructGetPtr($pMem))
Local Const $WM_COPYDATA = 0x004A
_SendMessage($hWnd, $WM_COPYDATA, 0, DllStructGetPtr($pCds))
EndIf
EndFunc
I just don't like the on/off of the skin. If you insist, you can send a !Hide like this: Sendbang("!Hide " & $ConfigToSet & "") and a !Show respectively.
The !Bang in the skin is this: LEftMouseUpAction=["#@#Addons\GetColor.exe" "#CURRENTCONFIG#" "MyColor" "#IncFile#" "#Format#"], where Format is either 'HEX' or 'RGB'.
Let me know if you would like to merge the tools or if I should release it as standalone.