I would consider a different format for the call to SKIN:Bang() as well.
You don't need, and truth be told, don't want, to send the entire bang as a single string. Formatting that single string can get VERY complicated and VERY hard to read / debug.
Here is a Lua script that shows the two ways you can format a SKIN:Bang() call.
Skin:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
[Lua]
Measure=Script
ScriptFile=Test.lua
Disabled=1
[MeterOne]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=LogIt1
LeftMouseUpAction=[&Lua:LogIt1()]
DynamicVariables=1
[MeterTwo]
Meter=String
Y=2R
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=LogIt2
LeftMouseUpAction=[&Lua:LogIt2()]
DynamicVariables=1
Lua:
Code: Select all
function LogIt1()
SKIN:Bang('[!Log Four][!Log Three]')
end
function LogIt2()
SKIN:Bang('!Log', 'Two')
SKIN:Bang('!Log', 'One')
end
While you can't "stack up" bangs in a single call with the preferred second approach, you can't / don't need to use the
[] brackets, and the formatting is a lot more straightforward in my view. Instead of a single long string that you must carefully construct to deal with a ton of single quotes and .. appends to jump in and out of literal and variable values, you just format it as
SKIN:Bang('!BangName', 'Parm1', 'Parm2').
Probably the biggest advantage is that this entirely eliminates the need to worry about passing "double-quotes" to Rainmeter to help Rainmeter parse the bang out into the various parameters. Basically double-quotes are just not needed. The Lua SKIN:Bang() function will take care of separating the parameters properly for Rainmeter. Let it do the work.
Code: Select all
function LogIt1()
SKIN:Bang('[!Log "Item Four"][!Log "Item Three"]')
end
function LogIt2()
SKIN:Bang('!Log', 'Item Two')
SKIN:Bang('!Log', 'Item One')
end
Code: Select all
function LogIt1()
i4 = 'Four'
i3 = 'Three'
SKIN:Bang('[!Log "Item '..i4..'"][!Log "Item '..i3..'"]')
end
function LogIt2()
i2 = 'Two'
i1 = 'One'
SKIN:Bang('!Log', 'Item '..i2)
SKIN:Bang('!Log', 'Item '..i1)
end
While this is a very simple example indeed, it is already way more complicated than I like to use the first method. Ick... You'd better hope you have a text editor that can warn you of mismatched quotes in the context of Lua.
While the single-string approach will still work, it is "deprecated" in favor of the new method...
https://docs.rainmeter.net/manual-beta/lua-scripting/#Bang