Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1143

Help: Rainmeter Skins • Re: Can't pass measure value to web parser

$
0
0
Simple example, based on the DOW code earlier - it's up to you to get the idea and implement the approach in your actual skin:

Code:

[Variables]DummyDate=June 15, 2024[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1BackgroundMode=2SolidColor=0,255,0,255[Date]Measure=WebParserURL=https://time.is/en/UTCRegExp=(?siU)<div id="dd" .*>.*, (.*)</div>StringIndex=1UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36DynamicVariables=1[DOW]Measure=TimeTimeStampFormat=%B %d, %YTimeStamp=[Date]Format=%ADynamicVariables=1---Meters---[DOWText]Meter=StringMeasureName=DOWText=DOW: %1
Now, as you can see in the Rainmeter log, the above code will throw 2 TimeStampFormat errors on load / refresh, since the TimeStamp option of the [DOW] measure doesn't yet have a valid value until the [Date] measure retrieves it from the site and the [DOW] measure updates to reflect the change. However, if you do TimeStamp=#DummyDate# in the [DOW] measure and add FinishAction=[!SetOption DOW TimeStamp "[Date]"][!UpdateMeasure DOW][!UpdateMeter DOWText][!Redraw] to the [Date] measure, there will be no more such errors on load / refresh, because the value of the timestamp be a valid dummy date right from the start, being replaced with the actual date once the webparser retrieves it.

So basically, you need to correct the TimeStamp option not having a valid value before it's set from the site. How to do it, is your choice, the above is just one way of approaching this. You could even write it directly as TimeStamp=June 15, 2024 (or whatever other valid value, according to whatever timestamp format you use) and not use a variable at all, as long as you set it to the actual value afterwards, from the FinishAction of the webparser parent (or whatever other measure is retrieving the actual date).
I did it and it didn’t work, or it doesn’t work, or the same errors. I tried two options in the skin. The first one gives the same errors

Code:

[DOW]Measure=TimeTimeStampFormat=%Y-%m-%dT%H:%M:%STimeStamp=[mfullDate]FormatLocale=#LangLoc#Format=%aDynamicVariables=1TimeStamp=#DummyDate#FinishAction=[!SetOption DOW TimeStamp "[mfullDate]"][!UpdateMeasure DOW][!Redraw]
The second one works exclusively with DummyDate and does not go to the desired date.

Code:

[DOW]Measure=TimeTimeStampFormat=%Y-%m-%dT%H:%M:%S;TimeStamp=[mfullDate]FormatLocale=#LangLoc#Format=%aDynamicVariables=1TimeStamp=#DummyDate#FinishAction=[!SetOption DOW TimeStamp "[mfullDate]"][!UpdateMeasure DOW][!Redraw]
Test scin

Code:

[Variables]DummyDate=June 10, 2024[Rainmeter]Update=1000AccurateText=1DynamicWindowSize=1BackgroundMode=2SolidColor=0,255,0,255[Date]Measure=WebParserURL=https://time.is/en/UTCRegExp=(?siU)<div id="dd" .*>.*, (.*)</div>StringIndex=1UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36DynamicVariables=1[DOW]Measure=TimeTimeStampFormat=%B %d, %YTimeStamp=[Date]Format=%ADynamicVariables=1TimeStamp=#DummyDate#FinishAction=[!SetOption DOW TimeStamp "[Date]"][!UpdateMeasure DOW][!UpdateMeter DOWText][!Redraw] ---Meters---[DOWText]Meter=StringMeasureName=DOWText=DOW: %1
The test skin seems to work correctly, first the fake date, then the real one. But my skin apparently manages to poll a non-existent date and display an error in the log if option number one is used. With the second option, the skin does not switch to working with TimeStamp "[mfullDate]"

Statistics: Posted by Kotofanchik — Yesterday, 8:15 pm



Viewing all articles
Browse latest Browse all 1143

Trending Articles