I would like to use the position of a skin as a global variable for the rest of the skins, so that if I change the position of the main skin, it changes the variables in the other skins. So I want to use the set-variable function to set a variable in the variables.inc file in @Resources folder.
Can I do this?
It is currently April 26th, 2024, 11:17 pm
Setvaribale from a skin into a file in @resources folder
-
- Posts: 14
- Joined: January 28th, 2018, 8:45 am
-
- Rainmeter Sage
- Posts: 16174
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Setvaribale from a skin into a file in @resources folder
https://forum.rainmeter.net/viewtopic.php?p=146511#p146511Gangula wrote:I would like to use the position of a skin as a global variable for the rest of the skins, so that if I change the position of the main skin, it changes the variables in the other skins. So I want to use the set-variable function to set a variable in the variables.inc file in @Resources folder.
Can I do this?
Code: Select all
[MeasureXY]
Measure=Calc
Formula=( #CURRENTCONFIGX# + #CURRENTCONFIGY# )
OnChangeAction=[!WriteKeyValue Variables X "#CURRENTCONFIGX#" "#@#variables.inc"][!WriteKeyValue Variables Y "#CURRENTCONFIGY#" "#@#variables.inc"]
DynamicVariables=1
For direct use, you can add further !SetVariable bangs to the above OnChangeAction option, to besides writing them into the variables.inc file, also set them dynamically. Again one disadvantage: you have to add so many !SetVariable bangs, as many skins you have loaded, one for each of them.
Eg: OnChangeAction=[!WriteKeyValue Variables X "#CURRENTCONFIGX#" "#@#variables.inc"][!WriteKeyValue Variables Y "#CURRENTCONFIGY#" "#@#variables.inc"][!SetVariable X "#CURRENTCONFIGX#" "ProperConfig"][!SetVariable Y "#CURRENTCONFIGY#" "ProperConfig"]. The two !SetVariable bangs above will set the new value of the X and Y variable in the loaded skin of the ProperConfig, not in the current skin (due to the last parameter of both bangs). Beside this, the two WriteKeyValue bangs write the same value into the variables.inc file, so these values can also be used, even after a refresh of the skin(s).
-
- Posts: 18
- Joined: February 17th, 2018, 11:08 pm
Re: Setvaribale from a skin into a file in @resources folder
I understand what you're asking, but if your goal is to move all skins in unison to the "main" one, why not just set all your skins under the same DragGroup? Hold CTRL+ALT, LEFT click to highlight your "main" skin and the rest will follow?Gangula wrote:I would like to use the position of a skin as a global variable for the rest of the skins, so that if I change the position of the main skin, it changes the variables in the other skins. So I want to use the set-variable function to set a variable in the variables.inc file in @Resources folder.
-
- Posts: 14
- Joined: January 28th, 2018, 8:45 am
Re: Setvaribale from a skin into a file in @resources folder
I do not want to move all of them in unison, I want to set a variable in all of them that dynamically updates with the location of the main skin.ChicknwithNoName wrote:but if your goal is to move all skins in unison to the "main" one,
-
- Rainmeter Sage
- Posts: 16174
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Setvaribale from a skin into a file in @resources folder
Then you don't have to use the !WriteKeyValue bangs, just the !SetVariable bangs. Add two of this bang, for each skin (config) in which you'd like to set up the value of the variable. Just don't forget the DynamicVariables=1 option in the meters or measures where you're using the values of the variables.Gangula wrote:I want to set a variable in all of them that dynamically updates with the location of the main skin.
-
- Posts: 14
- Joined: January 28th, 2018, 8:45 am
Re: Setvaribale from a skin into a file in @resources folder
So if I would like to use this dynamic variable in 10 skins, I have to add 10 !Setvariable bangs?balala wrote:Add two of this bang, for each skin (config) in which you'd like to set up the value of the variable.
-
- Rainmeter Sage
- Posts: 16174
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Setvaribale from a skin into a file in @resources folder
Actually 20. Two for each skin. One would set the value of the X and the other the value of the Y variable.Gangula wrote:So if I would like to use this dynamic variable in 10 skins, I have to add 10 !Setvariable bangs?
-
- Posts: 14
- Joined: January 28th, 2018, 8:45 am
Re: Setvaribale from a skin into a file in @resources folder
Isn't there any simpler way that'll make the variable global? Can't we use the! setvariable to set the variable in an. inc file in the @resources folder to use it in all of the skins?Gangula wrote:So if I would like to use this dynamic variable in 10 skins, I have to add 10 !Setvariable bangs?
-
- Rainmeter Sage
- Posts: 16174
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Setvaribale from a skin into a file in @resources folder
As I said before, the !SetVariable sets dynamically a value for a variable, not in an .inc file, but in the skins. As I said, you can use the !WriteKeyValue bang to write the value of the variable into a .inc file, but this solution has the disadvantage that each skin using this value MUST be refreshed every time the variable is changing and is rewritten. Not a good solution at all, because refreshing the skins is a very destructive operation, which as much as possible should have to be avoided. There are some situations when the refresh is absolutely necessary, but I doubt this would be a such case.Gangula wrote:Isn't there any simpler way that'll make the variable global? Can't we use the! setvariable to set the variable in an. inc file in the @resources folder to use it in all of the skins?
But writing the appropriate bangs is not too hard. Have to write one pair (one for the X and the other for the Y variable), then copy and paste them so many as many times you need them. Then have to modify the Config parameters.
-
- Posts: 14
- Joined: January 28th, 2018, 8:45 am
Re: Setvaribale from a skin into a file in @resources folder
Okay, Thank you. Really helps