It is currently March 29th, 2024, 12:21 pm

Countdown timers on the hour

Get help with creating, editing & fixing problems with skins
vvs
Posts: 13
Joined: March 8th, 2018, 2:28 am

Re: Countdown timers on the hour

Post by vvs »

jsmorley wrote:Maybe something like this:

Code: Select all

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

[Variables]

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

[MeasureStartTime]
Measure=Time
Group=Timer
Format=%#I:%M:%S %p
UpdateDivider=-1

[MeasureStartDate]
Measure=Time
Group=Timer
Format=%A, %B %#d, %Y
UpdateDivider=-1

[MeasureStartHour]
Measure=Time
Group=Timer
Format=%#H
UpdateDivider=-1

[MeasureEndHour]
Measure=Calc
Formula=MeasureStartHour + 1

[MeasureEndTime]
Measure=Time
Group=Timer
TimeStamp=[MeasureStartDate] [MeasureEndHour]:00:00
TimeStampFormat=%A, %B %#d, %Y %#H:%M:%S
DynamicVariables=1
UpdateDivider=-1

[MeasureElapsedMinutes]
Measure=Calc
Formula=Round(([MeasureCurrentTime:Timestamp]-[MeasureStartTime:TimeStamp])/60)
DynamicVariables=1

[MeasureRemainingMinutes]
Measure=Calc
Formula=Abs(Round(([MeasureEndTime:Timestamp]-[MeasureStartTime:TimeStamp])/60))
DynamicVariables=1
IfCondition=MeasureRemainingMinutes < 11
IfTrueAction=[!SetOption MeterRemainingTimeText FontColor "255,68,68,255"][!SetOption MeterRemainingTimeText FontWeight "600"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterRemainingTimeText FontColor "255,255,255,255"][!SetOption MeterRemainingTimeText FontWeight "400"][!UpdateMeter *][!Redraw]

[MeterBack]
Meter=Image
W=200
H=175
SolidColor=47,47,47,255

[MeterStartButton]
Meter=String
X=10
Y=10
FontSize=13
FontWeight=400
FontColor=255,255,255,255
SolidColor=90,90,90,255
Padding=5,5,5,5
AntiAlias=1
Text=Start Session 1
LeftMouseUpAction=[!UpdateMeasureGroup Timer][!ShowMeterGroup Timer]

[MeterCurrentTimeText]
Meter=String
X=10
Y=10R
W=170
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=Current:

[MeterCurrentTime]
Meter=String
MeasureName=MeasureCurrentTime
X=190
Y=0r
StringAlign=Right
FontSize=11
FontWeight=600
FontColor=255,255,255,255
Padding=5,5,5,5
AntiAlias=1
Text=%1

[MeterTimeStartedText]
Meter=String
X=10
Y=80
W=170
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=Started:

[MeterTimeStarted]
Meter=String
Group=Timer
MeasureName=MeasureStartTime
X=190
Y=0r
StringAlign=Right
FontSize=11
FontWeight=600
FontColor=255,255,255,255
Padding=5,5,5,5
AntiAlias=1
Hidden=1
Text=%1

[MeterElapsedTimeText]
Meter=String
X=10
Y=110
W=170
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=Elapsed:

[MeterElapsedTime]
Meter=String
Group=Timer
MeasureName=MeasureElapsedMinutes
X=190
Y=0r
StringAlign=Right
FontSize=11
FontWeight=600
FontColor=255,255,255,255
Padding=5,5,5,5
AntiAlias=1
Hidden=1
Text=%1

[MeterRemainingTimeText]
Meter=String
X=10
Y=140
W=170
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=Remaining:

[MeterRemainingTime]
Meter=String
Group=Timer
MeasureName=MeasureRemainingMinutes
X=190
Y=0r
StringAlign=Right
FontSize=11
FontWeight=600
FontColor=255,255,255,255
Padding=5,5,5,5
AntiAlias=1
Hidden=1
Text=%1
1.png

I don't even want to know what is going on in these rooms that you rent by the hour... ;-)
Haha I realized how ominous my description sounded. I work for a indoor golf facility, they load up the simulator on a windows system. :rosegift:
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Countdown timers on the hour

Post by jsmorley »

The tricky bit with this skin is that what he wants is the remaining time from the "start" time until the top of the next hour. My skin does this, and adds the elapsed time from the start time just for fun.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Countdown timers on the hour

Post by jsmorley »

So my thinking on this is that you could create subfolders under the skin folder called "Session1" "Session 2" "Session 3" ... "Session 50" etc, and put copies of this skin in those. Then you can load more than one instance of the skin assuming you have multiple sessions you want to track.

