It is currently March 28th, 2024, 1:47 pm

Set multiple Update Rates per skin

Get help with creating, editing & fixing problems with skins
Post Reply
highpec
Posts: 14
Joined: June 17th, 2018, 8:01 am

Set multiple Update Rates per skin

Post by highpec »

Hello,

I'm trying to understand the update function. I have a monitoring skin that I'm making where certain elements need to be updated at different times than others. For example, the CPU load/temp/etc, need to be update every second "1000" = 1ms.

But, the web parser elements need to be updated only every 3 hours. In the documentation, the Update=1000 is always in the [RainMeter] section. But putting it here affects the entire script. How can I make different elements update at different times? The web parser certainly does not need to be updated every 1 second.

Thanks!
User avatar
ikarus1969
Posts: 571
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Set multiple Update Rates per skin

Post by ikarus1969 »

Each meter and measure can have its own UpdateDivider.

Let's say the Update in the Rainmeter-section is 1000 (millisecondes; the default), a meter has an UpdateDider=10. That means the meter will be updated every 10 seconds (10 * 1000). See the docu: https://docs.rainmeter.net/manual-beta/meters/general-options/#UpdateDivider

For the Webparser there's another property: UpdateRate.
The calculation is: Update x UpdateDivider x UpdateRate = "how often the measure connects to the site".
Let's say you want the skin access the site every 5 minutes. You have the default Update=1000 in the rainmeter-section and no UpdateDivider on the webparser measure (default = 1). Then you have to set the UpdateRate on the webparser-measure to 300:
[tip=Update in the Rainmeter section]1000[/tip] x [tip=default UpdateDivider on the measure]1[/tip] x [tip=UpdateRate on the measure]300[/tip] = 300000 millisecondes = 300 seconds = 5 minutes.
See the docu: https://docs.rainmeter.net/manual-beta/measures/webparser/#UpdateRate

Please read the docu - it's an invaluable resource of information!
highpec
Posts: 14
Joined: June 17th, 2018, 8:01 am

Re: Set multiple Update Rates per skin

Post by highpec »

ikarus1969 wrote:Each meter and measure can have its own UpdateDivider.

Let's say the Update in the Rainmeter-section is 1000 (millisecondes; the default), a meter has an UpdateDider=10. That means the meter will be updated every 10 seconds (10 * 1000). See the docu: https://docs.rainmeter.net/manual-beta/meters/general-options/#UpdateDivider

For the Webparser there's another property: UpdateRate.
The calculation is: Update x UpdateDivider x UpdateRate = "how often the measure connects to the site".
Let's say you want the skin access the site every 5 minutes. You have the default Update=1000 in the rainmeter-section and no UpdateDivider on the webparser measure (default = 1). Then you have to set the UpdateRate on the webparser-measure to 300:
[tip=Update in the Rainmeter section]1000[/tip] x [tip=default UpdateDivider on the measure]1[/tip] x [tip=UpdateRate on the measure]300[/tip] = 300000 millisecondes = 300 seconds = 5 minutes.
See the docu: https://docs.rainmeter.net/manual-beta/measures/webparser/#UpdateRate

Please read the docu - it's an invaluable resource of information!
Trust me, I've been reading it for 14 hours. I've managed to scrape some numbers I thought I'd never get (a lot of weird formatting, hard to find footprints, etc), use the calculator to convert one of the networks I promote from EUR to USD after scraping, and a ton of other stuff. This is in only 1 day of using the program. But it's like learning a new coding language, some of the stuff seems overwhelming, and some of the docu is written sort of in an "advanced" manner which makes some of it hard to decipher.

Does the UpdateRate only need to be on the first Measure of a "set," or in all the measures?

[MeasureConvertEURtoUSDEarnings]
Measure=WebParser
URL=https://transferwise.com/us/currency-converter/eur-to-usd-rate
RegExp=(?siU)<span class="text-success" data-rate="USD">(.*) USD</span>
UpdateRate=300

[MeasureConvertEURtoUSDEarningsCurrent]
Measure=WebParser
URL=[MeasureConvertEURtoUSDEarnings]
StringIndex=1

I'm guessing it needs to be in both -- as the bottom Measure would (in theory) still trigger the top one if it's not provided the same UpdateRate?
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Set multiple Update Rates per skin

Post by jsmorley »

highpec wrote:Trust me, I've been reading it for 14 hours. I've managed to scrape some numbers I thought I'd never get (a lot of weird formatting, hard to find footprints, etc), use the calculator to convert one of the networks I promote from EUR to USD after scraping, and a ton of other stuff. This is in only 1 day of using the program. But it's like learning a new coding language, some of the stuff seems overwhelming, and some of the docu is written sort of in an "advanced" manner which makes some of it hard to decipher.

Does the UpdateRate only need to be on the first Measure of a "set," or in all the measures?

[MeasureConvertEURtoUSDEarnings]
Measure=WebParser
URL=https://transferwise.com/us/currency-converter/eur-to-usd-rate
RegExp=(?siU)<span class="text-success" data-rate="USD">(.*) USD</span>
UpdateRate=300

[MeasureConvertEURtoUSDEarningsCurrent]
Measure=WebParser
URL=[MeasureConvertEURtoUSDEarnings]
StringIndex=1

I'm guessing it needs to be in both -- as the bottom Measure would (in theory) still trigger the top one if it's not provided the same UpdateRate?
No, UpdateRate should only be on the "parent" WebParser measure. That parent will push to all the "children" when it updates, and there shouldn't be any UpdateRate on any of them.
highpec
Posts: 14
Joined: June 17th, 2018, 8:01 am

Re: Set multiple Update Rates per skin

Post by highpec »

jsmorley wrote:No, UpdateRate should only be on the "parent" WebParser measure. That parent will push to all the "children" when it updates, and there shouldn't be any UpdateRate on any of them.
Thank you!
Post Reply