Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1642

Help: Rainmeter Skins • Re: Dynamic Variable to Change File Display

$
0
0
Hello/Good evening.

I know this post is old, but it's really old!

But I have a question that could be similar...

I have a simple skin to display text. This text in question comes from a variable. The value of this variable is regularly modified directly in the ini file of the skin by a python script.

However, no matter what I do, this meter NEVER updates.

So I thought that the problem was that we could not modify the ini file during its execution. I tried with an inc text file and to import it but same problem.

Is there a method to import a value that is regularly modified from a text file into a rainmeter skin?

Thank you very much!
(google translate fr>us)
Writing the new value of a variable directly to an .ini or .inc file won't be enough to see things change in your skin, no matter where you do it from. The contents of such a file on disk only matters at the time of loading or refreshing the skin, because afterwards the values of every variable or measure (meters don't have a value as they're just visual elements) is kept in memory for the duration of that skin's "load session".

Another point here is that even if you modify the value of some variable the usual way (e.g. via a !SetVariable bang in the skin's code), you'd still need to !UpdateMeasure and / or !UpdateMeter the measures or meters where that variable is used and !Redraw the skin, in order to immediately reflect such changes in the skin (or, in the case of writing a variable's value to an @include -d .inc or .ini on the disk, the skin would need to be !Refresh -ed to do the same). I'm pretty sure your python script doesn't do that, and even if it were, it would still refer to the variable from the memory and not the one that's being defined as the initial value in the files from the disk (unless refreshing the skin, which re-reads the main skin's .ini and its @include dependencies from the drive).

As for your question, yes, there are methods to do that. Parsing the text file as a local URL at either regular intervals or manually with the help of a WebParser measure is the typical way to do it (this is done from the skin's code, your python script only has to write to that text file), see:
https://docs.rainmeter.net/manual/measures/webparser/#Local
Another way might be using a QuotePlugin measure:
https://docs.rainmeter.net/manual/plugins/quote/
Yet another way would be using Lua, though this method is a bit sensitive to the file encoding:
https://docs.rainmeter.net/manual/lua-scripting/
https://docs.rainmeter.net/snippets/read-write-file/

A somewhat related question recently, dealing with the WebParser and the Quote plugin methods:
https://forum.rainmeter.net/viewtopic.php?t=44507

P.S. Don't forget to update your related sections (measures or meters) and redraw the skin to reflect changes immediately, via the bangs mentioned above:
https://docs.rainmeter.net/manual/bangs/
Or, you can rely on the regular update of your meter to do it with a potential delay, depending on how frequently it is updated.

Statistics: Posted by Yincognito — Today, 5:54 am



Viewing all articles
Browse latest Browse all 1642

Trending Articles