Finished updating my sample skin and figured I would share it here. It works like a charm! I even managed to add a new feature while I was at it! Thanks for all your help.
LoadSkin.gif
Code: Select all
[Rainmeter]
MiddleMouseUpAction=[!Refresh]
AccurateText=1
[Variables]
toggledSkinConfig=LoadSkin\ToggledSkin
toggledSkinConfigActive=[&MeasureConfigActive:IsActive([#toggledSkinConfig])]
toggledSkinConfigActiveIni=[&MeasureConfigActive:ConfigVariantName([#toggledSkinConfig])]
variant1Ini=Variant1.ini
variant2Ini=Variant2.ini
[MeasureConfigActive]
Measure=Plugin
Plugin=ConfigActive
DynamicVariables=1
[MeasureScript]
Measure=Script
ScriptFile=#@#Scripts\LoadSkin.lua
ToggleOn=[\x5a]
ToggleOff=[\x56]
RadioOn=[\x5c]
RadioOff=[\x5b]
ToggleGroup=SkinToggles
[StyleLabelString]
FontFace=Roboto
FontColor=240,240,240
FontSize=10
AntiAlias=1
X=3R
Y=-1r
[StyleToggleButton]
FontFace=ElegantIcons
FontColor=138,210,250
FontSize=12
AntiAlias=1
X=5
Y=4R
Group=SkinToggles
DynamicVariables=1
[MeterBackground]
Meter=Shape
Shape=Rectangle 0,0,128,102 | Fill Color 15,15,15 | StrokeWidth 0
[MeterToggleConfigButton]
Meter=String
MeterStyle=StyleToggleButton
Y=5
Text=[&MeasureScript:GetIcon([#toggledSkinConfigActive])]
LeftMouseUpAction=[&MeasureScript:ToggleSkin('[#toggledSkinConfig]', [#toggledSkinConfigActive])]
[MeterToggleConfigLabel]
Meter=String
MeterStyle=StyleLabelString
Text=Toggle Config
[MeterLoadVariant1Button]
Meter=String
MeterStyle=StyleToggleButton
Text=[&MeasureScript:GetIcon([#toggledSkinConfigActive], '[#variant1Ini]', '[#toggledSkinConfigActiveIni]')]
LeftMouseUpAction=[&MeasureScript:ToggleSkin('[#toggledSkinConfig]', [#toggledSkinConfigActive], '[#variant1Ini]', '[#toggledSkinConfigActiveIni]', 1)]
[MeterLoadVariant1Label]
Meter=String
MeterStyle=StyleLabelString
Text=Load Variant 1
[MeterLoadVariant2Button]
Meter=String
MeterStyle=StyleToggleButton
Text=[&MeasureScript:GetIcon([#toggledSkinConfigActive], '[#variant2Ini]', '[#toggledSkinConfigActiveIni]')]
LeftMouseUpAction=[&MeasureScript:ToggleSkin('[#toggledSkinConfig]', [#toggledSkinConfigActive], '[#variant2Ini]', '[#toggledSkinConfigActiveIni]', 1)]
[MeterLoadVariant2Label]
Meter=String
MeterStyle=StyleLabelString
Text=Load Variant 2
[MeterToggleVariant1Button]
Meter=String
MeterStyle=StyleToggleButton
Text=[&MeasureScript:GetIcon([#toggledSkinConfigActive], '[#variant1Ini]', '[#toggledSkinConfigActiveIni]', true)]
LeftMouseUpAction=[&MeasureScript:ToggleSkin('[#toggledSkinConfig]', [#toggledSkinConfigActive], '[#variant1Ini]', '[#toggledSkinConfigActiveIni]')]
[MeterToggleVariant1Label]
Meter=String
MeterStyle=StyleLabelString
Text=Toggle Variant 1
[MeterToggleVariant2Button]
Meter=String
MeterStyle=StyleToggleButton
Text=[&MeasureScript:GetIcon([#toggledSkinConfigActive], '[#variant2Ini]', '[#toggledSkinConfigActiveIni]', true)]
LeftMouseUpAction=[&MeasureScript:ToggleSkin('[#toggledSkinConfig]', [#toggledSkinConfigActive], '[#variant2Ini]', '[#toggledSkinConfigActiveIni]')]
[MeterToggleVariant2Label]
Meter=String
MeterStyle=StyleLabelString
Text=Toggle Variant 2
Code: Select all
debug = false
function Initialize()
toggleOn = SELF:GetOption('ToggleOn', '[#toggleOn]')
toggleOff = SELF:GetOption('ToggleOff', '[#toggleOff]')
radioOn = SELF:GetOption('RadioOn', toggleOn)
radioOff = SELF:GetOption('RadioOff', toggleOff)
toggleGroup = SELF:GetOption('ToggleGroup', 'SkinToggles')
end
function Update() end
-- Toggles the specified skin.
function ToggleSkin(configName, configState, skinIni, activeIni, toState)
configName = configName:gsub('\\', '\\\\'):gsub('\\\\', '\\')
toState = toState or skinIni and (skinIni == activeIni and -1 or 1) or configState * -1
if toState == 1 then
if skinIni == nil then
SKIN:Bang('!ActivateConfig', configName)
else
SKIN:Bang('!ActivateConfig', configName, skinIni)
end
else
SKIN:Bang('!DeactivateConfig', configName)
end
SKIN:Bang('!UpdateMeterGroup', toggleGroup)
SKIN:Bang('!Redraw')
return ''
end
function Test(input)
local newInput = string.gsub(input, '\\', '\\\\')
local oldInput = string.gsub(newInput, '\\\\', '\\')
print(input, newInput, oldInput)
return input .. ' ' .. newInput .. ' ' .. oldInput
end
-- Returns the corresponding button state depending on the state of the skin
function GetIcon(configState, skinIni, activeIni, radioOverride)
if activeIni == nil then
if configState == 1 then return toggleOn
else return toggleOff end
else
if activeIni == skinIni then return radioOverride and toggleOn or radioOn
else return radioOverride and toggleOff or radioOff end
end
end
-- function to make logging messages less cluttered
function LogHelper(message, type)
if type == nil then type = 'Debug' end
if debug == true then
SKIN:Bang("!Log", message, type)
elseif type ~= 'Debug' then
SKIN:Bang("!Log", message, type)
end
end
Edit: Oops, accidentally left the test function in there.
You do not have the required permissions to view the files attached to this post.