It is currently April 24th, 2024, 1:58 pm

2 times !WriteKeyValue with UserInput

Get help with creating, editing & fixing problems with skins
GyRoZz
Posts: 5
Joined: May 7th, 2018, 1:18 pm

2 times !WriteKeyValue with UserInput

Post by GyRoZz »

Hey,

I am trying to write a user input to multiple variables, but I can't get it to work.

This is the code:

Code: Select all

[MeasureInputAngleGrad]
Measure=Plugin
Plugin=InputText
SolidColor=eeeeee
FontColor=111111
FontFace=Quicksand Light
FontSize=14
X=160
Y=299
H=29
W=150
StringAlign=Center
DefaultValue="#SomeVariable1#"
DynamicVariables=1
Command1=[!WriteKeyValue Variables SomeVariable1 "$UserInput$" "individual.inc"][!WriteKeyValue Variables SomeVariable2 "$UserInput$" "individual.inc"][!Refresh "Variety Apps\Test" "Test.ini"][!Refresh]


[SetAngleGrad]
Meter=String
X=235
Y=295
H=30
W=150
FontSize=15
SolidColor=eeeeee
AntiAlias=1
LeftMouseUpAction=[!CommandMeasure "MeasureInputAngleGrad" "ExecuteBatch 1"]
Group=Background
Hidden=#ShowBgGrad#
FontFace=Quicksand
FontColor=111111
Text=#SomeVariable1#
StringAlign=Center
Padding=0,5,0,0
But what I get with this code if I for example give an input of '45' is the following:

Code: Select all

[Variables]
SomeVariable1=45
SomeVariable2=$UserInput$
Does anyone know how to make this work?
Last edited by GyRoZz on July 28th, 2018, 6:45 pm, edited 1 time in total.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: 2 times !WriteKeyValue with UserInput

Post by eclectic-tech »

This was discussed in another thread; the first time "$UserInput$" is used the value of the measure is set to that value, so to use the same "$UserInput$" multiple times, use the measure value of "[#CurrentSection#]".

Code: Select all

Command1=[!WriteKeyValue Variables SomeVariable1 "$UserInput$" "individual.inc"][!WriteKeyValue Variables SomeVariable2 "[#CurrentSection#]" "individual.inc"][!Refresh "Variety Apps\Test" "Test.ini"][!Refresh]
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: 2 times !WriteKeyValue with UserInput

Post by jsmorley »

Minor thing...

Even though it works, I'm a little leery of suggesting nesting variables without using the nesting syntax.

https://docs.rainmeter.net/manual/variables/nesting-variables/

For
[#CurrentSection#]

I'd prefer

[&[#CurrentSection]]

I just think it encourages thinking that you can nest variables and section variables without it, and this particular case is one of the few cases where it works.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: 2 times !WriteKeyValue with UserInput

Post by eclectic-tech »

jsmorley wrote:Minor thing...

Even though it works, I'm a little leery of suggesting nesting variables without using the nesting syntax.

https://docs.rainmeter.net/manual/variables/nesting-variables/

For
[#CurrentSection#]

I'd prefer

[&[#CurrentSection]]

I just think it encourages thinking that you can nest variables and section variables without it, and this particular case is one of the few cases where it works.
Good point... old habits die hard! ;-)
GyRoZz
Posts: 5
Joined: May 7th, 2018, 1:18 pm

Re: 2 times !WriteKeyValue with UserInput

Post by GyRoZz »

Ah great, works like a charm! Thanks eclectic-tech and jsmorley!