It is currently March 28th, 2024, 11:28 am

Number value of a substituted String measure

Get help with creating, editing & fixing problems with skins
Post Reply
User avatar
Yincognito
Rainmeter Sage
Posts: 7017
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Number value of a substituted String measure

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

Re: Number value of a substituted String measure

Post 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.
User avatar
Yincognito
Rainmeter Sage
Posts: 7017
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Number value of a substituted String measure

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

Re: Number value of a substituted String measure

Post by balala »

Post Reply