It is currently April 26th, 2024, 1:19 am

[Suggestion] @include value as a variable

Report bugs with the Rainmeter application and suggest features.
User avatar
LGP123
Posts: 60
Joined: November 5th, 2016, 12:15 pm

[Suggestion] @include value as a variable

Post by LGP123 »

I wanted to suggest something that could make the skins with multiples files (with some .inc) a bit simpler.
For exemple if we need to !WriteKeyValue a variable on a .inc file, we can use "@includeN" unless use "inculde.inc" at the Config parameter.
I could be something like this :

Code: Select all

[Rainmeter]
...
[Variables]
@includeN=includeN.inc
...
[SomeMeasure]
...
OnChangeAction=!WriteKeyValue "Variables" "Var1" "1" "@includeN"
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Suggestion] @include value as a variable

Post by jsmorley »

That's extremely unlikely to be added, as you can do it now with:

[Variables]
IncludeFile1=#@#TestInclude.inc
@Include1=#IncludeFile1#

...
LeftMouseUpAction=[!WriteKeyValue Variables MyVar "New Value" "#IncludeFile1#"][!Refresh]

The special key name @Include, no matter where it is used, is simply "replaced" with the contents of the include file. In sene, as far as Rainmeter is concerned, that key name "@Include1" doesn't exist at all once the skin file is read on load or refresh. No dynamic reference to the key name @Include1 is going to mean a thing to Rainmeter after the skin is loaded.

It's why you MUST refresh the skin after you make a change to any external .inc file. The entire @Include process, getting the name of the file from @Include, reading the file in, entirely throwing away the @Include option, putting the contents of the external file in its place, is done once, when the skin is loaded or refreshed. As soon as the skin loads, the key @Include doesn't exist... We just can't "use" it for anything in a skin.

In the above example, there IS NO variable #@Include1# created. It doesn't work that way, instead, whatever is in the include file replaces it right then and there in the [Variables] section.

So what you have to do is create a #Variable# to hold the name of the file, then that can be referenced as a "value" for the @Include "key", and also referenced anywhere else you need it, like a !WriteKeyValue.