It is currently May 6th, 2024, 6:17 am

problem with substitute and calc

Get help with creating, editing & fixing problems with skins
User avatar
van Neel
Posts: 13
Joined: November 19th, 2012, 4:25 pm
Location: Germany

problem with substitute and calc

Post by van Neel »

I'm try to understand "substitue" and the measure "calc"

I edit following small skin

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureYahooWeather]
Measure=Plugin
Plugin=WebParser
UpdateRate=1800
Url="http://weather.yahooapis.com/forecastrss?w=702332&u=c"
RegExp=(?siU)<link.*>(.*)</link>.*city=\"(.*)\".*region=\"(.*)\".*country=\"(.*)\".*temperature=\"(.*)\".*distance=\"(.*)\".*pressure=\"(.*)\".*speed=\"(.*)\".*chill=\"(.*)\".*direction=\"(.*)\".*speed=\"(.*)\".*humidity=\"(.*)\".*visibility=\"(.*)\".*pressure=\"(.*)\".*rising=\"(.*)\".*sunrise=\"(.*)\".*sunset=\"(.*)\".*<title>.*:.*m .*(.*)</title>.*lat>(.*)<.*long>(.*)<.*yweather:condition.*text=\"(.*)\".*code=\"(.*)\".*temp=\"(.*)\".*yweather:forecast.*day=\"(.*)\".*low=\"(.*)\".*high=\"(.*)\".*text=\"(.*)\".*code=\"(.*)\".*yweather:forecast.*day=\"(.*)\".*low=\"(.*)\".*high=\"(.*)\".*text=\"(.*)\".*code=\"(.*)\".*
StringIndex=1

[MeasureWeatherTemp]
Measure=Plugin
Plugin=WebParser
Url=[MeasureYahooWeather]
StringIndex=23
RegExpSubstitute=1
Substitute="(\w+)":"1"

[MeasureTemp]
Measure=Calc
Formula=MeasureWeatherTemp+30

[MeterTemp]
Meter=String
MeasureName=MeasureTemp
Text=%1
FontFace=Segoe UI
FontSize=14
FontColor=128,128,128,128
X=0
Y=0
in my opinion the output must be "31"

but i got allways the value of the real temp added with 30

e.g.
-the real temp ist 10
-when i look in the protocoll, the value "MeasureWeatherTemp" is changed to 1
-but MeasureTemp is 40 ( = real temp + 30)
-the output in the meter shows for a moment "30" and then change to "40"

where ist the mistake? :???:
Image
Together it is easier
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: problem with substitute and calc

Post by Kaelri »

Substitute only changes the string value of a measure, while Calc measure formulas refer to the number value by default.

You can fix this by using section variables to refer to the string value of the measure:

Code: Select all

[MeasureTemp]
Measure=Calc
Formula=[MeasureWeatherTemp]+30
DynamicVariables=1
User avatar
van Neel
Posts: 13
Joined: November 19th, 2012, 4:25 pm
Location: Germany

Re: problem with substitute and calc

Post by van Neel »

:bow: thank you - it works :bow:
Image
Together it is easier