I don't think there is a good way to do this that comes to mind in native Rainmeter. Regular expression is not really suited to doing logical AND tests in this way, and maybe I'm missing something, but I don't see a Substitute that really helps. Knowing that all four variables are the same, or that one or more of them are different, is not hard, but knowing that all four of them are different is tricky.
I'd do it with Lua...
Skin:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
Var1=4
Var2=3
Var3=2
Var4=1
[Lua]
Measure=Script
ScriptFile=Test.lua
Disabled=1
[Controller]
Measure=Calc
IfCondition=([&Lua:CheckVars('4','3','2','1')]) = -1
IfTrueAction=[!Log "None match"]
IfFalseAction=[!Log "One or more match"]
DynamicVariables=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
Test.lua:
Code: Select all
function CheckVars(Arg1, Arg2, Arg3, Arg4)
Var1 = SKIN:GetVariable('Var1')
Var2 = SKIN:GetVariable('Var2')
Var3 = SKIN:GetVariable('Var3')
Var4 = SKIN:GetVariable('Var4')
if (Var1 ~= Arg1) and (Var2 ~= Arg2) and (Var3 ~= Arg3) and (Var4 ~= Arg4) then
return -1
else
return 1
end
end
Note that since all variables in Rainmeter are strings, I'm passing the arguments to the function as strings, so I don't have to tonumber() anything to do my comparisons. Also note that in Lua "not equal to" is done with
~=, not
<> or
!= as you might expect from using other languages.