Skin: Code:
@Resources\Variables.inc:
Code: Select all
[Variables]
a=5
Code: Select all
[Variables]
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,47,255
---Measures---
[MeasureParseFile]
Measure=WebParser
Url="file://#@#Variables.inc"
CodePage=1200
RegExp=(?siU)^(.*)$
StringIndex=1
UpdateRate=600
FinishAction=[!UpdateMeasureGroup "FileGroup"][!UpdateMeter *][!Redraw]
OnConnectErrorAction=[!UpdateMeasureGroup "FileGroup"][!UpdateMeter *][!Redraw]
OnRegExpErrorAction=[!UpdateMeasureGroup "FileGroup"][!UpdateMeter *][!Redraw]
[MeasureFileString]
Group=FileGroup
Measure=String
String="[MeasureParseFile]"
RegExpSubstitute=1
Substitute="(?:^\s+|\s+$)":"","(?si)^\s*\[Variables\]\s*(?=\R)":"","(?siU)\R(\N*)=(\N*?)":'[!SetVariable \1 \2]'
;Substitute="(?:^\s+|\s+$)":"","(?si)\s*\[Variables\]\s*(?=\R)":"","(?siU)\R(\N*)=(\N*?)":'[!SetVariable \1 \2]'
;Substitute="(?:^\s+|\s+$)":"","(?si)^\s*\[Variables\]\s*(?=\R)":"","(?siU)\R(\N*)=(\N*?)":'[!SetVariable \1 \2]',"(?si)^.(.*)$":"\1"
;Substitute="(?:^\s+|\s+$)":"","(?si)\s*\[Variables\]\s*(?=\R)":"","(?siU)\R(\N*)=(\N*?)":'[!SetVariable \1 \2]',"(?si)^.(.*)$":"\1"
UpdateDivider=-1
OnUpdateAction=[MeasureFileString]
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
Text="a = #a#"
DynamicVariables=1
Expected behavior: The first 2 substitutes should work, the last 2 should not
Actual behavior: The first 2 susbtitutes don't work, but the last 2 do work
Problem Assumption: A character is "lost" in the string due to the first execution of the [MeasureFileString] measure
Questions: Why this happens and how to fix this? Is this a mistake on my part or something else going on? If the latter, is this the expected behavior?
P.S. It isn't necessarily my intention to use this approach instead of @Include - it just happens that I posted a reply in another slightly related thread and noticed the issue again. Since when I encountered the problem before the code(s) were much more complicated and this was basic enough to be understood easily, I took the opportunity of mentioning the (potential) problem on the forum. The substitute is fairly basic as well: removes the leading and trailing whitespace characters, removes the section name (i.e. [Variables]) and whitespaces up until the last new line, and finally replaces each SomeVar=SomeValue line with [!SetVariable SomeVar SomeValue] (didn't covered the string values in this sample, as it didn't bring anything new to the table anyway).
P.S.S. The Log, although helpful, doesn't quite help with these issues, since you can't "see" line breaks and other such characters in the log.