It is currently September 29th, 2024, 9:27 pm

How do I get the Update value?

General topics related to Rainmeter.
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

How do I get the Update value?

Post by AlC »

Hey guys,

I want to have the Update value in the Rainmeter section. And as far as I know there is no built-in variable and there is no way to get this value via Lua. So I think the only way to get this value is with the Webparser plugin, but I'm not sure if this is the best solution because I can remember that a Dev said that it's not good to parse things from skin.ini's or Rainmeter.ini.

My question is now: Is there another way and what would be the smartest solution?
Rainmeter - You are only limited by your imagination and creativity.
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How do I get the Update value?

Post by jsmorley »

No real reason not to parse the actual running skin .ini file if you need something from it:

Code: Select all

[Rainmeter]
Update=1000
 
[MeasureUpdate]
Measure=Plugin
Plugin=WebParser
URL=file://#CURRENTPATH##CURRENTFILE#
RegExp=(?siU)Update=(.*)\s
StringIndex=1
UpdateRate=86400
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How do I get the Update value?

Post by jsmorley »

To be honest though, I would save the effort and small amount of processing and just use:

[Rainmeter]
Update=1000

[Variables]
SkinUpdate=1000

Then use the #SkinUpdate# variable wherever you need it.

[SomeMeasure]
Measure=Time
UpdateDivider=(#SkinUpdate# * 2)
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How do I get the Update value?

Post by jsmorley »

You can even do:

Code: Select all

[Rainmeter]
Update=#SkinUpdate#

[Variables]
SkinUpdate=1000
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: How do I get the Update value?

Post by AlC »

jsmorley wrote:[Rainmeter]
Update=1000

[Variables]
SkinUpdate=1000

Then use the #SkinUpdate# variable wherever you need it.

[SomeMeasure]
Measure=Time
UpdateDivider=(#SkinUpdate# * 2)
Yes, this is the way I'm doining it at the moment. But I want to have it automatic.

What I want is that, if the user change the Update value the skin calculate automatic the suitable UpdateDivider Variable (in an animation skin). -> User friendly :)
jsmorley wrote:[MeasureUpdate]
Measure=Plugin
Plugin=WebParser
URL=file://#CURRENTPATH##CURRENTFILE#
RegExp=(?siU)Update=(.*)\s
StringIndex=1
UpdateRate=86400
Works perfectly, thank you very much!
jsmorley wrote:I would save the effort and small amount of processing
But with Updatedivider=-1 and UpdateRate=-1 on this simple measure there shouldn't be any problem.
Rainmeter - You are only limited by your imagination and creativity.
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: How do I get the Update value?

Post by AlC »

jsmorley wrote:You can even do:

[Rainmeter]
Update=#SkinUpdate#

[Variables]
SkinUpdate=1000
:headbang:
Yeah this is the best solution I think :)

Thank you jsmorley
Rainmeter - You are only limited by your imagination and creativity.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: How do I get the Update value?

Post by moshi »

may i ask why you are using a square of the main update value in meters/measures?

i can not really image what this could be used for.
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How do I get the Update value?

Post by jsmorley »

moshi wrote:may i ask why you are using a square of the main update value in meters/measures?

i can not really image what this could be used for.
He isn't. That was just a quick example by me of how you can use the variable. Not meant to be of any use in and of itself.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: How do I get the Update value?

Post by moshi »

i think he does.
AlC wrote:What I want is that, if the user change the Update value the skin calculate automatic the suitable UpdateDivider Variable (in an animation skin). -> User friendly :)
i can see a use in being able to change updates of only a limited number of elements (the animation for example) and have the other elements stay at the same update. that would require a formula like:
UpdateDivider=((#DefaultUpdate#)/(#SkinUpdate#))*(#DefaultDivider#)

maybe i just misinterpreted.
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: How do I get the Update value?

Post by AlC »

Just to clear it, for what I need it.

I update my skin at the moment and it's depending on the Update value.
So if the user change now the #SkinUpdate# variable, the skin will automatic calculate the #UpdateDivider# variable with something like "round(1000/#SkinUpdate#)".

Edit:
At the flip animation I set the variable #UpdateDivider# to 1 and after the animation I set it back to "round(1000/#SkinUpdate#)".

And with this code ...

Code: Select all

[Rainmeter]
Update=#SkinUpdate#

[Variables]
SkinUpdate=1000
... the user now have to only change the #SkinUpdate# variable in the Variables.inc and doesn't have to change something in skin (and the skin calculate the suitable #UpdateDivider#).
Last edited by AlC on May 4th, 2013, 12:43 pm, edited 1 time in total.
Rainmeter - You are only limited by your imagination and creativity.