It is currently May 23rd, 2024, 4:59 am

Using + and - in Calc Measure

Get help with creating, editing & fixing problems with skins
User avatar
fabularasa
Posts: 76
Joined: February 26th, 2011, 12:51 am
Location: Poland

Using + and - in Calc Measure

Post by fabularasa »

Code: Select all

[Measure]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[URL]
StringIndex=1
Substitute="A":"-","B":"+"

[Calc]
Measure=Calc
formula=5[Measure]2
DynamicVariables=1
I'm tryin' to get a sing + or - form the web and then use it that in Calc Measure. Is it possible? I should get 5-2 or 5+2.
User avatar
jsmorley
Developer
Posts: 22634
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using + and - in Calc Measure

Post by jsmorley »

Sure, that works.

The only thing is that on the very first "update" of the skin when it is first loaded or refreshed, the value of the WebParser measure will be an empty string, and the Calc measure will evaluate to 52. You can avoid this by using the FinishAction in the WebParser measure to !EnableMeasure the Calc measure. Then it will return 0 on the first update instead, which in a purely cosmetic way makes more sense.

Test.txt:

Code: Select all

<item>A</item>

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureParent]
Measure=Plugin
Plugin=WebParser
Url=file://#CURRENTPATH#Test.txt
RegExp="(?siU)<item>(.*)</item>"
StringIndex=1
Substitute="A":"-","B":"+"
FinishAction=!EnableMeasure MeasureCalc

[MeasureCalc]
Measure=Calc
formula=5[MeasureParent]2
DynamicVariables=1
Disabled=1

[MeterOne]
Meter=String
MeasureName=MeasureCalc
FontSize=12
FontColor=255,255,255,255
Antialias=1
Or alternatively, you can just hide the meter displaying the value until WebParser has a chance to retrieve the value:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureParent]
Measure=Plugin
Plugin=WebParser
Url=file://#CURRENTPATH#Test.txt
RegExp="(?siU)<item>(.*)</item>"
StringIndex=1
Substitute="A":"-","B":"+"
FinishAction=!ShowMeter MeterOne

[MeasureCalc]
Measure=Calc
formula=5[MeasureParent]2
DynamicVariables=1

[MeterOne]
Meter=String
MeasureName=MeasureCalc
FontSize=12
FontColor=255,255,255,255
Antialias=1
Hidden=1
One last note is that while the search with the regular expression is not case sensitive (due to the "i" in (?siU)) the Substitute is. Keep that in mind.
User avatar
fabularasa
Posts: 76
Joined: February 26th, 2011, 12:51 am
Location: Poland

Re: Using + and - in Calc Measure

Post by fabularasa »

So I have something wrong with Calc formula

Sorry works fine just B=1,1234 should be B=1.1234 ;)
Last edited by fabularasa on March 16th, 2012, 12:00 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22634
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Using + and - in Calc Measure

Post by jsmorley »

fabularasa wrote:So I have something wrong with Calc formula

Code: Select all

[Measure1]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[URL]
StringIndex=2

[Calc]
Measure=Calc
formula=5[Measure]([Measure1]*2)
DynamicVariables=1
Beats me. What is [Measure]? Also, you don't have an RegExp on [Measure1] so it is not returning anything.
User avatar
fabularasa
Posts: 76
Joined: February 26th, 2011, 12:51 am
Location: Poland

Re: Using + and - in Calc Measure

Post by fabularasa »

I'm sorry I just add a part of the skin.