Page 1 of 1

Number value of a substituted String measure

Posted: March 15th, 2019, 8:20 pm
by Yincognito
Sample skin:

Code: Select all

[Rainmeter]
AccurateText=1
Update=1000
DynamicWindowSize=1

[MS_SomeString]
Measure=String
String="1"
UpdateDivider=-1
RegExpSubstitute=1
Substitute="^1$":"-1"
DynamicVariables=1

[MS_SomeCalc]
Measure=Calc
Formula=[MS_SomeString:]
UpdateDivider=-1
DynamicVariables=1

[MT_Test]
Meter=STRING
SolidColor=64,64,64,255
FontColor=255,255,255,255
Text="String: [MS_SomeString]#CRLF#Number: [MS_SomeString:]#CRLF#Calc: [MS_SomeCalc]"
DynamicVariables=1
Without the substitute, the number value of [MS_SomeString] is 1. With the substitute, it is still 1, despite replacing it with -1. Why, and how I can correct this, apart from creating a Calc measure taking the string value of [MS_SomeString] (since its number value is still 1) as its Formula just for that?

Re: Number value of a substituted String measure

Posted: March 15th, 2019, 8:49 pm
by balala
Yincognito wrote: March 15th, 2019, 8:20 pm Without the substitute, the number value of [MS_SomeString] is 1. With the substitute, it is still 1, despite replacing it with -1. Why, and how I can correct this, apart from creating a Calc measure taking the string value of [MS_SomeString] (since its number value is still 1) as its Formula just for that?
The Substitute option is applied only to the string value of a measure. That's why the string value of [MS_SomeString] is -1, while the numeric value remains unsubstituted.

Re: Number value of a substituted String measure

Posted: March 15th, 2019, 10:05 pm
by Yincognito
balala wrote: March 15th, 2019, 8:49 pm The Substitute option is applied only to the string value of a measure. That's why the string value of [MS_SomeString] is -1, while the numeric value remains unsubstituted.
Yep, you're right. Due to the fact that in this scenario I needed things to behave differently, I forgot about the fact that I used with great success the "separation" between the number and the string value in other skins (like the Weather one), basically being able to work with two different values for each measure.

So it's all clear now. Bottom line, I asked the question forgettting that at some point I took advantage of this behavior in Rainmeter.

Re: Number value of a substituted String measure

Posted: March 15th, 2019, 10:18 pm
by balala