Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
TestString="{a},{b},{c},{d},{e},{{f1,f2}},{g},{h},{i},{j},{k},{l},{m},{n},{o}"
Element=0
[MeasureCounter]
Group=TestsGroup
Measure=Calc
Formula=0
UpdateDivider=-1
OnUpdateAction=[!SetVariable Element [MeasureCounter]]
[MeasureTestOne]
Group=TestsGroup
Measure=String
String="#TestString#"
UpdateDivider=-1
RegExpSubstitute=1
Substitute="(?siU)^\{(?:.*\}(?:,\{|$)){0,#Element#}+(.*)(?:\},\{.*|\})$":"\1"
DynamicVariables=1
[MeasureTestTwo]
Group=TestsGroup
Measure=String
String="#TestString#"
UpdateDivider=-1
RegExpSubstitute=1
Substitute="(?siU)^\{(?:.*\}(?:,\{|$)){0,#Element#}+":"","(?:\},\{.*|\})$":""
DynamicVariables=1
[MeterTests]
Meter=String
Y=0R
FontSize=20
FontWeight=500
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
MeasureName=MeasureTestOne
MeasureName2=MeasureTestTwo
Text="T. String = #TestString##CRLF#Element = #Element##CRLF#Result 1 = %1#CRLF#Result 2 = %2"
MouseScrollUpAction=[!SetOption MeasureCounter Formula ((MeasureCounter<=(0))?(15):(MeasureCounter-1))][!UpdateMeasureGroup "TestsGroup"][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetOption MeasureCounter Formula ((MeasureCounter>=(15))?(0):(MeasureCounter+1))][!UpdateMeasureGroup "TestsGroup"][!UpdateMeter *][!Redraw]
DynamicVariables=1
Obviously, I would prefer [MeasureTestTwo] to work as expected, since in case of out-of-bounds indexes (like 15), it promptly returns the empty string. Where could the problem be?