Sample code:
Code: Select all
[Variables]
String=abracadabra
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255
---Measures---
; [MeasureTest]
; Measure=String
; String=a
; RegExpSubstitute=1
; Substitute="(?si)^.*$":"\0a"
; DynamicVariables=1
; [MeasureTest]
; Measure=String
; String=a
; RegExpSubstitute=1
; Substitute="(?si)^(.*)$":"\0a"
; DynamicVariables=1
; [MeasureTest]
; Measure=String
; String=a
; RegExpSubstitute=1
; Substitute="(?si)^(.*)$":"\1a"
; DynamicVariables=1
; [MeasureTest]
; Measure=String
; String=
; RegExpSubstitute=1
; Substitute="(?si)^.*$":"[MeasureTest]a"
; DynamicVariables=1
; [MeasureTest]
; Measure=String
; String=
; RegExpSubstitute=1
; Substitute="$":"a"
; DynamicVariables=1
[MeasureTest]
Measure=String
String=[MeasureTest]a
DynamicVariables=1
---Meters---
[MeterTest]
Meter=STRING
X=0
Y=0
FontFace=Consolas
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
FontSize=16
AntiAlias=1
MeasureName=MeasureTest
Text="Test = %1"
DynamicVariables=1
Actual result: only the uncommented measure does this, the commented ones do not, although the basic steps and principle are (or should be) the same
Now the code above is overly simplified to better see and understand things, so one may rightfully ask why I don't do it as in the last working measure and be done with it. The answer is simple: I can't, since the String option doesn't allow an "inline substitution" and obviously, compared to this sample, my code is more complex than that, which means I have to use RegExp substitutions and simply doing it from the String option is not going to accomplish what I want (which is to regex substitute based on the previous value of the measure).
So, is this the expected behavior and why? And if it is, what can I do to achieve what I want? Any workaround to this?
EDIT: On a second thought, knowing how these things work in WebParser measures where we substitute things and they don't do this over and over on every update, it looks like it is indeed the way it should work, but then, the question remains: how can I achieve the opposite?
EDIT2: Forget I asked, adding this to the skin seems to achieve what I want:
Code: Select all
[Variables]
LastValue=
...
...
...
[MeasureTest]
Measure=String
String=
RegExpSubstitute=1
Substitute="(?si)^.*$":"#LastValue#a"
OnUpdateAction=[!SetVariable LastValue "[MeasureTest]"]
DynamicVariables=1
...