It is currently March 29th, 2024, 12:23 am

Calc Measure returns '0'

Get help with creating, editing & fixing problems with skins
Psymatics
Posts: 2
Joined: January 16th, 2017, 11:47 pm

Calc Measure returns '0'

Post by Psymatics »

I've looked all over the internet for answers, but none of the solutions I've found have worked so far.

My skin will eventually compare the current time with the sunrise and sunset and do way more cool stuff, but my attempt to convert hours into minutes in order to convert time to a real number is just not working.

Code: Select all

[Rainmeter]
Update=-1
OnRefreshAction=[!DisableMeasureGroup Weather][!Redraw]

[XMLdata]
Measure=Plugin
Plugin=WebParser
URL=http://wxdata.weather.com/wxdata/weather/local/#ZipCode#?cc=*&unit=f
RegExp=(?siU)^(.*)$
ForceReload=1
FinishAction=[!EnableMeasureGroup Weather][!Redraw]
DynamicVariables=1

[GetSunInfo]
Measure=Plugin
Group=Weather
Plugin=WebParser
URL=[XMLdata]
RegExp=(?siU)<sunr>(.*):(.*) (.*)</sunr>.*<suns>(.*):(.*) (.*)</suns>
DynamicVariables=1

[SunriseHour]
Measure=Plugin
Group=Weather
Plugin=WebParser
URL=[GetSunInfo]
StringIndex=1
DynamicVariables=1

[SunriseMinute]
Measure=Plugin
Group=Weather
Plugin=WebParser
URL=[GetSunInfo]
StringIndex=2
DynamicVariables=1

[SunriseAM_PM]
Measure=Plugin
Group=Weather
Plugin=WebParser
URL=[GetSunInfo]
StringIndex=3
Substitute="AM":"0","PM":"1"
DynamicVariables=1

[Rise_CompiledHour]
Measure=Calc
Group=Weather
Formula=SunriseAM_PM * 12 + SunriseHour
DynamicVariables=1

[Rise_Time]
Measure=Calc
Group=Weather
Formula=Rise_CompiledHour * 60 + SunriseMinute
DynamicVariables=1
The Rainmeter Log shows that everything but the Calc measures are returning the correct values. If I were to guess at the problem it may be that the Calcs start running before the parsing is finished, but I think I fixed that with my Measure Grouping.

I've also looked at other weather skins that do work and I don't see anything different with what they're doing. I think.

Also, if you see any way to make this huge block of code smaller, please let me know, I'd be much obliged.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Calc Measure returns '0'

Post by mak_kawa »

Insert [!Update] before [!Redraw] in the line FinishAction=[!EnableMeasureGroup Weather][!Redraw].
JorgeSM
Posts: 5
Joined: January 9th, 2017, 5:03 pm

Re: Calc Measure returns '0'

Post by JorgeSM »

I tried your code and it just works!

Are you sure you are getting info from weather.com?
Are you providing a correct #ZipCode#?
Psymatics
Posts: 2
Joined: January 16th, 2017, 11:47 pm

Re: Calc Measure returns '0'

Post by Psymatics »

Are you sure you are getting info from weather.com?
As I said, everything is returning the right values, except for the calc measures.
Insert [!Update] before [!Redraw] in the line FinishAction=[!EnableMeasureGroup Weather][!Redraw].
Thank you, that magically fixed everything.