I have a skin named Skin1.ini and another named Skin2.ini
I have a Meter in Skin1.ini that, when clicked, writes a Variable in the Skin2.ini.
The problem is that Skin2.ini doesn't get the new variable until a [!Refresh] is executed.
I want it to get the variable when an [!Update] is executed as well, so that I don't have to Refresh the whole skin every time the variables changes.
As always,
Thanks in advance.
It is currently March 29th, 2024, 3:41 pm
Problem with writing variables from a skin to another.
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
-
- Developer
- Posts: 22628
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Problem with writing variables from a skin to another.
Nope. Physical changes to a skin .ini file will only be read when the skin is loaded or refreshed.kyriakos876 wrote:I have a skin named Skin1.ini and another named Skin2.ini
I have a Meter in Skin1.ini that, when clicked, writes a Variable in the Skin2.ini.
The problem is that Skin2.ini doesn't get the new variable until a [!Refresh] is executed.
I want it to get the variable when an [!Update] is executed as well, so that I don't have to Refresh the whole skin every time the variables changes.
As always,
Thanks in advance.
What you will have to do is use both the !WriteKeyValue bang to permanently change the .ini file, and at the same time use [!SetVariable VarName "VarValue" "ConfigName"] to dynamically set the variable value in the second skin.
https://docs.rainmeter.net/manual/skins/#Config
https://docs.rainmeter.net/manual/bangs/
Note: Many bangs have a Config parameter. Unless otherwise specified, valid values are the config name of a currently loaded skin to be acted upon or * (asterisk) to act on all currently loaded skins. When optional and not supplied, the parameter defaults to the current config.
-
- Rainmeter Sage
- Posts: 16110
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Problem with writing variables from a skin to another.
Sorry jsmorley, I was late a bit...
Note that almost every bang has a Config (in most cases not used) parameter, which indicates to which config is applied that bang. Also don't forget to add the DynamicVariables=1 option to each meter or measure of the Skin2.ini, which should use the new value of the variable.
If you write the variable to Skin2.ini, with a !WriteKeyValue bang, it can't use it, until a refresh isn't done. Instead of writing it, or beside this operation, you also should use a !SetVariable, to can dynamically use the new value of that variable. I mean something like: LeftMouseUpAction=[!WriteKeyValue Variables TheNameOfVar "TheNewVal" "TheConfigOfSkin2"][!SetVariable TheNameOfVar "TheNewVal" "TheConfigOfSkin2"]. With this option, when the appropriate meter of Skin1 (which has set the above LeftMouseUpAction) is clicked, two things will happen: the value of the TheNameOfVar variable will be written into the [Variables] section of Skin2.ini and in paralel the same value will be dynamically set to that variable. This way, Skin2.ini will be able to use it. If you just write the value, the refresh is absolutely required, otherwise the skin can't use the newly written value of the variable.kyriakos876 wrote:I have a skin named Skin1.ini and another named Skin2.ini
I have a Meter in Skin1.ini that, when clicked, writes a Variable in the Skin2.ini.
The problem is that Skin2.ini doesn't get the new variable until a [!Refresh] is executed.
I want it to get the variable when an [!Update] is executed as well, so that I don't have to Refresh the whole skin every time the variables changes.
Note that almost every bang has a Config (in most cases not used) parameter, which indicates to which config is applied that bang. Also don't forget to add the DynamicVariables=1 option to each meter or measure of the Skin2.ini, which should use the new value of the variable.
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: Problem with writing variables from a skin to another.
Thank you both. You suggestion worked exactly as I wanted!