It is currently December 6th, 2022, 1:51 pm

Skin update every hour

Get help with creating, editing & fixing problems with skins
User avatar
xenium
Posts: 719
Joined: January 4th, 2018, 9:52 pm

Skin update every hour

Post by xenium »

I would like the skin to be updated every hour (01:00, 02:00...... 23:00, 00:00).
How can I do this?

Thanks
User avatar
balala
Rainmeter Sage
Posts: 14766
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin update every hour

Post by balala »

xenium wrote:I would like the skin to be updated every hour (01:00, 02:00...... 23:00, 00:00).
How can I do this?

Thanks
  1. Set the Update in the [Rainmeter] section to Update=3600000. This value means 3600000 milliseconds = 3600 seconds = 1 hour. The disadvantage is that the update doesn't occur when the minute is 0 (as you asked), but once per each hour, depending when the skin was loaded / refreshed (Yes, I know this is an undesirable method, due to the extremely great Update value and probably jsmorley will disagree this).
  2. Set the Update to -1 (Update=-1), then create another skin (into another config - this config can be a subfolder of the current config - see the code below), which updates the current skin in the appropriate moments:

    Code: Select all

    [Rainmeter]
    Update=1000
    
    [MeasureHour]
    Measure=Time
    Format=%H
    OnChangeAction=[!Update "FIRST-CONFIG"]
    
    [MeterHour]
    Meter=String
    MeasureName=MeasureHour
    X=0
    Y=0
    Padding=15,5,15,5
    FontColor=220,220,220
    SolidColor=0,0,0,120
    FontSize=8
    FontFace=#FontName#
    StringStyle=BOLD
    StringAlign=LEFT
    AntiAlias=1
    Text=%1
    The [MeterHour] String meter is added because the skin MUST have at least one meter. It shows the hour, but has not too much practical purpose, so finally if the skin is working well, you can add a Hidden=1 option to the meter, to hide it. This way the skin will have no visible elements, its only purpose being to update the skin which has to be updated once per hour.
    You have to add to the !Update bang of the OnChangeAction option of the [MeasureHour] measure, the name of the config where you have the skin which will be updated.
User avatar
jsmorley
Developer
Posts: 22551
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skin update every hour

Post by jsmorley »

Yeah, first I almost never agree with an Update value larger than 1000, and second, I never agree with using skin updates to measure time in any accurate way. Not only does Update=3600000 have nothing to do with the time on the clock, but there is no certainly that Update=3600000 is equal to an hour. It's at best approximately an hour.

Code: Select all

[Rainmeter]
Update=900

[MeasureTime]
Measure=Time
Format=%#M.%#S
IfCondition=(Trunc(MeasureTime) = 0) && (Frac(MeasureTime) = 0)
IfTrueAction=[!Log "It's the top of the hour!"]

[MeterDummy]
Meter=String
User avatar
balala
Rainmeter Sage
Posts: 14766
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin update every hour

Post by balala »

jsmorley wrote:Yeah, first I almost never agree with an Update value larger than 1000,
But finally there is an explanation why? I'm using a skin with Update=60000 (so updated once per minute) (which calculates the Sun / Moon rise / set), and I'd say it is is completely enough to be updated so rarely. Finally doesn't worth to update the whole skin once per second (at least in my opinion), because a change in the results of the calculations occurs once per day, midnight (when the date is changing). Never encountered issues with it.
jsmorley wrote:and second, I never agree with using skin updates to measure time in any accurate way.
Completely agree, that's why I also said the first method is an undesirable method.
User avatar
jsmorley
Developer
Posts: 22551
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skin update every hour

Post by jsmorley »

I prefer to have the skin update once a second, (or less if needed) and control timing with UpdateDivider on measures or even meters. I just feel it does no harm to have the skin firing and checking tests like IfCondition / IfAbove / IfMatch regularly, and find it way too easy to get into trouble if you are not careful to have [!UpdateMeter..] and [!Redraw] used so that when some trigger is fired, the visible results don't wait a long time for the next skin update, and even needing [!UpdateMeasure..] to be used to ensure some formula that depends on a measure value later in the skin doesn't wait a long time for the result. There are no doubt cases where it is six of one, half a dozen of the other, and fair enough, but for me, it's easier to follow and easier to not have to think about "gotchas" if I just don't use Update in [Rainmeter] to control timing.

Remember that when you say Update=3600000 you are saying "nothing in this skin can ever happen any more often than about once an hour". That sets the maximum speed that anything in the skin can be at. For almost all skins, you are better off to say "update the skin once a second", and use UpdateDivider to say "update this once a second, update that once a minute, update the other once an hour" as needed and desired. Once you are locked into a high Update value, there can be a lot of re-design involved if your change your mind about some particular functionality.

