It is currently December 15th, 2019, 6:20 am

Alarm clock Adjustment not working properly

Help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 408
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Alarm clock Adjustment not working properly

sl23 » October 31st, 2019, 10:49 pm

I downloaded an alarm clock skin and wanted to dissect it to remove the parts I wanted to add to my current time skin.
Here's the original code:

Code: Select all

[Rainmeter]
Update=1000

[Metadata]
Name=Alarm-Clock
Author=Youkai1977
Version=V1.0 <> 31.10.2018
Information=This Meter is a Part of Terminal-Skin Package
License=Creative Commons BY-NC-SA 3.0

;--------------------------------------------------
;--- VARIABLES & STYLES ---------------------------
;--------------------------------------------------

[Variables]
Images=#@#images\
ImgAlpha=230
SoundPath1=#@#sounds\chimehour.wav
SoundPath2=#@#sounds\alarmclock.wav
DigitColor=0,167,0,230
ValueHourSet=23
ValueMinuteSet=0
FS1=40
FS2=14
FS3=8
FS4=12

[Style1]
FontColor=#DigitColor#
FontFace=Corbel
StringAlign=LEFT
StringStyle=Bold
AntiAlias=1

[Style2]
FontColor=#DigitColor#
FontFace=CONSOLAS
StringAlign=LEFT
StringStyle=Bold
AntiAlias=1

;--------------------------------------------------
;--- MEASURES -------------------------------------
;--------------------------------------------------

;--- MEASURES CLOCK, CHIMESOUND & ALARM -----------

[MeasureTime]
Measure=Time
Format=%#I:%M

[MeasureSec]
Measure=Time
Format=%S

[MeasureChimeHour]
Measure=Time
Format=%M
IfEqualValue=0
IfEqualAction=[Play "#SoundPath1#"]

