It is currently January 17th, 2019, 1:31 am

Update not working

Help with creating, editing & fixing problems with skins
Alpaga
Posts: 2
Joined: January 7th, 2019, 1:55 am

Update not working

Alpaga » January 7th, 2019, 2:03 am

Hello,

I try to dev a simple skin which display a simple image on my desktop but this image change each 6 seconds so I would like than my skin has to be update each 6 seconds but that not working.
My skin:

Code: Select all

[Rainmeter]
Update=6000

[Metadata]
Name=9gag
Author=Alpaga
Information=
Version=1.0.0
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]

[LogoOrange]
Meter=IMAGE
ImageName=Z:\Code\NodeJs\Widget9GAG\img.png
X=10
Y=0
W=400
H=400
If someone now why :) ?

Tks
User avatar
jsmorley
Developer
Posts: 18656
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Update not working

jsmorley » January 7th, 2019, 3:28 am

Rainmeter "caches" images when they have a specific name, so that they are not loaded from disk on each update of the meter. If you are externally changing the image, but keeping the file name the same, you can simply do:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeterImage]
Meter=Image
ImageName=#@#Images\Image.png
UpdateDivider=6
DynamicVariables=1
Note the DynamicVariables=1, that is the key to having it ignore the cached version each time the meter is updated. Now, also note that I don't use the Update option in [Rainmeter] to drive this, as although the image changes every 6 seconds, when it DOES change, you want that to be reflected immediately, and not another 6 seconds later. So have the skin update once a second, and have UpdateDivider=6 on the meter, so it only gets the image every 6 seconds.

My rule of thumb is "never increase the value of Update above 1000". Using Update to "slow down" how often anything is done can only lead to "lag" between the time some value is obtained or reached, and when the skin reacts to it. Leave Update at 1000, (or less in some cases) and then use UpdateDivider anywhere and everywhere you need to slow things down from once a second.

To be honest, I would probably have it check every 5 seconds, not 6. Since this is asynchronous, I would ask for the image a bit more often than it is changed, just to avoid accidentally getting the time "sync'd up" and ending up always one image "behind".


The only way to be absolutely certain of the timing, so you get a new, different image exactly every 6 seconds, would be to set UpdateDivider=-1 on the meter, so it is NEVER updated after the first time, and then have whatever node.js process is creating the image send an !UpdateMeter bang to the meter/skin and a !Redraw to the skin from the command line. Then you are in a synchronous "on demand" method. That assumes you have the ability to do that with whatever is creating the images...

The command line will look something like:

"C:\Program Files\Rainmeter\Rainmeter.exe" [!UpdateMeter MeterImage "ConfigName"][!Redraw "ConfigName"]

https://docs.rainmeter.net/manual/skins/#Config

That is the really correct way to do this if at all possible. It is far more desirable to have the process creating the image say "Hey, I just created it, come get it!".




Than to have the skin saying "Are we there yet? Are we there yet? Are we there yet".

Alpaga
Posts: 2
Joined: January 7th, 2019, 1:55 am

Re: Update not working

Alpaga » January 7th, 2019, 1:02 pm

Ok I see tks for your help !!