I have to say, this is a bit of a weird business model. No matter what time during any given hour the customer starts, their time runs out at the top of the next hour. Not sure that sounds like a recipe for happy customers, but I'm sure I'm missing something.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Countdown timers on the hour

Post by jsmorley »

One mistake in my skin...

Change the formula in [MeasureRemainingMinutes] to:

Formula=Abs(Round(([MeasureEndTime:Timestamp]-[MeasureCurrentTime:TimeStamp])/60))
vvs
Posts: 13
Joined: March 8th, 2018, 2:28 am

Re: Countdown timers on the hour

Post by vvs »

jsmorley wrote: I have to say, this is a bit of a weird business model. No matter what time during any given hour the customer starts, their time runs out at the top of the next hour. Not sure that sounds like a recipe for happy customers, but I'm sure I'm missing something.
It is just when people don't arrive on time so we cant extend their time when there is a group behind them
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Countdown timers on the hour

Post by jsmorley »

vvs wrote:It is just when people don't arrive on time so we cant extend their time when there is a group behind them
Ok, in any case I didn't do anything special with cosmetics or any fancy alarm bells or things that shake and bounce when the time is at any particular point, but you can tear this apart to see how I am arriving at the values, and then use them any way you like. Hopefully this will get you started. The elapsed time is simply the distance from the current time to the start time, and the remaining time is the distance from the current time to the top of the next hour.

The timer can be reset by simply refreshing the skin, or you could add a little refresh image that simply does [!Refresh] when clicked.
vvs
Posts: 13
Joined: March 8th, 2018, 2:28 am

Re: Countdown timers on the hour

Post by vvs »

balala wrote:vvs, first please take a look at one of my old packages. It has a Countdown skin. Please check it to see if it matches your needs and let me know if it doesn't, to can modify it accordingly.
Here it is: https://forum.rainmeter.net/viewtopic.php?p=74805#p74805
So I took a look, and I need a few more things from it:

-I need 4 different countdowns/buttons to press; 1hr, 2hr, 3hr, 4hr.

-When the (hidden) countdown is 10 minutes from expiring, I would like a pop up message and then a countdown overlay that appears, non-intrusively, just off in the corner.

-I need the countdown to be relative to the hour and not set from the time the button is pressed, i.e; 1hr session at 4:02 ends at 5:00 and not 5:02. (it looks like JSmorley provided that variable elsewhere in the thread)

Let me know if you think you can help, I know I'm asking to be spoon fed but that's why I'm offering some $ for the time
vvs
Posts: 13
Joined: March 8th, 2018, 2:28 am

Re: Countdown timers on the hour

Post by vvs »

jsmorley wrote:Ok, in any case I didn't do anything special with cosmetics or any fancy alarm bells or things that shake and bounce when the time is at any particular point, but you can tear this apart to see how I am arriving at the values, and then use them any way you like. Hopefully this will get you started. The elapsed time is simply the distance from the current time to the start time, and the remaining time is the distance from the current time to the top of the next hour.

The timer can be reset by simply refreshing the skin, or you could add a little refresh image that simply does [!Refresh] when clicked.

I'm confused by the condition for the remaining minutes; Ifcondition=Measure RemainingMinutes <11.
What is that actually telling it to do? It works relative to the hour which is amazing but I'm trying to figure it out to make it so I can have one session for 1hr another for 2hr, etc. that wont continue past the time allotted for that button and instead bring a pop up message and a timer to appear for 10 minute countdown. As it is, it just keeps counting.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Countdown timers on the hour

Post by jsmorley »

That IfCondition is simply looking at the number of "remaining minutes", and taking some action if the value falls to 10 or below. In my example, I just turn the text red and bold it. You can of course have it do anything you want.

As to having the ability to set it for 1 - 4 hours, take a look at this:

Code: Select all

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

[Variables]
HoursLen=1

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

[MeasureStartTime]
Measure=Time
Group=Timer
Format=%#I:%M:%S %p
UpdateDivider=-1

[MeasureStartDate]
Measure=Time
Group=Timer
Format=%A, %B %#d, %Y
UpdateDivider=-1

[MeasureStartHour]
Measure=Time
Group=Timer
Format=%#H
UpdateDivider=-1

[MeasureEndHour]
Measure=Calc
Group=Timer
Formula=MeasureStartHour + #HoursLen#
DynamicVariables=1

[MeasureEndTime]
Measure=Time
Group=Timer
TimeStamp=[MeasureStartDate] [MeasureEndHour]:00:00
TimeStampFormat=%A, %B %#d, %Y %#H:%M:%S
Format=%#I:%M:%S %p
DynamicVariables=1
UpdateDivider=-1

