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

Nesting #CurrentSection# along with a link

Get help with creating, editing & fixing problems with skins
k2m
Posts: 4
Joined: February 18th, 2020, 10:29 pm

Nesting #CurrentSection# along with a link

Post by k2m »

Like many, baby's first skin is a launcher. I can get it to work, but want to push it further by cleaning up as much extraneous code as possible.

My Variables section currently looks like this (with some placeholders).

Code: Select all

[Variables]
Option0Icon=#@#Icons\controller.png
Option0Link=C:\Program Files (x86)

Option1Icon=#@#Icons\bbt.png
Option1Link=D:\Program Files (x86)\Steam\steamapps\common\BattleBlock Theater\BattleBlockTheater.exe

Option2Icon=#@#Icons\borderlands3.png
Option2Link=C:\Program Files (x86)

Option3Icon=#@#Icons\broforce.png
Option3Link=D:\Program Files (x86)\Steam\steamapps\common\Broforce\Broforce_beta.exe
Here's how the rest *used* to look.

Code: Select all

[Bar]
Meter=Bar
Hidden=1
Group=Shown
SolidColor=0,0,0,1
Padding=0,5,0,5
W=520
H=35
MouseLeaveAction=[!HideMeterGroup Shown]

[BarIcon]
Meter=Image
ImageName=#BarIcon#
SolidColor=0,0,0,1
Padding=0,0,5,0
W=35
H=35
PreserveAspectRatio=1
LeftMouseUpAction=["#BarLink#"]
MouseOverAction=[!ShowMeterGroup Shown]

[Option1]
Meter=Image
Hidden=1
Group=#Option1Group#
ImageName=#Option1Icon#
Padding=5,0,5,0
X=0R
W=35
H=35
PreserveAspectRatio=1
LeftMouseUpAction=["#Option1Link#"]

[Option2]
Meter=Image
MeterStyle=Option1
Group=[#OptionGroup[#Measure]]
ImageName=#Option2Icon#
LeftMouseUpAction=["#Option2Link#"]
Here's how I *want* it to look.

Code: Select all

[Bar]
Meter=Image
Hidden=1
Group=Icon
SolidColor=0,0,0,1
Padding=0,5,0,5
W=520
H=35
MouseLeaveAction=!HideMeterGroup Icon

[Option0]
Meter=Image
ImageName=[#[#CurrentSection]Icon]
SolidColor=0,0,0,1
Padding=0,0,5,0
W=35
H=35
PreserveAspectRatio=1
LeftMouseUpAction=["#[#CurrentSection]Link"]
MouseOverAction=!ShowMeterGroup Icon

[Option1]
Meter=Image
Hidden=1
Padding=5,0,5,0
X=0R
W=35
H=35
PreserveAspectRatio=1
Group=Icon
ImageName=[#[#CurrentSection]Icon]
LeftMouseUpAction=["#[#CurrentSection]Link"]

[Option2]
Meter=Image
MeterStyle=Option1
Or something like that. Various parts are at various iterations and can be cleaned, but I think the point is clear enough. The icons look great, the skin functions as it should, except for executing the links. I currently have 12 "Option" meters for various games; making any adjustment to one would require an adjustment to all the others, leaving much room for error. I'd rather not have to LeftMouseUpAction=["#OptionNLink#"] N number of times. So is there a way to get ["#[#CurrentSection]Link"] to work?
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Nesting #CurrentSection# along with a link

Post by mak_kawa »

What if you add DynamicVariables=1 to the concerned meter sections?
k2m
Posts: 4
Joined: February 18th, 2020, 10:29 pm

Re: Nesting #CurrentSection# along with a link

Post by k2m »

Adding DynamicVariables=1 didn't resolve the issue. Tbh, I'm not quite sure how DynamicVariables works anyway; the icon variables change from meter to meter just fine without setting it to 1. I figure the issue lies somewhere in quotation mark usage in the LeftMouseUpAction (but I feel like I've exhausted all iterations)
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Nesting #CurrentSection# along with a link

Post by mak_kawa »

Okay, following code does work fine for me.

Code: Select all

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

[Variables]
Option0Link=C:\Program Files (x86)
Option1Link=C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[Option0]
Meter=Image
SolidColor=128,128,128,192
Padding=0,0,5,0
X=5
Y=5
W=35
H=35
LeftMouseUpAction=["[#[#CURRENTSECTION]Link]"]

[Option1]
Meter=Image
SolidColor=128,128,128,192
Padding=5,0,5,0
X=5R
Y=5
W=35
H=35
PreserveAspectRatio=1
Group=Icon
LeftMouseUpAction=["[#[#CURRENTSECTION]Link]"]
k2m
Posts: 4
Joined: February 18th, 2020, 10:29 pm

Re: Nesting #CurrentSection# along with a link

Post by k2m »

At the gym on mobile, but looks like the quotes get their own brackets? I *knew* they were screwing me over somehow. Will check later and report back.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Nesting #CurrentSection# along with a link

Post by mak_kawa »

["[#[#CURRENTSECTION]Link]"]

Outermost brackets of this mean "action enclosure". Within the enclosure, [#[#CURRENTSECTION]Link] is resolved as, for example, C:\Program Files (x86)\Google\Chrome\Application\chrome.exe. So, quotations are required to avoid bad role of spaces in path name, as you know.

Finally, result is "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", and it works.
User avatar
DanDaBear
Posts: 111
Joined: February 23rd, 2018, 3:12 am
Location: United States

Re: Nesting #CurrentSection# along with a link

Post by DanDaBear »

Yes, that works. The problem is, when you have something like:
["#CONFIGEDITOR#" "#@#\IncludeFiles\HorizontalVariables.inc"] It doesn't work. :uhuh:

I have the quotes on the app variables where needed so I can do things like:

Variable is: Launch0App=[#AppChoice[#ToggleMe]],

Added: LeftMouseDownAction=[!SetVariable ToggleMe (1-#ToggleMe#)], to Lanch0 meter to toggle, with:

AppChoice0=E:\SteamLibrary\steamapps\common\wallpaper_engine\wallpaper64.exe -control pause
AppChoice1=E:\SteamLibrary\steamapps\common\wallpaper_engine\wallpaper64.exe -control play


in the Variables section, so when the icon is pressed, it toggles between 1 and zero, selecting AppChoice0 or AppChoice1

It doesn't work with the ["[#[#CURRENTSECTION]Link]"] version but, with quotes on the App variables and placed between brackets "[]", [#[#CURRENTSECTION]Link] will work. 8-)

Both ways work. It just depends on how versatile you want it. :sly:
Never underestimate the power of stupid! :D
k2m
Posts: 4
Joined: February 18th, 2020, 10:29 pm

Re: Nesting #CurrentSection# along with a link

Post by k2m »

Gave the quotes their own brackets, didn't work. Fooled around with half a dozen different things, no dice. Copied your code into mine, it worked. TIL #CURRENTSECTION# is case sensitive. Camel caps doesn't work... But I still needed that extra pair of brackets, so now we're rolling. Thanks, mak!

Edit: That is, #CURRENTSECTION# is case sensitive when using the link. The icons still work as expected using #CurrentSection#. /shrug