It is currently April 16th, 2024, 4:54 pm

Concatenate #CurrentSection# and text as a variable

Get help with creating, editing & fixing problems with skins
User avatar
DanDaBear
Posts: 110
Joined: February 23rd, 2018, 3:12 am
Location: United States

Concatenate #CurrentSection# and text as a variable

Post by DanDaBear »

I am trying to create a new variable in a program launcher from #CurrentSection# and text as a variable so I can just copy and paste meters, change the meter name, which will set other variables.

IE: meter name is [App1], Text label is in variable section as: App1Text=Calculator. I want to use #CurrentSection#Text and get the value of #App1Text# as a variable which would give me the value of App1Text, IE: "Calculator"

I have this working in: MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint #HoverColor#][!SetOption Tip1 Text #"#CURRENTSECTION#Label"#"][!SetOption Tip1 Y "([#CurrentSection#:Y]+14)"][!ShowMeter Tip1][!UpdateMeter *][!Redraw]

but it doesn't work for the app path or the icon.

Is this possible?

I am trying to put most of the coding in a meter style to save time and space, an idea I stole borrowed from Virginityrocks here in the forums in Tips and Tricks, Simple way to make text buttons look nicer using the Shape meter
Last edited by DanDaBear on April 26th, 2018, 11:58 am, edited 1 time in total.
Never underestimate the power of stupid! :D
User avatar
Brian
Developer
Posts: 2678
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Concatenate #CurrentSection# and text as a variable

Post by Brian »

User avatar
DanDaBear
Posts: 110
Joined: February 23rd, 2018, 3:12 am
Location: United States

Re: Concatenate #CurrentSection# and text as a variable

Post by DanDaBear »

Very polite RTFM, But I am not nesting two different variables. :17denial

I am using this in a launcher skin that is a vertical group of twelve icons that, on mouse over, will use the current section name using #CURRENTSECTION#, which is named [Launch1] and combining it with Text, as in:

[!SetOption Tip1 Text [b]#"#CURRENTSECTION#Label"#"[/b]]

to resolve the variable called "Launch1Label" that is already in the [Variables] section to its value, which is the program name that the icon will launch when clicked: Launch1Label=Calculator

- this code is in a [Style] section and placed in all image meters:

Code: Select all

[Style]
ImageTint=#TextColor#
X=#IconX#
Y=#Yoffset#R
W=#IconWidth#
H=#IconHeight#
SolidColor=0,0,0,1
AntiAlias=1
GreyScale=1
LeftMouseUpAction=#App2#
MouseOverAction=[!SetOption #CURRENTSECTION# ImageTint #HoverColor#][!SetOption Tip1 Text #"#CURRENTSECTION#Label"#"][!SetOption #CURRENTSECTION# ImageName #"#CURRENTSECTION#Icon"#"][!SetOption #CURRENTSECTION# LeftMouseUpAction #"#CURRENTSECTION#App"#"][!SetOption Tip1 Y "([#CurrentSection#:Y]+14)"][!ShowMeter Tip1][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# ImageTint #TextColor#][!HideMeter Tip1][!UpdateMeter *][!Redraw]
DynamicVariables=1
[Launch1]
Meter=Image
MeterStyle=Style

This is how all twelve meters actually look. Everything else is in the Style :sly:

This works fine in the MouseOverAction using: [!SetOption Tip1 Text [b]#"#CURRENTSECTION#Label"#"[/b]] [!SetOption #CURRENTSECTION# LeftMouseUpAction [b]#"#CURRENTSECTION#App"#"[/b]]
The first bang resolves the variable: Launch1Label=Calculator for the tooltip text (using a single meter that changes position and text depending on the calling meter)

The second resolves the variable: Launch1App=[Calc.exe] which runs the calculator.

The problem is the icon variable. [!SetOption #CURRENTSECTION# ImageName #"#CURRENTSECTION#Icon"#"] works in the MouseOverAction bang but all of the icons are invisible until you hover over the spot which they reside in the launcher. (which makes sense, since they are "set" by the MouseOverAction)

And finally, the actual question:

Is there a way to set the icons in the actual meter using something similar to: [!SetOption #CURRENTSECTION# ImageName #"#CURRENTSECTION#Icon"#"]that will resolve the icon without hovering the mouse first?

Why? Because I am lazy and I want to be able to just copy and paste the last meter to add more icons to launch.
It's bad enough I have to type in a new number for the meter an the new variables for the icon, label and program to run!
Never underestimate the power of stupid! :D
User avatar
Brian
Developer
Posts: 2678
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Concatenate #CurrentSection# and text as a variable

Post by Brian »

DanDaBear wrote:Very polite RTFM, But I am not nesting two different variables. :17denial

I am using this in a launcher skin that is a vertical group of twelve icons that, on mouse over, will use the current section name using #CURRENTSECTION#, which is named [Launch1] and combining it with Text, as in:

[!SetOption Tip1 Text [b]#"#CURRENTSECTION#Label"#"[/b]]

to resolve the variable called "Launch1Label" that is already in the [Variables] section to its value, which is the program name that the icon will launch when clicked: Launch1Label=Calculator
How is this not nesting 2 different variables?

CurrentSection is variable (#1). CurrentSection resolves to Launch1 then you want to combine that with Label to get Launch1Label and resolve that variable (#2). That is literally the definition of nesting variables.

It would look something like this: [#[#CurrentSection]Label]

What am I missing? :?

-Brian
User avatar
DanDaBear
Posts: 110
Joined: February 23rd, 2018, 3:12 am
Location: United States

Re: Concatenate #CurrentSection# and text as a variable

Post by DanDaBear »

OMG! Thank you so much Brian! :17good

I couldn't wrap my head around the nested variable thing but it works perfectly! :yahoo:
(I've only been learning Rainmeter for a little over a month)

Now all the meters look like this:
[Launch2]
Meter=Image
MeterStyle=Style
ImageName=[#[#CurrentSection]Icon
]

To make a new entry I can just copy and paste the last one and all I have to change is the meter name
and add the variables for Icon, App and Label!

Thanks again.
Never underestimate the power of stupid! :D