I have a Meter that's bound to a Measure. The bound Measure (string) has some conditional logic to set some variable values and then call another Measure to retrieve the final data by using a !SetVariable and then binding the variable to the String= line. But the called measure is returning empty data.
The rundown: The variable "dataType" determines if the data retrieved is going to be from the alpha fields or the numeric fields. If the value is 0 the output should be "1:T1:" and if the value is 1 the output should be "A[RFK]". What I'm seeing is "n/a:T1:" and "n/a[RFK]" respectively.
When troubleshooting, I know I'm getting data because in the [meterDisplayValue] if I set the MeasureName to either optAlpha or optNumeric I get the correct data. Or if in [setFirst] I change the String to [optAlpha] or [optNumeric] I get the data. In both scenarios the extensions would not be correct.
I've gone through a lot of iterations of trying different approaches but I'm stuck. Any help that gets me past this would be incredibly appreciated.
Now, I know the first response would be "Just set the extension variable at the top accordingly." and I would agree with that. Unfortunately, this is just a tiny snippet that isolates my problem of a larger project. I would rather the users just change 1 value instead of very many and potentially display invalid data.
Here's the code:
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
BackgroundMode=2
SolidColor=28,32,92,192
DynamicWindowSize=1
[Metadata]
Name=Test_Snippet
Author=wphyer
Information=Gets alpha and numeric data
License=Creative Commons BY-NC-SA 4.0
Version=0.0.1
[Variables]
;dataType: 0 (alpha) | 1 (numeric)
dataType=1
extension=""
runMeasure=""
[getXmlData]
Measure=Plugin
Plugin=WebParser
Url=http://dns.mostly-harmless.lan/stuff/sample_test.xml
UpdateRate=3600
RegExp=(?siU)<data>(.*)</data>
DynamicVariables=1
[getNumericData]
Measure=Plugin
Plugin=WebParser
URL=[getXmlData]
RegExp=(?siU)<n_val1>(.*)</n_val1>
StringIndex=1
StringIndex2=1
Substitute="":"n/a"
DynamicVariables=1
[getAlphaData]
Measure=Plugin
Plugin=WebParser
URL=[getXmlData]
RegExp=(?siU)<a_val1>(.*)</a_val1>
StringIndex=1
StringIndex2=1
Substitute="":"n/a"
DynamicVariables=1
[optAlpha]
Measure=String
String=[getAlphaData]
DynamicVariables=1
[optNumeric]
Measure=String
String=[getNumericData]
DynamicVariables=1
[setFirst]
Measure=String
IfCondition=#dataType# = 0
IfTrueAction=[!SetVariable extension ":T1:"] [!SetVariable runMeasure "[optAlpha]"]
IfCondition2=#dataType# = 1
IfTrueAction2=[!SetVariable extension "[RFK]"] [!SetVariable runMeasure "[optNumeric]"]
String=#runMeasure#
DynamicVariables=1
[styleCommon]
StringCase=None
StringStyle=Normal
StringEffect=Shadow
FontFace=Arial
AntiAlias=1
ClipString=0
StringAlign=Left
FontColor=230,230,230,255
FontSize=9
[meterDisplayValue]
Meter=String
MeterStyle=styleCommon
MeasureName=setFirst
x=0
Y=0
Text=%1#extension#
DynamicVariables=1
Code: Select all
<data><a_val1>A</a_val1><n_val1>1</n_val1></data>