It is currently April 19th, 2024, 9:42 pm

Webparser question

Get help with creating, editing & fixing problems with skins
roguetrip
Posts: 26
Joined: March 11th, 2019, 5:42 pm

Webparser question

Post by roguetrip »

Been trying to see if I could cycle StringIndex in webparser weather rss with a timer count. If I toss in a IfCondition and !Setvariable I can see the variable changing yet the meter will not change.

Would I be correct to say that the webparser gathers its information on the "update cycle" for all StringIndexes and cycling out the string index when out of the "update cycle" will cause this?

Code: Select all


[Variable]
Highest=3

[MeasureCountFrom1]
Measure=Calc
Formula=(MeasureCountFrom1 % #Highest#) + 1
UpdateDivider=3

[MS_WRSS]
Measure=Plugin
Plugin=WebParser
UpdateRate=3600
Url=...
RegExp=...

[MS_Temp1]
Measure=Plugin
Plugin=WebParser
Url=[MS_WRSS]
StringIndex=#TEMP#
DynamicVariables=1
IfCondition=MeasureCountFrom1 = 1
IfCondition2=MeasureCountFrom1 = 2
IfCondition3=MeasureCountFrom1 = 3
IfTrueAction=[!SetVariable "TEMP" 1]
IfTrueAction2=[!SetVariable "TEMP" 7]
IfTrueAction3=[!SetVariable "TEMP" 11]
IfConditionMode=1

[MV_TEMPS]
Group=GR2
Meter=STRING		
MeterStyle=STYLE_R_M | STYLE_R_V
MeasureName=MS_Temp1
Text=%1
Mind that the skin works if just setting a Static StringIndex. I also tried adding !UpdateMeasure, !UpdateMeter, !Redraw to the conditions but same results.

Thanks.
User avatar
Yincognito
Rainmeter Sage
Posts: 7128
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Webparser question

Post by Yincognito »

roguetrip wrote: March 28th, 2019, 4:54 am Been trying to see if I could cycle StringIndex in webparser weather rss with a timer count. If I toss in a IfCondition and !Setvariable I can see the variable changing yet the meter will not change.

Mind that the skin works if just setting a Static StringIndex. I also tried adding !UpdateMeasure, !UpdateMeter, !Redraw to the conditions but same results.
I had approximately the same question a while back, check here to see the conclusion. Basically, it's all about point 3) in this post by jsmorley, which implies that you have to update the WebParser parent with a !CommandMeasure bang in order to have the dynamic changes like setting a different StringIndex reflect on its children. Of course, that means loading and parsing the page again, even if you know the information stays the same. Not setting ForceReload=1 in the WebParser parent does make this more reasonable, but even so, the whole thing has to be re-read again - it's just the way things work in this aspect.
roguetrip wrote: March 28th, 2019, 4:54 amWould I be correct to say that the webparser gathers its information on the "update cycle" for all StringIndexes and cycling out the string index when out of the "update cycle" will cause this?
Close. It's about the fact that WebParser children are a function of their parent, thus a dynamic change on the children requires an actual update of the parent.

NOTE: If you really want to dynamically cycle through the capture groups of a parsed webpage without updating the WebParser parent again, the best solution would be to just use String measures instead of WebParser children. That would pretty much do the same: pass the either the whole page or just the part of interest to the String measure, where you'd have to write the regex that provides the desired capture group and removes everything else. Or, if you want to manage this only through one or two String measures, use a regex Substitute to turn the source string into a comma (or any other character) separated string containing only the values of interest, and then get the desired value at runtime by extracting it from that comma separated list in the second String measure, based on the desired index.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser question

Post by balala »

Besides Yincognito's reply (he's right!), there are a few things to be added:
  • First and most important: although you've said that
    roguetrip wrote: March 28th, 2019, 4:54 am If I toss in a IfCondition and !Setvariable I can see the variable changing yet the meter will not change.
    I doubt the TEMP variable is changing, because there is a great mistake in the posted code: the [Variables] section name is written as [Variable]. Due to this the Highest variable isn't recognized and isn't used. This ruins the working of the whole code.
  • Don't add the IfCondition / IfTrueAction options to the [MS_Temp1] measure, but directly to [MeasureCountFrom1].
However even so you can't get the code to work, because of what Yincognito wrote above. I think there is no solution. Sorry.
roguetrip
Posts: 26
Joined: March 11th, 2019, 5:42 pm

Re: Webparser question

Post by roguetrip »

Ok, Thanks for the replies! Atleast I was close to understanding why it wouldn't work and it's pretty clear now.

Using !Commandmeasure sounds like way to much internet traffic so a no go there.


@balala

Yeah [Variable] was a typo here on the forum as I didn't copy paste it from my skin.

My temp variable was changing as I could see it in the Manage>Open Log>Skins>Weather>Variables moving from 1 to 7 to 11 every 3 seconds.
Don't add the IfCondition / IfTrueAction options to the [MS_Temp1] measure, but directly to [MeasureCountFrom1].
Oh yeah, tried cutting and pasting the code in [MeasureCountFrom1] as I was getting desparate :?

I recently changed my weather skin setup with the cCounter and have it cycle 3 different child measures for 3 seconds each, making 9 child meaures in the skin. Was just challenging myself to see if I could shorten up the need of all those child measure with making them dynamic. Either way it's a nice way to see how rainmeter does or doesn't work.

Maybe a feature in the future Webparser to have (.*) be replaced with a unique MeasureName ;)
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Webparser question

Post by balala »

roguetrip wrote: March 28th, 2019, 10:41 pm Yeah [Variable] was a typo here on the forum as I didn't copy paste it from my skin.
I hope you didn't rewrite the whole posted part of the code when posted it!
roguetrip wrote: March 28th, 2019, 10:41 pm I recently changed my weather skin setup with the cCounter and have it cycle 3 different child measures for 3 seconds each, making 9 child meaures in the skin. Was just challenging myself to see if I could shorten up the need of all those child measure with making them dynamic. Either way it's a nice way to see how rainmeter does or doesn't work.

Maybe a feature in the future Webparser to have (.*) be replaced with a unique MeasureName ;)
Probably the solution is to add three child WebParser measures then, for cycling them, show one and hide the others. Probably this is the only way to achieve what you want.