There are not many cases when there is any particular advantage to having a huge Update value. Maybe in a skin that is very image intensive, the images are being resized, and while they change, it's not very often. In that case, it can be argued that fewer skin "redraws" is a good thing. That's why I said "almost never" and not "never".
User avatar
balala
Rainmeter Sage
Posts: 14766
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin update every hour

Post by balala »

Ok, there is any difference between let's say this:

Code: Select all

[Rainmeter]
Update=60000
and this:

Code: Select all

[Rainmeter]
Update=1000
DefaultUpdatedivider=60
(assuming that in the second case no UpdateDivider is set up in the skin)?
User avatar
jsmorley
Developer
Posts: 22551
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Skin update every hour

Post by jsmorley »

balala wrote:Ok, there is any difference between let's say this:

Code: Select all

[Rainmeter]
Update=60000
and this:

Code: Select all

[Rainmeter]
Update=1000
DefaultUpdatedivider=60
(assuming that in the second case no UpdateDivider is set up in the skin)?

I would use the second myself, since even with that default, it still gives me granular control over how often measures and meters are updated. Other than that, not much difference in any practical sense. Just don't forget that DefaultUpdateDivider applies to both measures and meters, so you still need to be sure you are taking steps to update meters and redraw in order to have the visible results be timely.

To each his own, but for me, I prefer to to have the skin update once a second or less, and then go individually set UpdateDivider where it makes sense. I'm concerned about things that do a lot of "work", and thus can can a CPU impact if they are firing more often than they need to. If you have enough of those, then DefaultUpdateDivider can make sense, but generally, most of the time, the overall skin updates, and updating measures that don't do a lot of work, and updating meters, and redrawing the skin, I just leave nimble.
User avatar
balala
Rainmeter Sage
Posts: 14766
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin update every hour

Post by balala »

jsmorley wrote:I would use the second myself, since even with that default, it still gives me granular control over how often measures and meters are updated. Other than that, not much difference in any practical sense. Just don't forget that DefaultUpdateDivider applies to both measures and meters, so you still need to be sure you are taking steps to update meters and redraw in order to have the visible results be timely.
Ok, thanks. Obvious things, I think.
User avatar
xenium
Posts: 719
Joined: January 4th, 2018, 9:52 pm

Re: Skin update every hour

Post by xenium »

balala wrote:
  1. Set the Update in the [Rainmeter] section to Update=3600000. This value means 3600000 milliseconds = 3600 seconds = 1 hour. The disadvantage is that the update doesn't occur when the minute is 0 (as you asked), but once per each hour, depending when the skin was loaded / refreshed (Yes, I know this is an undesirable method, due to the extremely great Update value and probably jsmorley will disagree this).
  2. Set the Update to -1 (Update=-1), then create another skin (into another config - this config can be a subfolder of the current config - see the code below), which updates the current skin in the appropriate moments:

    Code: Select all

    [Rainmeter]
    Update=1000
    
    [MeasureHour]
    Measure=Time
    Format=%H
    OnChangeAction=[!Update "FIRST-CONFIG"]
    
    [MeterHour]
    Meter=String
    MeasureName=MeasureHour
    X=0
    Y=0
    Padding=15,5,15,5
    FontColor=220,220,220
    SolidColor=0,0,0,120
    FontSize=8
    FontFace=#FontName#
    StringStyle=BOLD
    StringAlign=LEFT
    AntiAlias=1
    Text=%1
    The [MeterHour] String meter is added because the skin MUST have at least one meter. It shows the hour, but has not too much practical purpose, so finally if the skin is working well, you can add a Hidden=1 option to the meter, to hide it. This way the skin will have no visible elements, its only purpose being to update the skin which has to be updated once per hour.
    You have to add to the !Update bang of the OnChangeAction option of the [MeasureHour] measure, the name of the config where you have the skin which will be updated.
I forgot to mention that I would like this update every hour to be an additional update besides the normal update every 10 minutes
User avatar
balala
Rainmeter Sage
Posts: 14766
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin update every hour

Post by balala »

xenium wrote:I forgot to mention that I would like this update every hour to be an additional update besides the normal update every 10 minutes
If you read my discussion with jsmorley above, you saw that you could:
  • Set in the [Rainmeter] section of your skin the Update to Update=600000, but this is an undesirable solution, due to what jsmorley described.
  • Set the Update of your skin to the default Update=1000 and add to the same [Rainmeter] section a DefaultUpdateDivider=600 option. This way the sections (measures and meters) of your skin are updated once per 10 minutes.
    Beside this you have to create the second skin as I described at the second point of my first reply above, which will update the skin at entire hours.
Just one more question: does your skin uses WebParser measure(s) and that/those measure(s) should have to be updated from 10 to 10 minutes, plus at entire hours? Because if this is the situation, a completely different approach should have to be used.