[MeasureRemainingMinutes]
Measure=Calc
Formula=Abs(Ceil(([MeasureEndTime:Timestamp]-[MeasureCurrentTime:TimeStamp])/60))
DynamicVariables=1
IfCondition=MeasureRemainingMinutes < 11
IfTrueAction=[!SetOption MeterRemainingTimeText FontColor "255,68,68,255"][!SetOption MeterRemainingTimeText FontWeight "600"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetOption MeterRemainingTimeText FontColor "255,255,255,255"][!SetOption MeterRemainingTimeText FontWeight "400"][!UpdateMeter *][!Redraw]
IfCondition2=MeasureRemainingMinutes < 1
IfTrueAction2=[!SetOption MeterRemainingTimeText FontColor "255,68,68,255"][!SetOption MeterRemainingTimeText FontWeight "600"][!SetOption MeterRemainingTimeText Text "Completed"][!UpdateMeter *][!Redraw]

[MeterBack]
Meter=Image
W=250
H=175
SolidColor=47,47,47,255

[MeterSessionLabel]
Meter=String
X=10
Y=10
FontSize=13
FontWeight=400
FontColor=255,255,255,255
SolidColor=90,90,90,255
Padding=5,5,5,5
AntiAlias=1
Text=Session 1

[Meter1Hour]
Meter=String
X=102
Y=12
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=1Hr
LeftMouseUpAction=[!SetVariable HoursLen "1"][!UpdateMeasureGroup Timer][!ShowMeterGroup Timer]

[Meter2Hour]
Meter=String
X=3R
Y=12
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=2Hr
LeftMouseUpAction=[!SetVariable HoursLen "2"][!UpdateMeasureGroup Timer][!ShowMeterGroup Timer]

[Meter3Hour]
Meter=String
X=3R
Y=12
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=3Hr
LeftMouseUpAction=[!SetVariable HoursLen "3"][!UpdateMeasureGroup Timer][!ShowMeterGroup Timer]

[Meter4Hour]
Meter=String
X=3R
Y=12
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=4Hr
LeftMouseUpAction=[!SetVariable HoursLen "4"][!UpdateMeasureGroup Timer][!ShowMeterGroup Timer]

[MeterCurrentTimeText]
Meter=String
X=10
Y=10R
W=222
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=Current:

[MeterCurrentTime]
Meter=String
MeasureName=MeasureCurrentTime
X=240
Y=0r
StringAlign=Right
FontSize=11
FontWeight=600
FontColor=255,255,255,255
Padding=5,5,5,5
AntiAlias=1
Text=%1

[MeterTimeStartedText]
Meter=String
X=10
Y=80
W=222
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=Started:

[MeterTimeStarted]
Meter=String
Group=Timer
MeasureName=MeasureStartTime
X=240
Y=0r
StringAlign=Right
FontSize=11
FontWeight=600
FontColor=255,255,255,255
Padding=5,5,5,5
AntiAlias=1
Hidden=1
Text=%1

[MeterEndTimeText]
Meter=String
X=10
Y=110
W=222
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=Ending:

[MeterEndTime]
Meter=String
Group=Timer
MeasureName=MeasureEndTime
X=240
Y=0r
StringAlign=Right
FontSize=11
FontWeight=600
FontColor=255,255,255,255
Padding=5,5,5,5
AntiAlias=1
Hidden=1
Text=%1

[MeterRemainingTimeText]
Meter=String
X=10
Y=140
W=222
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,255
Padding=5,5,5,5
AntiAlias=1
Text=Remaining:

[MeterRemainingTime]
Meter=String
Group=Timer
MeasureName=MeasureRemainingMinutes
X=240
Y=0r
StringAlign=Right
FontSize=11
FontWeight=600
FontColor=255,255,255,255
Padding=5,5,5,5
AntiAlias=1
Hidden=1
Text=%1
1.png
2.png
This will change to "Completed" and stop counting when 0 remaining time is left.

https://docs.rainmeter.net/manual/measures/time/
https://docs.rainmeter.net/manual/measures/general-options/#UpdateDivider
https://docs.rainmeter.net/manual/mouse-actions/#LeftMouseUpAction
https://docs.rainmeter.net/manual/bangs/#UpdateMeasure
https://docs.rainmeter.net/manual/measures/general-options/ifconditions/
https://docs.rainmeter.net/manual/bangs/#SetOption
https://docs.rainmeter.net/manual/meters/string/
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Countdown timers on the hour

Post by eclectic-tech »

hourtimers.png
Nice examples jsmorley...
I'd post a 10 session package, but that would not help the OP learn anything about coding. :-(
Again, nice example! :thumbup:
You do not have the required permissions to view the files attached to this post.