It is currently July 20th, 2019, 6:11 am

Number value of a substituted String measure

Help with creating, editing & fixing problems with skins
Yincognito
Posts: 653
Joined: February 27th, 2015, 2:38 pm

Number value of a substituted String measure

Yincognito » March 15th, 2019, 8:20 pm

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?
User avatar
balala
Rainmeter Sage
Posts: 8380
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Number value of a substituted String measure

balala » March 15th, 2019, 8:49 pm

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.
Yincognito
Posts: 653
Joined: February 27th, 2015, 2:38 pm

Re: Number value of a substituted String measure

Yincognito » March 15th, 2019, 10:05 pm

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.
User avatar
balala
Rainmeter Sage
Posts: 8380
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Number value of a substituted String measure

balala » March 15th, 2019, 10:18 pm