Kotofanchik wrote: ↑June 27th, 2024, 1:21 pm
Is there an example of how this is done? I couldn’t do it myself. Apparently it’s necessary to create a variable or several in a file from the current measure or meter? How to do it? It didn't work out for me. I'm doing something wrong. Then, how do I assign the value of a variable to measure?
The skin had to be redone because it turns out that the information update time is not always in the range 00:00, 03:00, 06:00 and so on (it was convenient since the clock data also goes) But it turns out there are also 00:30, 01: 30 in some cases. And there were more measures with errors at the initial moment.
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: Select all
[Variables]
DummyDate=June 15, 2024
[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,255,0,255
[Date]
Measure=WebParser
URL=https://time.is/en/UTC
RegExp=(?siU)<div id="dd" .*>.*, (.*)</div>
StringIndex=1
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
DynamicVariables=1
[DOW]
Measure=Time
TimeStampFormat=%B %d, %Y
TimeStamp=[Date]
Format=%A
DynamicVariables=1
---Meters---
[DOWText]
Meter=String
MeasureName=DOW
Text=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).