SilverAzide wrote: ↑May 9th, 2021, 3:53 pm
The first problem is that you need to be aware that a time measure returns a formatted string ("HH:MM" in your case of using the %H:%M format), or it can also return a Windows timestamp (number).
Not to nitpick, but in fact not "
or". I mean that a time measure always returns both, a string value (as you described)
AND the time stamp (not
or). The time stamp can be accessed through the (for instance)
[MeasureTime:TimeStamp] section variable (requires the
DynamicVariables=1 option).
Sorry, as said, don't want to nitpick you.
Keichi wrote: ↑May 9th, 2021, 2:33 pm
As you can see, each condition is something that has been tested without any results...
SilverAzide is right when he says:
SilverAzide wrote: ↑May 9th, 2021, 3:53 pm
IfCondition expressions can only handle numeric values, so your attempts to compare with strings will not work.
however there is a somehow simpler approach.
You can slightly modify the Format option of the [MeasureTime] measure to
Format=%H.%M. This way the measure returns a decimal number and you can use the IfConditions, for instance this way:
Code: Select all
[MeasureTime]
Measure=Time
Format=%H.%M
IfCondition=((MeasureTime >= 06)&&(MeasureTime < 13))
IfTrueAction=[!SetOption StyleTime TextColor "188,90,69,255,255"][!UpdateMeter StyleTime][!Redraw]
IfCondition2=((MeasureTime >= 13)&&(MeasureTime < 19))
IfTrueAction2=[!SetOption StyleTimee TextColor "188,90,69,255,255"][!UpdateMeter StyleTime][!Redraw]
IfCondition3=((MeasureTime >= 19)&&(MeasureTime < 23))
IfTrueAction3=[!SetVariable TextColor "188,90,69,255,255"][!UpdateMeter *][!Redraw]
IfCondition4=((MeasureTime >= 23)||(MeasureTime < 6))
IfTrueAction4=[!SetVariable TextColor "188,90,69,255,255"][!UpdateMeter *][!Redraw]
Here I also aded a few pairs of parentheses. Even if they are not absolutely needed, I'm always using them, because at least for me they are making the conditions better and more clearly visible.
With the above solution, you can get rid of the [Measure24Hr] measure (at least supposing the posted code is the entire code used by your skin), because it is not used anywhere else in your code.
The disadvantage of the above approach is that the [MeterTime] will show the time as (for example)
8.00, not
8:00. If this is not a too big disadvantage, you can use this approach.
SilverAzide wrote: ↑May 9th, 2021, 3:53 pm
- A side issue to keep in mind, Rainmeter processes the file in order (top down). Your Measure24Hr measure makes reference to MeasureTime, which occurs later in the file. When the skin first loads, because it is out of order, the MeasureTime measure will not have a value when Measure24Hr runs the first time. I'd suggest re-ordering the measures at some point to make sure no measure references another measure that is later in the file.
This is not a problem. No disadvantages, no error messages, nothing if the measures are placed into the posted order. This might be a problem in procedural programming languages, but not in Rainmeter, which
is not a programming language.
SilverAzide wrote: ↑May 9th, 2021, 3:53 pm
There are a number of ways you can achieve what you want. I would suggest you can either create a Time measure that returns the hour only (remember, this is the
string representation of the hour) or just ignore the formatted string and use the timestamp along with some math to calculate the hour.
Code: Select all
; return the hour with no leading zeros, "0" to "23"
[MeasureHour]
Measure=Time
Format=%#H
; convert the hour string into a number, 0 to 23
[Measure24Hr]
Measure=Calc
Formula=([MeasureHour])
IfCondition=(Measure24Hr >= 6) && (Measure24Hr < 13)
...
Now you can use the
[Measure24Hr] result in your IfConditions since it will be a number. (You can do this in a single time measure, but I am suggesting this way first so you can see what is going on more easily.)
No need to add a new measure just for the conditions. As you can see in my above example, you can add the conditions directly to the [MeasureHour] measure.
Usually the less measures (sections), the better, so it's always a good idea not to add measures if they are not needed.
Keichi wrote: ↑May 9th, 2021, 2:33 pm
Code: Select all
[Rainmeter]
Update=1000
[Variables]
fontName=Digital-7
;fontName=DESG7ClassicMini
textSize=12
[Measure24Hr]
Measure=Calc
IfCondition=(MeasureTime >= 0600) && (Measure24Hr < 1300)
IfTrueAction=[!SetOption StyleTime TextColor "188,90,69,255,255"][!UpdateMeter StyleTime]
IfCondition2=(Measure24Hr >= 1300) && (Measure24Hr < 1900)
IfTrueAction2=[!SetOption StyleTimee TextColor "188,90,69,255,255"][!UpdateMeter StyleTime]
IfCondition3=(Measure24Hr >= 19) && (Measure24Hr < 23)
IfTrueAction3=[!SetVariable TextColor "188,90,69,255,255"][!UpdateMeter *]
IfCondition4=(Measure24Hr >= 23) || (Measure24Hr < 06)
IfTrueAction4=[!SetVariable TextColor "188,90,69,255,255"][!UpdateMeter *][!Redraw]
[MeasureTime]
Measure=Time
Format=%H:%M
[MeasureDate]
Measure=Time
Format=%d.%m.%Y
FormatLocale=fr-FR
[MeasureDay]
Measure=Time
Format=%A
FormatLocale=fr-FR
[StyleTime]
StringAlign=Center
StringStyle=Regular
StringEffect=Shadow
FontColor=#TextColor#
FontFace=#fontName#
FontSize=38
AntiAlias=1
ClipString=1
[styleLeftText]
;StringAlign=Left
StringStyle=Bold
StringEffect=Shadow
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1
[styleRightText]
StringAlign=Right
StringStyle=Bold
StringEffect=Shadow
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1
[meterTime]
Meter=String
MeterStyle=styleTime
FontColor=#TextColor#
MeasureName=measureTime
X=245
Y=355
W=200
H=40
[meterDay]
Meter=String
MeterStyle=styleLeftText
MeasureName=measureDay
X=260
Y=400
W=190
H=14
[meterDate]
Meter=String
MeterStyle=styleRightText
MeasureName=measureDate
X=200
Y=0r
W=190
H=14
;Tosave
;FontEffectColor=0,0,0,20
;[styleSeperator]
;SolidColor=255,255,255,15
Sorry, a
StringStyle=Regular option (used on the [StyleTime] section)
is not valid. It probably should be
StringStyle=Normal.