jn_meter wrote: ↑January 18th, 2021, 1:28 pm
Thank you very much for that detailed explanation. Here we uncover - must work around - a limitation of Rainmeter, it seems.
I don't really see it as a limitation. It's just a fact that really every option value in Rainmeter is a "string". Things that are numbers are converted from a string to an actual number when and where you "use them" as a number, in any option that supports a number. In the case of something like:
Code: Select all
[Variables]
Size=11
[MeterString]
Meter=String
FontSize=#Size#
The String meter won't have any issue, as it is looking for a number as the value, and "11" is a perfectly valid number. It happily converts the string "11" to a number.
In the case of:
Code: Select all
[Variables]
Size=10 + 1
[MeterString]
Meter=String
FontSize=(#Size#)
The string "10 + 1" is NOT a "number". It is a "formula". So we have to enclose it in (parentheses) in order to alert Rainmeter that we want to use the string as a (formula). It then knows to send the string off to a "math" routine that will evaluate and resolve the formula. That math routine will then return a number, 11 in this case, that the option will use.
There are a few places where a formula is "assumed", and the parentheses are optional, like the Formula option in a Calc measure, and the test in an IfCondition option, but pretty much everywhere else, you will always need to enclose any formula in parentheses.
https://docs.rainmeter.net/manual/formulas/
There are also a few places, like the Text option on a String meter or the String option on a String measure as examples, that simply do not use numbers or formulas, and are always treated as a literal string. These are options that are simply never "numeric". This is necessary so you can in fact display a formula as a string without it somehow automatically resolving it to a final number. Like
Text=The formula is (10 + 1) for this .
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
Upd=(10 + 1)
[MeasureResolveFormula]
Measure=Calc
Formula=#Upd#
[MeterOne]
Meter=String
MeasureName=MeasureResolveFormula
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=The formula is #Upd# for this, which resolves to %1
1.jpg
You do not have the required permissions to view the files attached to this post.