[MeasureMinMaxHourAlarm]
measure=calc
formula=#ValueHourSet#
DynamicVariables=1
ifconditionmode=1
IfCondition=(#ValueHourSet# < 0)
IfTrueAction=[!SetVariable ValueHourSet "23"]
IfCondition2=(#ValueHourSet# >= 24)
IfTrueAction2=[!SetVariable ValueHourSet "0"]
RegExpSubstitute=1
Substitute="^(\d$)":"0\1"
Disabled=1
Group=mALARM | ALARM

[MeasureMinMaxMinuteAlarm]
measure=calc
formula=#ValueMinuteSet#
DynamicVariables=1
ifconditionmode=1
IfCondition=(#ValueMinuteSet# < 0)
IfTrueAction=[!SetVariable ValueMinuteSet "55"]
IfCondition2=(#ValueMinuteSet# >= 60)
IfTrueAction2=[!SetVariable ValueMinuteSet "0"]
RegExpSubstitute=1
Substitute="^(\d$)":"0\1"
Disabled=1
Group=mALARM | ALARM

[MeasureDigitPrefixerAlarm]
Measure=calc
Formula=00
Dynamicvariables=1
IfCondition=(#ValueHourSet# >= 0) && (#ValueHourSet# <= 9)
IfTrueAction=[!SetOption HourAlarm Prefix "0"]
IfFalseAction=[!SetOption HourAlarm Prefix ""]
IfCondition2=(#ValueMinuteSet# >= 0) && (#ValueMinuteSet# <= 9)
IfTrueAction2=[!SetOption MinuteAlarm Prefix "0"]
IfFalseAction2=[!SetOption MinuteAlarm Prefix ""]
Disabled=1
Group=mALARM | ALARM

[MeasureHourAlarm]
Measure=Time
Format=%H
Disabled=1
Group=ALARM

[MeasureMinuteAlarm]
Measure=Time
Format=%M
Disabled=1
Group=ALARM

[Alarm]
Measure=calc
Formula=0
DynamicVariables=1
IfCondition=(MeasureHourAlarm = #ValueHourSet#) && (MeasureMinuteAlarm = #ValueMinuteSet#)
IfTrueAction=[PlayLoop #SoundPath2#][!Redraw]
Disabled=0
Group=ALARM

;--- MEASURE DATE ---------------------------------

[MeasureDate]
Measure=Time
Format=%d.%m.%Y

;--------------------------------------------------
;--- BACKGROUND -----------------------------------
;--------------------------------------------------

[Background]
Meter=Image
ImageName=#Images#bg_clock.png
AntiAlias=1
X=0
Y=0
W=220
H=82

[SetClockBG]
Meter=Image
SolidColor=0,0,0,1
X=0
Y=-5
W=250
H=72
LeftMouseUpAction=[!ToggleMeasure MeasureChimeHour][!ToggleMeter ChimeSoundOFF][!Redraw]
MiddleMouseUpAction=[%windir%\system32\control.exe timedate.cpl]
RightMouseUpAction=[!EnableMeasureGroup ALARM][!DisableMeasure MeasureChimeHour][!ShowMeterGroup ALARMSET][!HideMeterGroup CLOCK][!HideMeter ChimeSoundOFF][!ShowMeter ChimeSoundALARM][!HideMeter SetClockBG][!Update]

;--------------------------------------------------
;--- CLOCK, DATE, ALARM ---------------------------
;--------------------------------------------------

;--- Clock ----------------------------------------

[Time]
Meter=String
MeasureName=MeasureTime
MeterStyle=Style1
FontSize=#FS1#
X=0
Y=-2
Group=CLOCK

[Seconds]
Meter=String
MeasureName=MeasureSec
FontSize=#FS2#
MeterStyle=Style1
X=180r
Y=35r
Group=CLOCK

;--- Alarm-SET ------------------------------------

[AlarmBG]
Meter=Image
solidcolor=0,0,0,1
X=0
Y=0
W=220
H=82
Hidden=1
Group=ALARMSET
MouseLeaveAction=[!HideMeterGroup ALARMSET][!ShowMeterGroup CLOCK][!ShowMeter AlarmIconON][!ShowMeterGroup ALARMON][!HideMeter AlarmSetIcon][!Redraw]

[HourAlarm]
Meter=String
MeterStyle=Style1
FontSize=#FS1#
Text="#ValueHourSet#"
X=0
Y=-2
DynamicVariables=1
Hidden=1
Group=ALARMSET
MouseScrollUpAction=[!SetVariable ValueHourSet (#ValueHourSet#+1)][!UpdateMeasureGroup mALARM][!UpdateMeter HourAlarm][!Redraw]
MouseScrollDownAction=[!SetVariable ValueHourSet (#ValueHourSet#-1)][!UpdateMeasureGroup mALARM][!UpdateMeter HourAlarm][!Redraw]

[ColonAlarm]
Meter=string
MeterStyle=Style1
FontSize=#FS1#
Text=":"
X=76r
Y=r
Hidden=1
Group=ALARMSET

[MinuteAlarm]
Meter=String
MeterStyle=Style1
FontSize=#FS1#
Text="#ValueMinuteSet#"
X=20r
Y=r
DynamicVariables=1
Hidden=1
Group=ALARMSET
MouseScrollUpAction=[!SetVariable ValueMinuteSet (#ValueMinuteSet#+1)][!UpdateMeasureGroup mALARM][!UpdateMeter MinuteAlarm][!Redraw]
MouseScrollDownAction=[!SetVariable ValueMinuteSet (#ValueMinuteSet#-1)][!UpdateMeasureGroup mALARM][!UpdateMeter MinuteAlarm][!Redraw]

;--- DATE & ALARM-TIME ----------------------------

[Date]
Meter=String
MeasureName=MeasureDate
MeterStyle=Style1
FontSize=#FS4#
X=8
Y=59

[AlarmIconON]
Meter=Image
ImageName=#Images#alarm_on.png
ImageAlpha=#ImgAlpha#
AntiAlias=1
X=127r
Y=2r
W=16
H=16
ToolTipText="Set/Stop Alarm"
Hidden=1
Group=ALARMON
LeftMouseUpAction=[!ShowMeterGroup ALARMSET][!HideMeterGroup CLOCK][!HideMeter AlarmIconON][!HideMeterGroup ALARMON][!ShowMeter AlarmSetIcon][!Redraw]
RightMouseUpAction=[!DisableMeasureGroup ALARM][!EnableMeasure MeasureChimeHour][!HideMeter AlarmIconON][!HideMeter AlarmTimeON][!HideMeter ChimeSoundALARM][PlayStop "#SoundPath2#"][!ShowMeter SetClockBG][!Redraw]

[AlarmTimeON]
Meter=String
MeasureName=MeasureMinMaxHourAlarm
MeasureName2=MeasureMinMaxMinuteAlarm
MeterStyle=Style1
FontSize=#FS4#
Text=%1:%2
X=20r
Y=-2r
Hidden=1
Group=ALARMON
LeftMouseUpAction=[!ShowMeterGroup ALARMSET][!HideMeterGroup CLOCK][!HideMeter AlarmIconON][!HideMeterGroup ALARMON][!ShowMeter AlarmSetIcon][!Redraw]
RightMouseUpAction=[!DisableMeasureGroup ALARM][!EnableMeasure MeasureChimeHour][!HideMeter AlarmIconON][!HideMeter AlarmTimeON][!HideMeter ChimeSoundALARM][PlayStop "#SoundPath2#"][!ShowMeter SetClockBG][!Redraw]

;--------------------------------------------------
;--- BUTTONS CLOCK/ALARM-SET ----------------------
;--------------------------------------------------

[ChimeSoundOFF]
Meter=Image
ImageName=#Images#Chime_off.png
ImageAlpha=#ImgAlpha#
AntiAlias=1
X=188
Y=10
W=16
H=16
ToolTipText="ChimeSound is OFF"
Hidden=1

[ChimeSoundALARM]
Meter=Image
ImageName=#Images#Chime_off.png
ImageAlpha=#ImgAlpha#
AntiAlias=1
X=r
Y=r
W=16
H=16
ToolTipText="Disabled in Alarm-Mode"
Hidden=1

[AlarmSetIcon]
Meter=Image
ImageName=#Images#setalarm.png
ImageAlpha=#ImgAlpha#
AntiAlias=1
X=135
Y=61
W=16
H=16
Hidden=1
Group=ALARMSET

[AlarmSetText]
Meter=STRING
MeterStyle=Style2
FontSize=#FS3#
Text=SET ALARM
X=18r
Y=3r
Hidden=1
Group=ALARMSET

The trouble is that I had it working, well it still works, but there is now something that I removed that is causing an error.

If I turn the alarm On then Off the MouseScrollActions don't work as they should. So scrolling over the Hour or Minutes doesn't cycle from 23 to 1 or from 59 to 1.

Scrolling the Hour makes it keep counting up past 23 or below 0 to minus numbers instead of 22, 23, 0 or 2, 1, 0, 23. Minutes does the same, it keeps counting up past 60 or below 0 to -1, -2, etc.

Can someone please point out what I've removed or changed that is causing the issue as I just don't see it.

Here's the New version:

Code: Select all

[Rainmeter]
Update=1000

[Metadata]
Name=Alarm Clock

;--------------------------------------------------
;--- VARIABLES & STYLES ---------------------------
;--------------------------------------------------

[Variables]
;SoundPath1=#@#sounds\chimehour.wav
;SoundPath2=#@#sounds\alarmclock.wav
AlarmHourSet=23
AlarmMinuteSet=0

[sAllText]
FontColor=128,255,0,100
FontFace=Corbel
FontSize=14
StringAlign=LEFT
StringStyle=Bold
AntiAlias=1

;--------------------------------------------------
;--- MEASURES -------------------------------------
;--------------------------------------------------

;--- MEASURES CLOCK, CHIMESOUND & ALARM -----------

[mTime]
Measure=Time
Format=%#I:%M %S

[mMinMaxHourAlarm]
measure=calc
formula=#AlarmHourSet#
DynamicVariables=1
ifconditionmode=1
IfCondition=(#AlarmHourSet# < 0)
IfTrueAction=[!SetVariable AlarmHourSet "23"]
IfCondition2=(#AlarmHourSet# >= 24)
IfTrueAction2=[!SetVariable AlarmHourSet "0"]
RegExpSubstitute=1
Substitute="^(\d$)":"0\1"
Group=mALARM | ALARM

[mMinMaxMinuteAlarm]
measure=calc
formula=#AlarmMinuteSet#
DynamicVariables=1
ifconditionmode=1
IfCondition=(#AlarmMinuteSet# < 0)
IfTrueAction=[!SetVariable AlarmMinuteSet "59"]
IfCondition2=(#AlarmMinuteSet# >= 60)
IfTrueAction2=[!SetVariable AlarmMinuteSet "0"]
RegExpSubstitute=1
Substitute="^(\d$)":"0\1"
Group=mALARM | ALARM

[mDigitPrefixerAlarm]
Measure=calc
Formula=00
Dynamicvariables=1
IfCondition=(#AlarmHourSet# >= 0) && (#AlarmHourSet# <= 9)
IfTrueAction=[!SetOption HourAlarm Prefix "0"]
IfFalseAction=[!SetOption HourAlarm Prefix ""]
IfCondition2=(#AlarmMinuteSet# >= 0) && (#AlarmMinuteSet# <= 9)
IfTrueAction2=[!SetOption MinuteAlarm Prefix "0"]
IfFalseAction2=[!SetOption MinuteAlarm Prefix ""]
Group=mALARM | ALARM

[mHourAlarm]
Measure=Time
Format=%H
Group=ALARM

[mMinuteAlarm]
Measure=Time
Format=%M
Group=ALARM

[Alarm]
Measure=calc
Formula=0
DynamicVariables=1
IfCondition=(mHourAlarm = #AlarmHourSet#) && (mMinuteAlarm = #AlarmMinuteSet#)
IfTrueAction=[PlayLoop #@#sounds\alarmclock.wav][!Redraw]
Group=ALARM

;--------------------------------------------------
;--- BACKGROUND -----------------------------------
;--------------------------------------------------

[Bg]
Meter=Shape
MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 128,255,0,255"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 128,255,0,100"][!UpdateMeter *][!Redraw]
Shape=Rectangle 1,1,200,70,5 | Fill Color 20,150,20,50 | StrokeWidth 2 | Extend StrokeAlpha
StrokeAlpha=Stroke Color 128,255,0,100
DynamicVariables=1

;--------------------------------------------------
;--- CLOCK, ALARM ---------------------------
;--------------------------------------------------

[Time]
Meter=String
MeasureName=mTime
MeterStyle=sAllText
FontSize=36
SolidColor=0,0,0,1
;MiddleMouseUpAction=[%windir%\system32\control.exe timedate.cpl]
InlineSetting=Size | 14
InlinePattern=.+:.+( .+)
; The InlinePattern is saying:
; . Any character, + one or more times, then ":" then . any character, + one or more times, then ( start capturing a space, then any . character, + one or more times, then ) stop capturing. Capturing the space with the seconds, also sets it to size 20 and not 50, which I think looks better.
X=5
Y=10

[sChime]
ImageAlpha=230
AntiAlias=1
ImageName=#@#images\Chime_off.png
Hidden=1
W=16
H=16

[mChimeHour]
Measure=Time
Format=%M
IfEqualValue=0
IfEqualAction=[Play "#@#sounds\chimehour.wav"]

[ChimeOFF]
Meter=Image
MeterStyle=sChime
X=175
Y=-34R
ToolTipText="ChimeSound is OFF"

[ChimeALARM]
Meter=Image
MeterStyle=sChime
X=r
Y=r
ToolTipText="Disabled in Alarm Mode"

======================================================
[AlarmSet]
Meter=Shape
Shape=Rectangle 0,0,70,25,5 | Fill Color 20,150,20,30 | StrokeWidth 2 | Extend StrokeAlpha
StrokeAlpha=Stroke Color 128,255,0,0
DynamicVariables=1
ToolTipText="L - Alarm Off#CRLF#M - Toggle Chime#CRLF#R - Alarm On"
LeftMouseUpAction=[!SetOption AlarmSet StrokeAlpha "Stroke Color 128,255,0,0"][!DisableMeasureGroup ALARM][!EnableMeasure mChimeHour][!HideMeter ChimeALARM][PlayStop "#SoundPath2#"][!Update]
MiddleMouseUpAction=[!ToggleMeasure mChimeHour][!ToggleMeter ChimeOFF][!Redraw]
RightMouseUpAction=[!SetOption AlarmSet StrokeAlpha "Stroke Color 128,255,0,100"][!EnableMeasureGroup ALARM][!DisableMeasure mChimeHour][!ShowMeterGroup ALARMSET][!HideMeter ChimeOFF][!ShowMeter ChimeALARM][!Update]
X=125
Y=8

[HourAlarm]
Meter=String
MeterStyle=sAllText | AlarmSet
Text="#AlarmHourSet#:"
DynamicVariables=1
X=8r
Y=-2r
MouseScrollUpAction=[!SetVariable AlarmHourSet (#AlarmHourSet#+1)][!UpdateMeasureGroup mALARM][!UpdateMeter HourAlarm][!Redraw]
MouseScrollDownAction=[!SetVariable AlarmHourSet (#AlarmHourSet#-1)][!UpdateMeasureGroup mALARM][!UpdateMeter HourAlarm][!Redraw]

[MinuteAlarm]
Meter=String
MeterStyle=sAllText | AlarmSet
Text="#AlarmMinuteSet#"
DynamicVariables=1
X=-4R
Y=r
MouseScrollUpAction=[!SetVariable AlarmMinuteSet (#AlarmMinuteSet#+1)][!UpdateMeasureGroup mALARM][!UpdateMeter MinuteAlarm][!Redraw]
MouseScrollDownAction=[!SetVariable AlarmMinuteSet (#AlarmMinuteSet#-1)][!UpdateMeasureGroup mALARM][!UpdateMeter MinuteAlarm][!Redraw]
Thank you.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 3645
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Alarm clock Adjustment not working properly

eclectic-tech » November 1st, 2019, 2:46 am

The alarm set works fine if you have the alarm "on"., but not if you have it "off".

You have the alarm set measures (they have "IfConditions" that correct hours and minutes values) in 2 groups "mAlarm" and "Alarm", but you disable them to disable the alarm... With those measures disabled, the scroll addition/subtraction is never checked, so the value of the hours and minutes keep on adding upward or subtracting downward.

You need to either keep those measures active and find a different way to disable the alarm or use a different method to set the alarm times.
Rather than use IfConditions in those measures, just use CLAMP in the mouse scroll actions to clamp the values:

Code: Select all

...
[HourAlarm]
Meter=String
MeterStyle=sAllText | AlarmSet
Text="#AlarmHourSet#:"
DynamicVariables=1
X=8r
Y=-2r
MouseScrollUpAction=[!SetVariable AlarmHourSet (Clamp(#AlarmHourSet#+1,0,23))][!UpdateMeasureGroup mALARM][!UpdateMeter HourAlarm][!Redraw]
MouseScrollDownAction=[!SetVariable AlarmHourSet (Clamp(#AlarmHourSet#-1,0,23))][!UpdateMeasureGroup mALARM][!UpdateMeter HourAlarm][!Redraw]

[MinuteAlarm]
Meter=String
MeterStyle=sAllText | AlarmSet
Text="#AlarmMinuteSet#"
DynamicVariables=1
X=-4R
Y=r
MouseScrollUpAction=[!SetVariable AlarmMinuteSet (Clamp(#AlarmMinuteSet#+1,0,59))][!UpdateMeasureGroup mALARM][!UpdateMeter MinuteAlarm][!Redraw]
MouseScrollDownAction=[!SetVariable AlarmMinuteSet (Clamp(#AlarmMinuteSet#-1,0,59))][!UpdateMeasureGroup mALARM][!UpdateMeter MinuteAlarm][!Redraw]

...
This method eliminates the "rollover" from "highest to lowest" and "lowest to highest" values, but completely removes the need for the IfCondition in those measures to correct the values.
User avatar
sl23
Posts: 408
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Alarm clock Adjustment not working properly

sl23 » November 1st, 2019, 7:58 am

Thanks for the help. I'll take a look this evening.
So this issue must've been present before but as the meter was hidden it wasn't an issue? Ah makes sense now. Brill! Thank you again buddy :thumbup:
User avatar
sl23
Posts: 408
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Alarm clock Adjustment not working properly

sl23 » November 2nd, 2019, 12:20 am

Well, it worked, thanks. But I'm puzzled on the new behaviour!
I exchanged my original code for yours above and commented out three Measures:
[mMinMaxHourAlarm]
[mMinMaxMinuteAlarm]
[mDigitPrefixerAlarm]

What I don't understand is why the last one is required to have the '0' Prefix?
I mean, when measuring the Time this isn't usually required, so why is it now?
If I set the Alarm to 12.00 midnight, it shows 0:0 instead of 00:00.
I can enable the last measure to solve the problem, but I don't understand why this is needed when it isn't on any other clock skins I have created.

Could you explain please. Thanks.
User avatar
FreeRaider
Posts: 789
Joined: November 20th, 2012, 11:58 pm

Re: Alarm clock Adjustment not working properly

FreeRaider » November 2nd, 2019, 7:12 am

sl23 wrote:
November 2nd, 2019, 12:20 am
Well, it worked, thanks. But I'm puzzled on the new behaviour!
I exchanged my original code for yours above and commented out three Measures:
[mMinMaxHourAlarm]
[mMinMaxMinuteAlarm]
[mDigitPrefixerAlarm]

What I don't understand is why the last one is required to have the '0' Prefix?
I mean, when measuring the Time this isn't usually required, so why is it now?
If I set the Alarm to 12.00 midnight, it shows 0:0 instead of 00:00.
I can enable the last measure to solve the problem, but I don't understand why this is needed when it isn't on any other clock skins I have created.

Could you explain please. Thanks.
At first look, I see a use of the RegExpSubstitute option and the use of the # modifier in %#I.
User avatar
sl23
Posts: 408
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Alarm clock Adjustment not working properly

sl23 » November 2nd, 2019, 11:50 am

Thanks FreeRaider, but the RegEx Substitute is no longer used and the # is only for the hour. I did try to remove this but it made no difference.

I just don't get why the Alarm time is doing this.

I also tried to edit eclectic-tech's MouseScrollActions to use two zero's at the start but although it starts ok, as soon as you scroll off '00' it reverts to single figures:

Code: Select all

MouseScrollUpAction=[!SetVariable AlarmHourSet (Clamp(#AlarmHourSet#+1,00,23))][!UpdateMeasureGroup mALARM][!UpdateMeter HourAlarm][!Redraw]
MouseScrollDownAction=[!SetVariable AlarmHourSet (Clamp(#AlarmHourSet#-1,00,23))][!UpdateMeasureGroup mALARM][!UpdateMeter HourAlarm][!Redraw]

MouseScrollUpAction=[!SetVariable AlarmMinuteSet (Clamp(#AlarmMinuteSet#+1,00,59))][!UpdateMeasureGroup mALARM][!UpdateMeter MinuteAlarm][!Redraw]
MouseScrollDownAction=[!SetVariable AlarmMinuteSet (Clamp(#AlarmMinuteSet#-1,00,59))][!UpdateMeasureGroup mALARM][!UpdateMeter MinuteAlarm][!Redraw]
User avatar
jsmorley
Developer
Posts: 19870
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Alarm clock Adjustment not working properly

jsmorley » November 2nd, 2019, 11:59 am

I have not looked at this code, and will leave others to do so, but in general...

There is no such number as 00. That just isn't a valid number. It's just zero. You are welcome to use it in a Calc measure or other formula, it's not an error as such, but it just equals zero. The effect and result will be 0.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeasureHour]
Measure=Calc
Formula=00

[MeterHour]
Meter=String
MeasureName=MeasureHour
FontSize=20
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1

1.jpg


To be clear, the numeric value of that Calc measure is 0, and the string value of the measure is "0". Leading zeros just don't exist in the world of math.

If you want to have the numeric value zero displayed as 00, you will need to use a RegExpsubstitute and display the modified string value.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeasureHour]
Measure=Calc
Formula=00
RegExpSubstitute=1
Substitute="^(\d)$":"0\1"

[MeterHour]
Meter=String
MeasureName=MeasureHour
FontSize=20
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1

2.jpg


Note that there is also no such "number" as 08. That is just eight...

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]

[MeasureHour]
Measure=Calc
Formula=08
RegExpSubstitute=1
Substitute="^(\d)$":"0\1"

[MeterHour]
Meter=String
MeasureName=MeasureHour
FontSize=20
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1

3.jpg


A Time measure is a different animal altogether. It has nothing to do with "numbers", and is always a string, which you control with the Format option. The %codes in a Time measure by default are formatted with leading zeros, as time is generally expressed as HH:MM:SS, but you can remove the leading zero from them with %#code. The # character in time codes means "remove any leading zeros".
You do not have the required permissions to view the files attached to this post.
User avatar
sl23
Posts: 408
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Alarm clock Adjustment not working properly

sl23 » November 2nd, 2019, 12:44 pm

Thanks for explaining.

How does my current measure for HourAlarm measure the Time %H but not adjust with the actual time and instead displays a static number? That's what has caused confusion. It says it's monitoring the hour from...

Code: Select all

[mHourAlarm]
Measure=Time
Format=%H
Group=ALARM
But the display doesn't adjust as if a normal time would.
Does it matter what these numbers measure? Probably not I think.
User avatar
jsmorley
Developer
Posts: 19870
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Alarm clock Adjustment not working properly

jsmorley » November 2nd, 2019, 12:55 pm

sl23 wrote:
November 2nd, 2019, 12:44 pm
Thanks for explaining.

How does my current measure for HourAlarm measure the Time %H but not adjust with the actual time and instead displays a static number? That's what has caused confusion. It says it's monitoring the hour from...

Code: Select all

[mHourAlarm]
Measure=Time
Format=%H
Group=ALARM
But the display doesn't adjust as if a normal time would.
Does it matter what these numbers measure? Probably not I think.
I guess I don't understand. That measure above will return the current hour in the format 00-23, and will not be "static".

Post all of your current code.
User avatar
sl23
Posts: 408
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Alarm clock Adjustment not working properly

sl23 » November 2nd, 2019, 1:38 pm

It's ok, I figured out the reason for the use of that measure. It's used by measuring H and M then if a Variable is equal then it sets alarm off.

Code: Select all

IfCondition=(mHourAlarm = #AlarmHourSet#) && (mMinuteAlarm = #AlarmMinuteSet#)
Thanks anyway for the offer.