Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeasureAMPM]
Measure=Time
Format=%p
Substitute="AM":"0","PM":"1"
[MeasureCalcAMPM]
Measure=Calc
Formula=[MeasureAMPM]
IfBelowValue=1
IfBelowAction=!Execute [!ShowMeter MeterAM][!HideMeter MeterPM]
IfEqualValue=1
IfEqualAction=!Execute [!HideMeter MeterAM][!ShowMeter MeterPM]
DynamicVariables=1
[MeterTEST]
Meter=String
MeasureName=MeasureAMPM
X=0
Y=0
FontSize=12
FontColor=255,255,255
Text=MeasureAMPM returns %1
[MeterAM]
Meter=String
X=0
Y=20
Hidden=1
FontSize=12
FontColor=255,255,255
Text=AM
[MeterPM]
Meter=String
X=0
Y=20
Hidden=1
FontSize=12
FontColor=255,255,255
Text=PM
The problem is that the Time measure is returning a string "AM / PM". You are welcome to do a Substitute on the value to change it to a number, but any IfAction on the
same measure will use the original return value, not the substituted value. Since both "AM" and "PM" resolve to zero when treated as a number, that is all the IfAction will ever see. "The sun never sets on the British Empire"...
So we create a secondary Calc measure, which, since we put DynamicVariables=1 on it and use the value of the Time measure in brackets, uses the substituted value. Now we are getting "0" or "1" properly, and the show/hide bangs work.
By the way, you can simplify this a bit:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeasureAMPM]
Measure=Time
Format=%p
Substitute="AM":"0","PM":"1"
[MeasureCalcAMPM]
Measure=Calc
Formula=[MeasureAMPM]
IfBelowValue=1
IfBelowAction=!SetOption MeterAMPM Text "AM"
IfEqualValue=1
IfEqualAction=!SetOption MeterAMPM Text "PM"
DynamicVariables=1
[MeterTEST]
Meter=String
MeasureName=MeasureAMPM
X=0
Y=0
FontSize=12
FontColor=255,255,255
Text=MeasureAMPM returns %1
[MeterAMPM]
Meter=String
X=0
Y=20
FontSize=12
FontColor=255,255,255
Or even simpler:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeasureAMPM]
Measure=Time
Format=%p
[MeterTEST]
Meter=String
MeasureName=MeasureAMPM
X=0
Y=0
FontSize=12
FontColor=255,255,255
Text=MeasureAMPM returns %1
[MeterAMPM]
Meter=String
X=0
Y=20
FontSize=12
FontColor=255,255,255
Text=[MeasureAMPM]
DynamicVariables=1