Hi!
I'm trying to save the user entered value to the config file, but it simply does not work. This is the code (part of it of course):
;--------------------------------------------------------
[Variables]
Calc=0
Text1a=
[MeasureInput]
Measure=Plugin
Plugin=InputText.dll
X=10
Y=112
H=18
W=190
FontColor=#color.Highlight#
SolidColor=#color.Skin1#
FontFace=Aller
StringStyle=Bold
FontSize=10
FocusDismiss=1
UpdateDivider=86400
DefaultValue=
Command1=!SetVariable Calc "$UserInput$"
Command2=!WriteKeyValue Variables Text1a #Calc#
Command3=!Refresh #CURRENTCONFIG#
;--------------------------------------------------------
The edit field appears and works, the variable "Calc" is set correctly (if I delete Command3), but WriteKeyValue does not do anything! If I use the exact same commands elsewhere in the skin (e.g. in a LeftMouseUpAction), it works fine.
What seems to be the problem here? How can I save data entered by the user to disk? I've now tried to solve this problem for hours, but nothing seems to work.
Thanks!
It is currently May 2nd, 2024, 11:57 pm
!WriteKeyValue does not work in InputText.dll Measure
-
- Posts: 7
- Joined: August 10th, 2012, 3:38 pm
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: !WriteKeyValue does not work in InputText.dll Measure
Try specifying the filename:
Code: Select all
Command2=!WriteKeyValue Variables Text1a "#Calc#" "#CURRENTPATH##CURRENTFILE#"
-
- Posts: 7
- Joined: August 10th, 2012, 3:38 pm
Re: !WriteKeyValue does not work in InputText.dll Measure
Thanks, this seems to do the trick! Great!
However, there's now another problem: how do I write the result of a formula to the ini file? Here's the code:
;------------------------------------
[Variables]
Text1a=1+2
Text1b=[MeasureCalc]
Text2a=
Text2b=
; MEASURES ====================================
[MeasureCalc]
Measure=Calc
Formula=#Text1a#
DynamicVariables=1
[MeasureInput]
Measure=Plugin
Plugin=InputText.dll
X=10
Y=112
H=18
W=190
FontColor=#color.Highlight#
SolidColor=#color.Skin1#
FontFace=Aller
StringStyle=Bold
FontSize=10
FocusDismiss=1
UpdateDivider=86400
DefaultValue=
Command1=!WriteKeyValue Variables Text1a "$UserInput$" "#CURRENTPATH##CURRENTFILE#"
Command2=!WriteKeyValue Variables Text1b [MeasureCalc] "#CURRENTPATH##CURRENTFILE#"
Command3=!Refresh #CURRENTCONFIG#
;------------------------------------
When the user enters a formula, I'd like to save it in Text1a and the result in Text1b. However, Text1b always contains "[MeasureCalc]" instead of the real value, in this case "3". A meter, that displays Text1b, correctly shows "3". So how can I get this "real" result and save it to disk?
This all seems very illogical to me and the manual does not really provide enough info, so sorry for bothering you...
Thanks for helping me out!
However, there's now another problem: how do I write the result of a formula to the ini file? Here's the code:
;------------------------------------
[Variables]
Text1a=1+2
Text1b=[MeasureCalc]
Text2a=
Text2b=
; MEASURES ====================================
[MeasureCalc]
Measure=Calc
Formula=#Text1a#
DynamicVariables=1
[MeasureInput]
Measure=Plugin
Plugin=InputText.dll
X=10
Y=112
H=18
W=190
FontColor=#color.Highlight#
SolidColor=#color.Skin1#
FontFace=Aller
StringStyle=Bold
FontSize=10
FocusDismiss=1
UpdateDivider=86400
DefaultValue=
Command1=!WriteKeyValue Variables Text1a "$UserInput$" "#CURRENTPATH##CURRENTFILE#"
Command2=!WriteKeyValue Variables Text1b [MeasureCalc] "#CURRENTPATH##CURRENTFILE#"
Command3=!Refresh #CURRENTCONFIG#
;------------------------------------
When the user enters a formula, I'd like to save it in Text1a and the result in Text1b. However, Text1b always contains "[MeasureCalc]" instead of the real value, in this case "3". A meter, that displays Text1b, correctly shows "3". So how can I get this "real" result and save it to disk?
This all seems very illogical to me and the manual does not really provide enough info, so sorry for bothering you...
Thanks for helping me out!
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: !WriteKeyValue does not work in InputText.dll Measure
This is a little trickier. The reason it doesn't work now is because InputText is not one of the plugins that support dynamic variables. There are a few workarounds you could do; probably the easiest would be to activate another measure that can use DVs.
There's probably a more elegant way that I just can't think of right now.
Code: Select all
[MeasureInput]
Measure=Plugin
Plugin=InputText.dll
X=10
Y=112
H=18
W=190
FontColor=#color.Highlight#
SolidColor=#color.Skin1#
FontFace=Aller
StringStyle=Bold
FontSize=10
FocusDismiss=1
UpdateDivider=86400
DefaultValue=
Command1=!WriteKeyValue Variables Text1a "$UserInput$" "#CURRENTPATH##CURRENTFILE#"
Command2=!ActivateMeasure WriteVariable
[WriteVariable]
Measure=Calc
Disabled=1
DynamicVariables=1
Formula=1
IfEqualValue=1
IfEqualAction=[!WriteKeyValue Variables Text1b "[MeasureCalc]" "#CURRENTPATH##CURRENTFILE#"][!Refresh]
-
- Posts: 7
- Joined: August 10th, 2012, 3:38 pm
Re: !WriteKeyValue does not work in InputText.dll Measure
Thanks! It works with "!EnableMeasure" ("!ActivateMeasure" doesn't seem to have any effect).
Thanks for your help!
Thanks for your help!
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: !WriteKeyValue does not work in InputText.dll Measure
Whoops. I think I need some juice and crackers.
Glad you got it working, my absentmindedness notwithstanding. :)
Glad you got it working, my absentmindedness notwithstanding. :)