It is currently April 20th, 2024, 7:48 am
IfMatch Question
-
- Rainmeter Sage
- Posts: 16148
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: IfMatch Question
Ok jsmorley, let's not go further with the assumptions and wait for xenium's explanations, to see what he wants.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: IfMatch Question
See? This is the entire point of my original answer...
-
- Rainmeter Sage
- Posts: 16148
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
-
- Posts: 865
- Joined: January 4th, 2018, 9:52 pm
Re: IfMatch Question
Sorry,
I think the example of RegExp was not suitable to express what I want to do and created confusion ... sorry again
I try to explain otherwise:
If RegExp returns, Red AND Blue, disable [MeasureB] (use IfMatch = Red. * Blue)
OR
If RegExp does not return anything (HTML is missing), disable [MeasureB]
(Here I do not know what to use ...)
Finally, it should look like this:
I think the example of RegExp was not suitable to express what I want to do and created confusion ... sorry again
I try to explain otherwise:
If RegExp returns, Red AND Blue, disable [MeasureB] (use IfMatch = Red. * Blue)
OR
If RegExp does not return anything (HTML is missing), disable [MeasureB]
(Here I do not know what to use ...)
Finally, it should look like this:
Code: Select all
IfMatch = Red. * Blue | ???
IfMatchAction=[!DisableMeasure "MeasureB"]
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: IfMatch Question
I need an example of the actual XML you are parsing, and an example of the actual RegExp option you are using.xenium wrote: ↑December 10th, 2018, 5:01 pm Sorry,
I think the example of RegExp was not suitable to express what I want to do and created confusion ... sorry again
I try to explain otherwise:
If RegExp returns, Red AND Blue, disable [MeasureB] (use IfMatch = Red. * Blue)
OR
If RegExp does not return anything (HTML is missing), disable [MeasureB]
(Here I do not know what to use ...)
Finally, it should look like this:
Code: Select all
IfMatch = Red. * Blue | ??? IfMatchAction=[!DisableMeasure "MeasureB"]
-
- Rainmeter Sage
- Posts: 16148
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: IfMatch Question
Agree. But here is an example code I wrote in the meantime:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasureFile]
Measure=WebParser
URL=#URL#
RegExp=(?siU)(?(?=<item>)<item>(?(?=.*<Name1>).*<Name1>(.*)</Name1>)(?(?=.*<Name2>).*<Name2>(.*)</Name2>))
[Measure1]
Measure=WebParser
Url=[MeasureFile]
IfMatch=^$
IfMatchAction=[!SetVariable Match1 "0"]
IfMatch2=Red
IfMatchAction2=[!SetVariable Match1 "1"]
IfMatch3=^$|Red
IfNotMatchAction3=[!SetVariable Match1 "-10"]
StringIndex=1
[Measure2]
Measure=WebParser
Url=[MeasureFile]
IfMatch=^$
IfMatchAction=[!SetVariable Match2 "0"]
IfMatch2=Blue
IfMatchAction2=[!SetVariable Match2 "1"]
IfMatch3=^$|Blue
IfNotMatchAction3=[!SetVariable Match2 "-10"]
StringIndex=2
[MeasureNames]
Measure=Calc
Formula=( #Match1# + #Match2# )
IfCondition=((#CURRENTSECTION#=0)||(#CURRENTSECTION#=2))
IfTrueAction=[!DisableMeasure "MeasureB"][!SetOption MeterStatus Text "Disabled"]
IfFalseAction=[!EnableMeasure "MeasureB"][!SetOption MeterStatus Text "Enabled"]
DynamicVariables=1
[MeterStatus]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Does this code meats your needs xenium?