It is currently April 16th, 2024, 5:48 pm

Variable Reference to Parent Meter?

Get help with creating, editing & fixing problems with skins
Tibneo
Posts: 4
Joined: August 7th, 2020, 12:22 am

Variable Reference to Parent Meter?

Post by Tibneo »

Is there a way for a simple reference from something like a variable to eliminate complexity within a meter?

I know that's confusing so let me just give you an example;

Code: Select all

[Box1]
SolidColor=0,0,0
W=100
H=100
MouseOverAction=!Execute [!ToggleMeter Box1W]
MouseLeaveAction=!Execute [!ToggleMeter Box1W]

[Box1W]
;W means White
SolidColor=FFF
W=100
H=100
X=r
Y=r
Hidden=1
The idea is to eliminate the need for editing in a scenario where there's multiples of this type of meter.
If you duplicate this operation, and have, say 9 (3x3) boxes in a grid, you would have to change Box1 to Box2, Box 3, Box 4, etc., in at least 3 different places, after copying and pasting the code.

Is there something like #This# that I can enter that references the Meter's name that it's within? Since the bang !ToggleMeter Box1W is within the meter Box1, I would hope there's some sort of variable or reference that can be made to shorten it, like;

Code: Select all

[Box1]
SolidColor=0,0,0
W=100
H=100
MouseOverAction=!Execute [!ToggleMeter #thismeter#W] <----- this would point to #thismeter#W where "#thismeter#" equals "Box1", and the result would be "Box1W"
MouseLeaveAction=!Execute [!ToggleMeter #thismeter#W] <----- and hopefully this would do the same ;)
I've looked through the manual, and found lots of built in options that show how to reference the name of the file, location of the file, name of the skin, etc. but nothing that references the name of the meter. ANY IDEAS AT ALL are greatly appreciated. Thank you!
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Variable Reference to Parent Meter?

Post by mak_kawa »

Hi Tibneo

#CURRENTSECTION# could be usable. Following code works for me.

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=192,192,192,192

[meterTest]
Meter=String
X=5
Y=5
Text=#CURRENTSECTION#
MouseOverAction=[!ToggleMeter #CURRENTSECTION#W]
MouseLeaveAction=[!ToggleMeter #CURRENTSECTION#W]

[meterTestW]
Meter=String
X=5
Y=20
Text=#CURRENTSECTION#
Hidden=1
Ps.: !Execute bang is deprecated. So, you don't need to use it.
Tibneo
Posts: 4
Joined: August 7th, 2020, 12:22 am

Re: Variable Reference to Parent Meter?

Post by Tibneo »

That solution works!

I hate myself for seeing that one in the manual, and not testing it to see my understanding. smh. :???:

Thanks again for the help!!