It is currently March 29th, 2024, 9:29 am

[Suggestion] %1 %2 %3 etc. used outside of string meters

Report bugs with the Rainmeter application and suggest features.
User avatar
Virginityrocks
Posts: 478
Joined: February 26th, 2011, 10:22 pm

[Suggestion] %1 %2 %3 etc. used outside of string meters

Post by Virginityrocks »

As far as I know, string meters are the only place where %1 is usable. I'd like to see this functionality extended, so that %1 can be used in places such as conditions and formulas, !SetVariables, !WriteKeyValues, etc.

(Alternatively, adding the meter parameter :MeasureName to section variables would be a great addition to Rainmeter and could be a good substitute for this suggestion. Example: [#CURRENTSECTION#:MeasureName] would work.)

Code: Select all

[Rainmeter]

[Variables]
Number=999

[Measure1]
Measure=Calc
Formula=1

[Measure2]
Measure=Calc
Formula=2

[Measure3]
Measure=Calc
Formula=3

;--------------------------------

[MeterStyle]
FontSize=50
FontColor=255,255,255
Text=Click %1
LeftMouseUpAction=[!WriteKeyValue Variables Number %1]
Hidden=(%1 = 1 ? 0 : 1)

;--------------------------------

[Meter1]
Meter=String
MeasureName=Measure1
MeterStyle=MeterStyle

[Meter2]
Meter=String
MeasureName=Measure2
MeterStyle=MeterStyle
Y=R

[Meter3]
Meter=String
MeasureName=Measure3
MeterStyle=MeterStyle
Y=R
In this case, clicking on Meter1, Meter2, or Meter3 should set the value of #Number# to 1, 2, or 3 respectively. As of now, "Text=Click %1" will work fine, but [!WriteKeyValue Variables Number %1] will set the value of #Number# to %1 instead of its corresponding measure's value. If the functionality of %1 were extended, it could have many applications across Rainmeter.

Perhaps there is another solution to this problem that I'm not aware of. :MeasureName as a meter parameter would be a great alternative. [#CURRENTSECTION#:MeasureName] would be a superior substitute to %1 in this example.

The reason why I would want to use [#CURRENTSECTION#:MeasureName] instead of calling that measure by name directly is for Styles. Without this feature, multiple meters that have similar actions but use varying measures would need their own unique LeftMouseUpActions. With this feature, all LeftMouseUpActions can be consolidated into one style, drastically reducing the workload.
You do not have the required permissions to view the files attached to this post.
User avatar
raiguard
Posts: 660
Joined: June 25th, 2015, 7:02 pm
Location: The Sky, USA

Re: [Suggestion] %1 %2 %3 etc. used outside of string meters

Post by raiguard »

The [#CURRENTSECTION#:MeasureName] thing would be so useful for the reason you suggested. There are several dozen meters in one of my skins that have identical mouse actions in which the only difference is the Meter name. I would love this so much.
”We are pretty sure that r2922 resolves the regression in resolution caused by a reversion to a revision.” - jsmorley, 2017