Eg.
[!ReadVariable MyVariable MyVariable1 “My\Variable1\Location.ini”]
[!ReadVariable MyVariable MyVariable2 “My\Variable2\Location.ini”]
[!ReadVariable MyVariable MyVariable3 “My\Variable3\Location.ini”]
Creates variables:
MyVariable1=Value1
MyVariable2=Value2
MyVariable3=Value3
I have multiple inc files that contain a variable of the same name by design, and therefor an Include= would not work. But if I can read that variable value, and assign it a different name, I can set multiple values from a variable of the same name from multiple files.
It is currently September 10th, 2024, 11:53 pm
[Suggestion] Read variable within an ini/inc without Including it
-
- Posts: 278
- Joined: May 12th, 2019, 8:55 am
-
- Rainmeter Sage
- Posts: 16517
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: [Suggestion] Read variable within an ini/inc without Including it
I'm not a developer, however I strongly doubt this will ever be implemented. But it's not even needed in my opinion, unless I misunderstood something. You could add a MyVariable1=#MyVariable# option to the [Variables] section of the My\Variable1\Location.ini file, a MyVariable2=#MyVariable# to the My\Variable2\Location.ini file and so on.
-
- Posts: 278
- Joined: May 12th, 2019, 8:55 am
Re: [Suggestion] Read variable within an ini/inc without Including it
No. That won’t work. Because each file does not know if it is Variable1, Variable2, Variable3, etc.
And since Variable Names cannot themselves contain variables that’s not possible.
Eg. Variable#IndexNum#=Value
You’re talking about adding fixed values but the point is for making something dynamic. Eg. Modules that are customizable for a skin, that each contain variables of the same name, but need to be read by a central skin independently in order to control them.
What MIGHT be possible, but haven’t tested is:
@include1=My\Variable1\Location.ini
NewVariable1=#MyVariable#
@include2=My\Variable2\Location.ini
NewVariable2=#MyVariable#
But I’m 99% positive the variables do not parse linearly this way.
And since Variable Names cannot themselves contain variables that’s not possible.
Eg. Variable#IndexNum#=Value
You’re talking about adding fixed values but the point is for making something dynamic. Eg. Modules that are customizable for a skin, that each contain variables of the same name, but need to be read by a central skin independently in order to control them.
What MIGHT be possible, but haven’t tested is:
@include1=My\Variable1\Location.ini
NewVariable1=#MyVariable#
@include2=My\Variable2\Location.ini
NewVariable2=#MyVariable#
But I’m 99% positive the variables do not parse linearly this way.
-
- Rainmeter Sage
- Posts: 8071
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: [Suggestion] Read variable within an ini/inc without Including it
Well, you could use WebParsers for the MyVariable values in those Location.ini files, and replicate what @include does (a bit redundant and with some delay, I know)... Another possibility would be to read the files with Lua and do your thing, but in that case you'd have to pay a little attention to the file encodings.Cariboudjan wrote: ↑March 28th, 2024, 5:38 pmYou’re talking about adding fixed values but the point is for making something dynamic. Eg. Modules that are customizable for a skin, that each contain variables of the same name, but need to be read by a central skin independently in order to control them.
-
- Posts: 278
- Joined: May 12th, 2019, 8:55 am
Re: [Suggestion] Read variable within an ini/inc without Including it
Could use WebParser - But... Eh... Maybe... I'll think about it.