SilverAzide wrote:Just a guess, but assuming your WebParser measures are returning values, then the problem is that your condition in MeasureTime is trying to compare a number to a string. MeasureSunrise/MeasureSunset need to be converted with Time measures to be actual timestamp values, then the MeasureTime condition (once adjusted to reference the time measures) will work as you expect.
SilverAzide is right, the IfCondition can't be applied to Strings, just to numbers.
To fix the issue, I'd add a few measures, to convert the Sunrise and Sunset to numerical values. I'd multiply the number of hours with 24 (the number of hours within a day) and would add the number of minutes (as you probably figured out, this has to be done twice: once for the Sunrise and secondly for the Sunset). This way you get a number between 0 (midnight) and 1440 (the number of minutes within a day). But to can do all this, you have to add four String meters, which extract the hour and minute of Sunrise and Sunset ([MeasureSunriseHour], [MeasureSunriseMinute], [MeasureSunsetHour] respectively [MeasureSunsetMinute]), then have to add Calc measures to calculate the numerical values associated with the Sunrise and Sunset ([MeasureSunriseMoment] and [MeasureSunsetMoment]).
The current time also has to be converted in a similar way, to number. So, you need a Time measure to get the hour ([MeasureHour]) and another to get the minute ([MeasureMinute]), then one to make the needed conversion ([MeasureTime]). This last measure will also have the appropriately modified IfCondition options.
All this being said, here is the modified code:
Code: Select all
[Rainmeter]
Update=1000
[Variables]
UpdateRateSeconds=600
URL=https://www.foreca.com/Bulgaria/Sofia
[MeasureSunrise]
Measure=WebParser
Url=#URL#
RegExp=(?siU)Sun rise: <strong>(.*)</strong>
UpdateRate=#UpdateRateSeconds#
StringIndex=1
[MeasureSunriseHour]
Measure=String
String=[MeasureSunrise]
RegExpSubstitute=1
Substitute="^(\d{1,2}):\d{1,2}$":"\1"
DynamicVariables=1
[MeasureSunriseMinute]
Measure=String
String=[MeasureSunrise]
RegExpSubstitute=1
Substitute="^\d{1,2}:(\d{1,2})$":"\1"
DynamicVariables=1
[MeasureSunriseMoment]
Measure=Calc
Formula=( 60 * [MeasureSunriseHour] + [MeasureSunriseMinute] )
DynamicVariables=1
[MeasureSunset]
Measure=WebParser
Url=#URL#
RegExp=(?siU)Sun set: <strong>(.*)</strong>
UpdateRate=#UpdateRateSeconds#
StringIndex=1
[MeasureSunsetHour]
Measure=String
String=[MeasureSunset]
RegExpSubstitute=1
Substitute="^(\d{1,2}):\d{1,2}$":"\1"
DynamicVariables=1
[MeasureSunsetMinute]
Measure=String
String=[MeasureSunset]
RegExpSubstitute=1
Substitute="^\d{1,2}:(\d{1,2})$":"\1"
DynamicVariables=1
[MeasureSunsetMoment]
Measure=Calc
Formula=( 60 * [MeasureSunsetHour] + [MeasureSunsetMinute] )
DynamicVariables=1
[MeasureHour]
Measure=Time
Format=%#H
[MeasureMinute]
Measure=Time
Format=%#M
[MeasureTime]
Measure=Calc
Formula=( 60 * MeasureHour + MeasureMinute )
IfCondition=((#CURRENTSECTION#>=MeasureSunriseMoment)&&(#CURRENTSECTION#<=MeasureSunsetMoment))
IfTrueAction=[!ShowMeter "SUN"]
IfFalseAction=[!HideMeter "SUN"]
[MeterSunrise]
Meter=String
MeasureName=MeasureSunrise
X=0
Y=0
W=120
H=60
FontSize=8
FontColor=250,250,250,250
StringStyle=Normal
StringEffect=SHADOW
FontFace=arial
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
Prefix="Sunrise: "
[MeterSunset]
Meter=String
MeasureName=MeasureSunset
X=0
Y=15r
W=120
H=60
FontSize=8
FontColor=250,250,250,250
StringStyle=Normal
StringEffect=SHADOW
FontFace=arial
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
Prefix="Sunset: "
[SUN]
Meter=String
FontSize=20
FontWeight=400
x=0
y=50r
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=SUN
Hidden=1
Note that in the posted code the equality sign is doubled into the IfFalseAction option of the [MeasureTime] measure. I also fixed this.