It is currently April 24th, 2024, 10:39 pm

Rainmeter Color Picker Skin

Share and get help with Plugins and Addons
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Rainmeter Color Picker Skin

Post by KreAch3R »

I found the thread in the AutoIt forums about the Screen Average function, too, but the last post there was in 2010, so I thought it was a dead project. I managed to build a similar app, that practically does the same thing (without averaging anything though, it just takes the color of one pixel). It gets the job done most of the time, so don't mess around with the AutoIt change just for me. :)

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
Important: I don't hide/show the meter before taking the color, because I use a circle to pick the spot:
Image

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. :)
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Rainmeter Color Picker Skin

Post by jsmorley »

Good deal. Go ahead and release it as yours. I'll get the average thing working one of these days when I have time to really dig into it and figure out what AutoIt changed in their GDI+ stuff.
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Rainmeter Color Picker Skin

Post by KreAch3R »

Thank you. Ok then, I 'll try to make it as user-friendly as possible and release it when I find the time. I hope you find what AutoIt changed easily. :)
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image