Here is a slightly more complicated example showing why I am doing it the way I am:
shape hover 2.gif
Hover.ini:
Code: Select all
[Rainmeter]
MiddleMouseUpAction=[!Refresh]
AccurateText=1
[Variables]
colorButton1=255,50,50
colorButton2=50,255,50
colorButton3=50,50,255
hoverAlpha=200
[StyleButtonIcon]
Shape=Rectangle 0,0,15,15,3 | StrokeWidth 0 | Extend Fill
DynamicVariables=1
X=5
Y=5R
[StyleButtonLabel]
FontFace=Segoe UI
FontSize=9
FontWeight=500
FontColor=220,220,220
Antialias=1
X=4R
Y=r
Padding=0,-1,0,0
[StyleButtonMouseRegion]
X=[&[&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Icon:X]
Y=[&[&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Icon:Y]
W=([&[&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Icon:W] + [&[&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Label:W] + 2)
H=[&[&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Icon:H]
DynamicVariables=1
MouseOverAction=[!SetOption [&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Icon Fill "[&MeasureScript:GetKey('[&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Icon','Fill')],#hoverAlpha#"][!SetOption [&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Label FontColor "[&MeasureScript:GetKey('[&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Label','FontColor')],#hoverAlpha#"][!UpdateMeter [&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Icon][!UpdateMeter [&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Label][!Redraw]
MouseLeaveAction=[!SetOption [&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Icon Fill "[&MeasureScript:Gsub('[&MeasureScript:GetKey('[&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Icon','Fill')]', ',#hoverAlpha#')]"][!SetOption [&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Label FontColor "[&MeasureScript:Gsub('[&MeasureScript:GetKey('[&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Label','FontColor')]', ',#hoverAlpha#')]"][!UpdateMeter [&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Icon][!UpdateMeter [&MeasureScript:Gsub('[#CURRENTSECTION]','MouseRegion')]Label][!Redraw]
; Dummy Meters to prevent first-update log errors
[0Icon]
Meter=Image
[0Label]
Meter=Image
; ==================================================
; MEASURES
[MeasureScript]
Measure=Script
ScriptFile=#@#Scripts\Hover.lua
; ==================================================
; METERS
[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,80,65,3 | StrokeWidth 0 | Fill Color 25,25,25
; Button 1
[MeterButton1Icon]
Meter=Shape
MeterStyle=StyleButtonIcon
Fill=Fill Color #colorButton1#
Y=5
[MeterButton1Label]
Meter=String
MeterStyle=StyleButtonLabel
Text=Button 1
[MeterButton1MouseRegion]
Meter=Image
MeterStyle=StyleButtonMouseRegion
LeftMouseUpAction=[!SetVariable colorButton1 "255,255,255"][!Update]
; Button 2
[MeterButton2Icon]
Meter=Shape
MeterStyle=StyleButtonIcon
Fill=Fill Color #colorButton2#
[MeterButton2Label]
Meter=String
MeterStyle=StyleButtonLabel
Text=Button 2
[MeterButton2MouseRegion]
Meter=Image
MeterStyle=StyleButtonMouseRegion
LeftMouseUpAction=[!SetVariable colorButton2 "255,255,255"][!Update]
; Button 3
[MeterButton3Icon]
Meter=Shape
MeterStyle=StyleButtonIcon
Fill=Fill Color #colorButton3#
[MeterButton3Label]
Meter=String
MeterStyle=StyleButtonLabel
Text=Button 3
[MeterButton3MouseRegion]
Meter=Image
MeterStyle=StyleButtonMouseRegion
LeftMouseUpAction=[!SetVariable colorButton3 "255,255,255"][!Update]
Hover.lua:
Code: Select all
function GetKey(name, key) return SKIN:GetMeter(name):GetOption(key) end
function Gsub(string, pattern, replacement) return string:gsub(pattern, replacement or '') end
As you can see, my method allows me to, with just a few overcomplicated MeterStyles, quickly and efficiently create dozens of color picker buttons without repeating too much code. In my suite, which has over 50 of these buttons, and where several of the skins are many thousands of lines long, saving space in an INI file is very important.
I do have a workaround that would work: I could add another option to each button icon with the plaintext name of the variable. Then I could edit the MeterStyle to pull this value when changing the Fill option. This would work, but would require me to add an additional line to each icon meter, which would be inefficient.
This is why I am trying to find another solution. Thanks for the help thus far!
You do not have the required permissions to view the files attached to this post.