Hi
If I have a skin that has fetched a value can another skin access that value via a shared variable and/or if that value changes, the other skin will update.
Many thanks
anna
It is currently October 15th, 2024, 1:06 am
Sharing variable values between skins
-
- Posts: 20
- Joined: April 7th, 2014, 1:55 pm
-
- Developer
- Posts: 22856
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Sharing variable values between skins
Skins can't "pull" a variable value from another skin, but a skin can "push" the value of a variable to another skin.lawty wrote:Hi
If I have a skin that has fetched a value can another skin access that value via a shared variable and/or if that value changes, the other skin will update.
Many thanks
anna
You can use the !SetVariable bang in the skin that is retrieving the value, using the bang to set a variable (it can be the same name, but doesn't have to be) in some other skin.
http://docs.rainmeter.net/manual-beta/bangs#SetVariable
The final parameter on the bang should be the config that you want to set the variable in.
http://docs.rainmeter.net/manual-beta/skins#Config
"Shared" variables are possible by using an @Include file that you reference in one or more skins. You can have the skin that is retrieving the value use !WriteKeyValue to write the changed variable in the include file, and then have multiple skins access the value with @Include. The thing to keep in mind with this approach however, is that @Include files are only read when a skin is loaded or refreshed. This means that it can't happen in some "dynamic" way, where the skin getting the value changes the include file, and all other skins using it just see the change. The other skins would have to be refreshed, which depending on your design, can be pretty brute-force.
You can of course use both... !SetVariable to dynamically set the variable in one or more other skins without refreshing, and !WriteKeyValue to make the change "permanent" if that is desired, so when any or all of the skin are in fact reloaded or refreshed, the new variable value is "shared" by all skins.
-
- Rainmeter Sage
- Posts: 276
- Joined: February 17th, 2014, 12:39 pm
- Location: Hungary
Re: Sharing variable values between skins
Greetings!
I know this is an old topic, probably i missed something, but this method drops me back with errors.
I use this code to set a variable in another skin:
"nameday.ini"
There is a measure, which is catching name from a text file for the current date, and the "NamToday" is in the other skin.
Now this error comes up:
"!SetVariable: Skin "C:\Users\rolan\Documents\Rainmeter\Skins\Controllet22\Clock\Clock.ini" not found (Controllet22\NameCalendar\nameday.ini)"
- The path is absolutely correct in the error, the file path and name and everything is as in the error. Somehow still this comes up, i am clueless.
I appreciate any help!
I know this is an old topic, probably i missed something, but this method drops me back with errors.
I use this code to set a variable in another skin:
"nameday.ini"
Code: Select all
[!SetVariable NamToday "[CatchTodaysNames]" "#ROOTCONFIGPATH#Clock\Clock.ini"]
Now this error comes up:
"!SetVariable: Skin "C:\Users\rolan\Documents\Rainmeter\Skins\Controllet22\Clock\Clock.ini" not found (Controllet22\NameCalendar\nameday.ini)"
- The path is absolutely correct in the error, the file path and name and everything is as in the error. Somehow still this comes up, i am clueless.
I appreciate any help!
-
- Rainmeter Sage
- Posts: 8467
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Sharing variable values between skins
It's not the path, it's the config name:rbriddickk84 wrote: ↑August 29th, 2023, 8:16 am Greetings!
I know this is an old topic, probably i missed something, but this method drops me back with errors.
I use this code to set a variable in another skin:
"nameday.ini"There is a measure, which is catching name from a text file for the current date, and the "NamToday" is in the other skin.Code: Select all
[!SetVariable NamToday "[CatchTodaysNames]" "#ROOTCONFIGPATH#Clock\Clock.ini"]
Now this error comes up:
"!SetVariable: Skin "C:\Users\rolan\Documents\Rainmeter\Skins\Controllet22\Clock\Clock.ini" not found (Controllet22\NameCalendar\nameday.ini)"
- The path is absolutely correct in the error, the file path and name and everything is as in the error. Somehow still this comes up, i am clueless.
I appreciate any help!
https://docs.rainmeter.net/manual/skins/#Config
Also, make sure you update relevant sections in the target skin, to be aware of the value of that variable, if needed.
-
- Rainmeter Sage
- Posts: 276
- Joined: February 17th, 2014, 12:39 pm
- Location: Hungary
Re: Sharing variable values between skins
Heya! Thank you very much for answering and helping!Yincognito wrote: ↑August 29th, 2023, 9:11 am It's not the path, it's the config name:
https://docs.rainmeter.net/manual/skins/#Config
Also, make sure you update relevant sections in the target skin, to be aware of the value of that variable, if needed.
I also updated a measure in the target skin which uses that variable, which also gave the same error, i just didn't included that part in here. I thought if i can solve the error in one, then it will be soved both.
So i checked out that config name description, yet i don't get it. Is it because the two skins are in different config folders?
If it isn't because of this, then i don't get your clue
Also tried with removing the "Clock.ini" from the script, but has the same kind of error.
-
- Rainmeter Sage
- Posts: 276
- Joined: February 17th, 2014, 12:39 pm
- Location: Hungary
Re: Sharing variable values between skins
Okay, i figured it out, i never used this kind of technique before, so i apologize for my n00bness.
I just had to refer in the "path" area as "Controllet22\Clock", removing all before it and before. Now i get it, i was just experimenting and suddenly worked then i get my head around it why it wasn't working.
Extra informations
Thank you again for help and guidence! Also for patience
I just had to refer in the "path" area as "Controllet22\Clock", removing all before it and before. Now i get it, i was just experimenting and suddenly worked then i get my head around it why it wasn't working.
Extra informations
Thank you again for help and guidence! Also for patience
-
- Rainmeter Sage
- Posts: 5540
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Sharing variable values between skins
EDIT: Glad to see you found the answer...rbriddickk84 wrote: ↑August 29th, 2023, 9:44 am Heya! Thank you very much for answering and helping!
I also updated a measure in the target skin which uses that variable, which also gave the same error, i just didn't included that part in here. I thought if i can solve the error in one, then it will be soved both.
So i checked out that config name description, yet i don't get it. Is it because the two skins are in different config folders?
If it isn't because of this, then i don't get your clue
Also tried with removing the "Clock.ini" from the script, but has the same kind of error.
If you have the correct Config Name this works; the correct Config Name can be seen in bold at the top of the right-click context menu of all skins. Note:
The skin using the new variable must be loaded when using the !SetVariable on a separate config and the meter/measure have DynamicVariables=1 set.
You do not have the required permissions to view the files attached to this post.
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Rainmeter Sage
- Posts: 276
- Joined: February 17th, 2014, 12:39 pm
- Location: Hungary
Re: Sharing variable values between skins
eclectic-tech wrote: ↑August 29th, 2023, 11:09 am EDIT: Glad to see you found the answer...
If you have the correct Config Name this works; the correct Config Name can be seen in bold at the top of the right-click context menu of all skins.
configname.png
Note:
The skin using the new variable must be loaded when using the !SetVariable on a separate config and the meter/measure have DynamicVariables=1 set.
Yes, thank you too, it's so weird that so many years, and i never used this before
I wrote much more diffcult scripts, but this got me
-
- Rainmeter Sage
- Posts: 8467
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Sharing variable values between skins
No problem - great to see that you eventually got the idea. Was on my phone and a bit busy at the time, but luckily it all turned out well.rbriddickk84 wrote: ↑August 29th, 2023, 10:57 amThank you again for help and guidence! Also for patience
-
- Rainmeter Sage
- Posts: 16658
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Sharing variable values between skins
This can easily be avoided, by using the !SetVariableGroup bang instead of the simple !SetVariable. This possibility is many times forgotten by many users (not talking necessary about you), however might by extremely useful. If we're using the !SetVariable bang, the skin in which we want to set the variable has to be activated, as you described, however if instead we're using the !SetVariableGroup bang, if the skin in cause is activated, the variable is set, however if it's inactive, nothing happens. No error messages, nothing. Much easier, in my opinion.eclectic-tech wrote: ↑August 29th, 2023, 11:09 am Note:
The skin using the new variable must be loaded when using the !SetVariable on a separate config