It is currently May 19th, 2024, 4:58 pm

Simple countdown timer

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7286
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

sl23 wrote: August 2nd, 2021, 6:37 pm Apologies if I've been a bit too demanding. :oops:

Oh so that was death.crafters code? I thought you wrote that? Well you've both been a massive help, can't thank you enough.

Out of curiosity, what's wrong with my edits? :oops:
Oh, no, it's not about being demanding, it's about having the feeling (just a feeling, nothing more) that you sort of "lean back" towards a "skin shuffling" mode, where a certain order / clarity is just a bit lacking when editing stuff. That being said, I liked that you knew where to put things now when combining the codes, with minimal hints. I could be at fault with this as I probably expect too much too soon, but other than that it's clear that you are progressing. ;-)

Yeah, well, the initial code was mine here (intentionally kept basic as to be better understood and not "throw you off" again), then death.crafter added some much needed things and corrected others here and later on, and then you added some stuff inspired by balala / jsmorley in the post I linked earlier and so on. Let's say it was a collaborative effort. :D

Can't remember exactly, but I spotted some redundancies and / or mistakes when previously looking at it. They don't produce an adverse effect now, but they might later on. Plus, combining this with yet another clock skin that you mentioned could be ... let's say, interesting. Or, I was just mistaken and the whole thing was just fine. :confused:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7286
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

death.crafter wrote: August 2nd, 2021, 7:48 pm
  • Now the hours, minutes and seconds will scroll infinitely.
  • Look at the action buttons to see how you can use MeterStyle and CURENTSECTION more efficiently.
  • The buttons' position and hide show pattern is a little changed.
If you are trying this out, keep your original config. In case you don't like it.
Nice! One thing I noticed though: the seconds have a bit of trouble to scroll in this code. Maybe the change in positioning made some stuff overlap?
Don't know if the OP is placing other things under the timer text (now that the previous buttons are gone), otherwise its position could probably be set lower. When I wrote my code, I had no idea where to place that text, so I just tried to make it lok similar with the previous code, which is now more or less obsolete.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1150
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

death.crafter wrote: August 2nd, 2021, 7:48 pm
  • Now the hours, minutes and seconds will scroll infinitely.
  • Look at the action buttons to see how you can use MeterStyle and CURENTSECTION more efficiently.
  • The buttons' position and hide show pattern is a little changed.
If you are trying this out, keep your original config. In case you don't like it.
  • Marvellous! :D
  • Great. I looked at that before but didn't think I could do that for some reason.
  • Nicely done. I had just changed the Set/Ok sections to disable and enable the scrolling too ;)
- MuLab -
User avatar
sl23
Posts: 1150
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Seconds are scrolling up but going down and scroll down doesn't work.

Code: Select all

[Seconds]
MouseScrollUpAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultSeconds]=0 ? 59 : [#DefaultSeconds]+1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
This [#DefaultSeconds]+1 had a minus instead of a plus. Now it goes up but not down. :D

Also, scrolling Hours down from 1 goes to 100 not 00.

EDIT: Scroll seconds up to 1 minute. Notice the Minutes meter increases by 1. Then scroll the Minutes down to zero and the Hour increases by 1. Now scroll minutes down by 1 again and the hour goes back to zero.
- MuLab -
User avatar
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

Re: Simple countdown timer

Post by death.crafter »

sl23 wrote: August 2nd, 2021, 8:35 pm Also, scrolling Hours down from 1 goes to 100 not 00.

EDIT: Scroll seconds up to 1 minute. Notice the Minutes meter increases by 1. Then scroll the Minutes down to zero and the Hour increases by 1. Now scroll minutes down by 1 again and the hour goes back to zero.

Code: Select all

[Variables]
; Background's stroke colors (0 = mouse leave color, 1 = mouse hover color)
StrokeColor0=255,255,255,60
StrokeColor1=0,255,255,255
StrokeColorIndex=0

; The time at which the timer / stopwatch is set or reset, in seconds (>0 for a timer, 0 for a stopwatch)
DefaultSeconds=10
DefaultMinutes=30
DefaultHours=7

; Seconds left to pass (for a timer), or seconds passed (for a stopwatch)
Seconds=([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)

; The amount of seconds by which the timer / stopwatch changes (<0 for a timer, >0 for a stopwatch)
Direction=-1

; Temporarily set to 1 when the timer / stopwatch is reset so the OnChangeAction below doesn't alter the Seconds above
Reset=0

Color1=255,255,255,200
Color2=128,255,0
Color3=255,255,0

Alarm=Alarm.wav

APP1=Dolphin.exe
APP2=pcsx2.exe
APP3=rpcs3.exe
APP4=retroarch.exe
APP5=cemu.exe

Hibernate=rundll32.exe powrprof.dll,SetSuspendState
Shutdown=shutdown.exe -s -t 5 -f
Lock=rundll32.exe user32.dll, LockWorkStation
CloseApps=!CommandMeasure mClose Run
Off=0

Act=#CloseApps#

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!PauseMeasureGroup TimerGroup]

========================================
; MEASURES
========================================
[mTime]
Group=TimerGroup
Measure=Time
Format=%H:%M %S
OnChangeAction=[!SetVariable Seconds (#Seconds#+#Direction#*(1-#Reset#))]
DynamicVariables=1

[mUptime]
Group=TimerGroup
Measure=Uptime
SecondsValue=#Seconds#
Format="%3!02i!:%2!02i! %1!02i!"
MaxValue=([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)
IfCondition=(#CURRENTSECTION#<=0) && (Sgn(#Direction#)=-1)
IfTrueAction=[!PauseMeasureGroup TimerGroup][#Act#]
IfConditionMode=1
DynamicVariables=1

[mClose]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=taskkill /IM #APP1#;taskkill /IM #APP2#;taskkill /IM #APP3#;taskkill /IM #APP4#;taskkill /IM #APP5#

========================================
; STYLES
========================================
[sAllText]
FontFace=Aller
StringStyle=Bold
StringAlign=Left
FontSize=16
FontColor=#Color1#
FontWeight=650
StringEffect=Shadow
FontEffectColor=0,0,0,150
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1

[RoundlineStyle]
LineStart=14
LineLength=18
StartAngle=(Rad(270))
Antialias=1
Solid=1
X=160
Y=33

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "#Color2#"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor "#Color1#"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]

========================================
; Meters
========================================
[Bg]
Meter=Shape
Shape=Rectangle 1,1,220,65,5 | Fill Color 0,0,0,130 | StrokeWidth 2 | Stroke Color [#StrokeColor[#StrokeColorIndex]]
UpdateDivider=-1
MouseOverAction=[!SetVariable StrokeColorIndex (1-#StrokeColorIndex#)][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetVariable StrokeColorIndex (1-#StrokeColorIndex#)][!UpdateMeter #CURRENTSECTION#][!Redraw]
DynamicVariables=1

[UptimeText]
Meter=String
MeasureName=mUptime
MeterStyle=sAllText
Text=%1
InlineSetting=Size | 10
InlinePattern=^.*(\s.*)$
InlineSetting2=Weight | 800
InlinePattern2=^.*(\s.*)$
InlinePattern3=^$
InlineSetting3=Color | #Color2#
Group=Start
X=25
Y=20

[Hours]
Group=Setters
Hidden=1
Meter=Image
SolidColor=0,0,0,1
MouseOverAction=[!SetOption UptimeText InlinePattern3 "^(\d{2})"][!UpdateMeter UptimeText][!Redraw]
MouseLeaveAction=[!SetOption UptimeText InlinePattern3 "^$"][!UpdateMeter UptimeText][!Redraw]
MouseScrollUpAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultHours]=99 ? 0 : [#DefaultHours]+1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultHours]=0 ? 99 : [#DefaultHours]-1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
DynamicVariables=1
H=25
W=25
X=25
Y=25

[Minutes]
Meter=Image
MeterStyle=Hours
MouseOverAction=[!SetOption UptimeText InlinePattern3 "^.*:(\d{2})"][!UpdateMeter UptimeText][!Redraw]
MouseLeaveAction=[!SetOption UptimeText InlinePattern3 "^$"][!UpdateMeter UptimeText][!Redraw]
MouseScrollUpAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultMinutes]=59 ? 0 : [#DefaultMinutes]+1)][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultMinutes]=0 ? 59 : [#DefaultMinutes]-1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
X=5R

[Seconds]
Meter=Image
MeterStyle=Hours
MouseOverAction=[!SetOption UptimeText InlinePattern3 "^.*\s(\d{2})"][!UpdateMeter UptimeText][!Redraw]
MouseLeaveAction=[!SetOption UptimeText InlinePattern3 "^$"][!UpdateMeter UptimeText][!Redraw]
MouseScrollUpAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultSeconds]=59 ? 0 : [#DefaultSeconds]+1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultSeconds]=0 ? 59 : [#DefaultSeconds]-1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
H=22
X=4R
Y=28

[RoundBarBack]
Meter=RoundLine
MeterStyle=RoundlineStyle
LineColor=#StrokeColor0#
Group=Controls

[RoundBarFore]
Meter=RoundLine
MeterStyle=RoundlineStyle
LineColor=#StrokeColor1#
LineWidth=4
MeasureName=mUptime
Group=Controls

========================================
; Controls
========================================
[sControls]
FontFace=Segoe MDL2 Assets
FontSize=12
StringAlign=CenterCenter
X=160
Y=34

[Play]
Meter=String
MeterStyle=sAllText | sControls | sHighlight
Text=[\xE768]
LeftMouseUpAction=[!UnpauseMeasureGroup TimerGroup][!ToggleMeterGroup PlayPause][!SetOptionGroup Start FontColor "#Color3#"][!HideMeter Reset][!HideMeter Set][!Redraw]
Group=PlayPause | Start | Controls

[Pause]
Meter=String
MeterStyle=sAllText | sControls | sHighlight
Text=[\xE769]
LeftMouseUpAction=[!PauseMeasureGroup TimerGroup][!ToggleMeterGroup PlayPause][!SetOptionGroup Start FontColor "#Color1#"][!ShowMeter Reset][!ShowMeter Set][!Redraw]
Group=PlayPause | Start
Hidden=1

[Reset]
Meter=String
Group=Controls
MeterStyle=sAllText | sControls | sHighlight
Text=[\xE72C]
FontSize=11
LeftMouseUpAction=[!WriteKeyValue Variables DefaultSeconds [#DefaultSeconds]][!WriteKeyValue Variables DefaultMinutes [#DefaultMinutes]][!WriteKeyValue Variables DefaultHours [#DefaultHours]][!Refresh]
X=195
Y=25

[Set]
Meter=String
Group=Controls
MeterStyle=sAllText | sControls | sHighlight
Text=[\xE713]
FontSize=11
LeftMouseUpAction=[!HideMeterGroup Controls][!ShowMeterGroup Setters][!SetOptionGroup Button Hidden "0"] [!UpdateMeter *][!Redraw]
X=195
Y=45

[OK]
Meter=String
Group=Setters
MeterStyle=sAllText | sControls | sHighlight
Text=[\xE73E]
FontSize=11
LeftMouseUpAction=[!ShowMeterGroup Controls][!HideMeterGroup Setters][!SetOptionGroup Button Hidden "1"] [!UpdateMeter *][!Redraw][!WriteKeyValue Variables DefaultSeconds [#DefaultSeconds]][!WriteKeyValue Variables DefaultMinutes [#DefaultMinutes]][!WriteKeyValue Variables DefaultHours [#DefaultHours]]
Hidden=1
DynamicVariables=1
X=195
Y=34

========================================
; Buttons
========================================
[sButton]
Shape=Rectangle 0,0,10,10,50 | Extend FillAlpha | StrokeWidth 2 | Extend StrokeAlpha
FillAlpha=FillColor #StrokeColor0#
StrokeAlpha=StrokeColor 128,255,0,0
MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "StrokeColor 255,255,0,255"] [!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha ""] [!UpdateMeter *] [!Redraw] 
LeftMouseUpAction=[!SetOptionGroup Button FillAlpha "FillColor #StrokeColor0#"][!SetOption #CURRENTSECTION# FillAlpha "FillColor #Color2#"][!SetVariable Act "[#[#CURRENTSECTION]]"] [!UpdateMeter *][!Redraw]
ToolTipText=[#CURRENTSECTION]
DynamicVariables=1
Group=Button
Hidden=1
MouseActionCursor=0
UpdateDivider=-1
X=20r
Y=0r

[CloseApps]
Meter=Shape
MeterStyle=sButton
X=15
Y=12

[Hibernate]
Meter=Shape
MeterStyle=sButton

[Shutdown]
Meter=Shape
MeterStyle=sButton

[Lock]
Meter=Shape
MeterStyle=sButton

[Off]
Meter=Shape
MeterStyle=sButton
There was an extra bracket too. Any way, now values are written when you click the tick mark.
from the Realm of Death
User avatar
sl23
Posts: 1150
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

I did try looking for something odd, but couldn't find it. Thank you :thumbup:
- MuLab -
User avatar
sl23
Posts: 1150
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Well, I managed to combine the Timer code into my clock skin :D
It's not fantastic, but it works how I want it to.
I post it here only that others might find some use for the code.
Here's the final code...

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
OnRefreshAction=[!PauseMeasureGroup TimerGroup][!SetOption #ActionText# FillAlpha "FillColor #Color2#"]

[Metadata]
Name=Countdown Timer
Author=Yincognito, death.crafter, balala, eclectic-tech, jsmorley, Krzysztof "gronostaj" Smialek
Information=Originally written by Yincognito and death.crafter on the Rainmeter forum. But I added extra features and combined it with my own version of a skin design by Krzysztof "gronostaj" Smialek
Version=2021.8.3
License=CC BY 3.0

[Variables]
RClick=ms-settings:dateandtime
HourColour=255,100,100,255
MinuteColour=255,170,0,255
SecondsColour=128,255,0,255
TimerColor=100,100,200

ChimeSound=Calligraphy.wav
; ChimeSound disabled whilst these apps are running
Process1=VLC.exe
Process2=foobar2000.exe
Process3=MuLab.exe

; Background's stroke colors (0 = mouse leave color, 1 = mouse hover color)
StrokeColor0=255,255,255,60
StrokeColor1=0,255,255,255
StrokeColorIndex=0

; The time at which the timer / stopwatch is set or reset, in seconds (>0 for a timer, 0 for a stopwatch)
DefaultHours=2
DefaultMinutes=10
DefaultSeconds=0
; Seconds left to pass (for a timer), or seconds passed (for a stopwatch)
Seconds=([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)
; The amount of seconds by which the timer / stopwatch changes (<0 for a timer, >0 for a stopwatch)
Direction=-1
; Temporarily set to 1 when the timer / stopwatch is reset so the OnChangeAction below doesn't alter the Seconds above
Reset=0

Color1=255,255,255,200
Color2=128,255,0
Color3=255,255,0

Alarm=Alarm.wav

APP1=Dolphin.exe
APP2=pcsx2.exe
APP3=rpcs3.exe
APP4=retroarch.exe
APP5=cemu.exe

Alarm=Alarm.wav
AlarmHourSet=23
AlarmMinuteSet=0
;AlarmTime=7.05
;OffTime=7.15 - can delete-works ok

Hibernate=rundll32.exe powrprof.dll,SetSuspendState
Shutdown=shutdown.exe -s -t 5 -f
Lock=rundll32.exe user32.dll, LockWorkStation
CloseApps=!CommandMeasure mClose Run
Off=

Act=rundll32.exe user32.dll, LockWorkStation

ActionText=Off
Message1=10 mins until #ActionText# !!
Message2=#ActionText# Now !!

========================================
; Process
========================================
;[mProcessTimerStart]
;Measure=Calc
;Formula=1
;IfCondition=(mProcessRainmeter=1)
;IfTrueAction=[!EnableMeasureGroup Timers][!UpdateMeasureGroup Timers][!Redraw]
;IfFalseAction=[!DisableMeasureGroup Timers][!UpdateMeasureGroup Timers][!Redraw]
;
;[mProcessRainmeter]
;Measure=Plugin
;Plugin=Process
;ProcessName=Rainmeter.exe

========================================
; EMULATORS
========================================
[mProcessEmu]
Measure=Calc
Formula=1
IfCondition=(mProcessDolphin=1) || (mProcessPCSX2=1) || (mProcessRPCS3=1) || (mProcessN64=1) || (mProcessRetroArch=1) || (mProcessCemu=1)
IfTrueAction=[!ActivateConfig "RM\ScreenSaver" "ScreenSaver v2.ini"]
IfFalseAction=[!DeactivateConfig "RM\ScreenSaver" "ScreenSaver v2.ini"]

[mProcessDolphin]
Measure=Plugin
Plugin=Process
ProcessName=Dolphin.exe

[mProcessPCSX2]
Measure=Plugin
Plugin=Process
ProcessName=pcsx2.exe

[mProcessRPCS3]
Measure=Plugin
Plugin=Process
ProcessName=rpcs3.exe

[mProcessN64]
Measure=Plugin
Plugin=Process
ProcessName=Project64.exe

[mProcessRetroArch]
Measure=Plugin
Plugin=Process
ProcessName=retroarch.exe

[mProcessCemu]
Measure=Plugin
Plugin=Process
ProcessName=Cemu.exe

========================================
; Background
========================================
[Bg]
Meter=Shape
Shape=Rectangle 2,2,60,60,50 | Fill Color 0,0,0,150 | StrokeWidth 2 | Extend StrokeAlpha
Shape2=Rectangle 11,11,42,42,50 | Fill Color 0,0,0,1 | StrokeWidth 2 | Extend StrokeAlpha2
Shape3=Rectangle 7,7,50,50,50 | Fill Color 0,0,0,1 | StrokeWidth 10 | Stroke Color 255,255,255,20
StrokeAlpha=Stroke Color #StrokeColor0#
StrokeAlpha2=Stroke Color #StrokeColor0#

LeftMouseUpAction=[!EnableMeasure mChimeHour] [!ShowMeter ChimeIcon] [!SetOption Bg StrokeAlpha2 "Stroke Color #StrokeColor0#"] [!DisableMeasureGroup ALARM] [!HideMeterGroup AlarmSet][!SetOption Action Text "#ActionText#"] [PlayStop "#Alarm#"] [!Update][!UpdateMeter *][!Redraw]

RightMouseUpAction=[!DisableMeasure mChimeHour] [!HideMeter ChimeIcon] [!SetOption Bg StrokeAlpha2 "Stroke Color 128,255,0,200"] [!EnableMeasureGroup ALARM] [!ShowMeter HourAlarm] [!ShowMeter MinuteAlarm] [!Update][!UpdateMeter *][!Redraw]

MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 0,255,255,255"][!UpdateMeter *][!Redraw]

MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color #StrokeColor0#"][!UpdateMeter *][!Redraw]

DynamicVariables=1
ToolTipText="L - Alarm Off#CRLF#R - Alarm On"
Padding=5,5,10,5

[BgLine]
Meter=Shape
Shape=Rectangle 61,37,99,1,0 | Fill Color #StrokeColor0# | StrokeWidth 0
Shape2=Rectangle 160,0,30,60,15 | Fill Color 0,0,0,150 | StrokeWidth 2 | Stroke Color #StrokeColor0#
DynamicVariables=1
Padding=5,5,10,5

========================================
; STYLES
========================================
[sAllText]
FontFace=Trebuchet MS
StringStyle=Bold
StringAlign=Center
FontSize=16
FontColor=#Color1#
StringEffect=Shadow
FontEffectColor=0,0,0,150
AntiAlias=1
InlineSetting=Size | 8
InlinePattern=#CRLF#.+

FontFace=Aller
FontSize=16
FontWeight=650
StringEffect=Shadow
FontEffectColor=0,0,0,150
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1

[sRoundBar]
LineStart=22
LineLength=29
LineWidth=2
StartAngle=(Rad(270))
Antialias=1
Solid=0
X=160
Y=33

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "#Color2#"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor "#Color1#"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]

========================================
; Time
========================================
[mHour]
Measure=Time
Format=%#I
MinValue=0
MaxValue=12

[mMinutes]
Measure=Time
Format=%M
MinValue=0
MaxValue=60

[mSecond]
Measure=Time
Format=%S
MinValue=0
MaxValue=60

[mDate]
Measure=Time
Format=%a  %#d  %b

[TimerBar]
Meter=RoundLine
MeasureName=mUptime
MeterStyle=sRoundBar
LineColor=#TimerColor#
LineWidth=5
Group=Controls | Timer
Hidden=1
X=37
Y=37

[HoursBar]
Meter=Roundline
MeasureName=mHour
MeterStyle=sRoundBar
LineColor=#HourColour#
X=r
Y=r

[MinutesBar]
Meter=Roundline
MeasureName=mMinutes
MeterStyle=sRoundBar
LineColor=#MinuteColour#
X=r
Y=r

[SecondsBar]
Meter=Roundline
MeasureName=mSecond
MeterStyle=sRoundBar
LineColor=#SecondsColour#
X=r
Y=r

[Value]
Meter=String
MeasureName=mHour
MeasureName2=mMinutes
MeterStyle=sAllText | sHighlight
Text=%1:%2#CRLF#[mDate]
X=115
Y=19

========================================
; CHIME
========================================
[sChime]
AntiAlias=1
X=30
Y=28
W=16
H=16

[mChimeHour]
Measure=Time
Format=%M
IfEqualValue=0
IfEqualAction=[Play #ChimeSound#]

[ChimeIcon]
Meter=Image
MeterStyle=sChime
ImageName=icon.png
ImageAlpha=150

============================================
; Enable/Disable Chime on Process Start/Stop
============================================
[mProcessDisableChime]
Measure=Calc
Formula=1
IfCondition=(mProcess1=1) || (mProcess2=1) || (mProcess3=1)
IfTrueAction=[!DisableMeasure mChimeHour][!SetOption ChimeIcon ImageTint ""][!UpdateMeter *][!Redraw]
IfFalseAction=[!EnableMeasure mChimeHour][!SetOption ChimeIcon ImageTint "128,255,0"][!UpdateMeter *][!Redraw]

[mProcess1]
Measure=Plugin
Plugin=Process
ProcessName=#Process1#

[mProcess2]
Measure=Plugin
Plugin=Process
ProcessName=#Process2#

[mProcess3]
Measure=Plugin
Plugin=Process
ProcessName=#Process3#

========================================
; 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#-10)
IfTrueAction=[!SetOption Action Text "#Message1#"][Play #Alarm#][!Redraw]
IfCondition2=(mHourAlarm = #AlarmHourSet#) && (mMinuteAlarm = #AlarmMinuteSet#)
IfTrueAction2=[!SetOption Action Text "#Message2#"][#Act#][!Redraw]

[HourAlarm]
Meter=String
MeasureName=mHour
MeterStyle=sAllText | sHighlight
FontSize=9
Text=#AlarmHourSet#:
DynamicVariables=1
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]
Group=AlarmSet
Hidden=1
X=29
Y=30

[MinuteAlarm]
Meter=String
MeterStyle=sAllText | sHighlight
FontSize=9
Text=#AlarmMinuteSet#
DynamicVariables=1
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]
Group=AlarmSet
Hidden=1
X=-4R
Y=r

========================================
; Countdown
========================================
[mTime]
Group=TimerGroup
Measure=Time
Format=%H:%M %S
OnChangeAction=[!SetVariable Seconds (#Seconds#+#Direction#*(1-#Reset#))]
DynamicVariables=1

[mUptime]
Group=TimerGroup
Measure=Uptime
SecondsValue=#Seconds#
Format="%3!02i!:%2!02i! %1!02i!"
MaxValue=([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)
IfCondition=(#CURRENTSECTION#<=0) && (Sgn(#Direction#)=-1)
IfTrueAction=[!PauseMeasureGroup TimerGroup][#Act#][!SetOption Action Text "#Message2#"][Play "#Alarm#"][!Redraw]
IfCondition2=(#CURRENTSECTION#=600)
IfTrueAction2=[!SetOption Action Text "#Message1#"][Play "#Alarm#"][!Redraw]
IfConditionMode=1
DynamicVariables=1

[mClose]
Measure=Plugin
Plugin=RunCommand
Program=PowerShell
Parameter=taskkill /IM #APP1#;taskkill /IM #APP2#;taskkill /IM #APP3#;taskkill /IM #APP4#;taskkill /IM #APP5#

[UptimeText]
Meter=String
MeasureName=mUptime
MeterStyle=sAllText
FontSize=14
Text=%1
InlineSetting=Size | 10
InlinePattern=^.*(\s.*)$
InlineSetting2=Weight | 800
InlinePattern2=^.*(\s.*)$
InlinePattern3=^$
InlineSetting3=Color | #Color2#
Group=Start | Timer
Hidden=1
X=115
Y=55

[Hours]
Meter=Image
SolidColor=0,0,0,1
MouseOverAction=[!SetOption UptimeText InlinePattern3 "^(\d{2})"][!UpdateMeter UptimeText][!Redraw]
MouseLeaveAction=[!SetOption UptimeText InlinePattern3 "^$"][!UpdateMeter UptimeText][!Redraw]
MouseScrollUpAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultHours]=99 ? 0 : [#DefaultHours]+1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultHours]=0 ? 99 : [#DefaultHours]-1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
DynamicVariables=1
Hidden=1
Group=Setters
H=25
W=25
X=-40r
Y=r

[Minutes]
Meter=Image
MeterStyle=Hours
MouseOverAction=[!SetOption UptimeText InlinePattern3 "^.*:(\d{2})"][!UpdateMeter UptimeText][!Redraw]
MouseLeaveAction=[!SetOption UptimeText InlinePattern3 "^$"][!UpdateMeter UptimeText][!Redraw]
MouseScrollUpAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultMinutes]=59 ? 0 : [#DefaultMinutes]+1)][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultMinutes]=0 ? 59 : [#DefaultMinutes]-1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
X=7R

[Seconds]
Meter=Image
MeterStyle=Hours
MouseOverAction=[!SetOption UptimeText InlinePattern3 "^.*\s(\d{2})"][!UpdateMeter UptimeText][!Redraw]
MouseLeaveAction=[!SetOption UptimeText InlinePattern3 "^$"][!UpdateMeter UptimeText][!Redraw]
MouseScrollUpAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultSeconds]=59 ? 0 : [#DefaultSeconds]+1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable Default[#CURRENTSECTION] "([#DefaultSeconds]=0 ? 59 : [#DefaultSeconds]-1)"][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
H=22
X=4R
Y=50

========================================
; Controls
========================================
[sControls]
FontFace=Segoe MDL2 Assets
FontSize=12
StringAlign=CenterCenter
X=180
Y=16

[Play]
Meter=String
MeterStyle=sAllText | sControls | sHighlight
Text=[\xE768]
LeftMouseUpAction=[!UnpauseMeasureGroup TimerGroup][!ToggleMeterGroup PlayPause][!SetOptionGroup Start FontColor "#Color3#"][!HideMeter Reset][!HideMeter Set][!ShowMeterGroup Timer][!Redraw]
Group=PlayPause | Start | Controls

[Pause]
Meter=String
MeterStyle=sAllText | sControls | sHighlight
Text=[\xE769]
LeftMouseUpAction=[!PauseMeasureGroup TimerGroup][!ToggleMeterGroup PlayPause][!SetOptionGroup Start FontColor "#Color1#"][!ShowMeter Reset][!ShowMeter Set][PlayStop "#Alarm#"][!Redraw]
Group=PlayPause | Start
Hidden=1

[Reset]
Meter=String
MeterStyle=sAllText | sControls | sHighlight
Text=[\xE72C]
FontSize=11
LeftMouseUpAction=[!Refresh]
Group=Controls
Y=20r

[Set]
Meter=String
MeterStyle=sAllText | sControls | sHighlight
Text=[\xE713]
FontSize=11
LeftMouseUpAction=[!HideMeterGroup Controls][!ShowMeterGroup Setters][!SetOptionGroup Button Hidden "0"] [!UpdateMeter *][!Redraw]
Group=Controls
Y=20r

[OK]
Meter=String
MeterStyle=sAllText | sControls | sHighlight
Text=[\xE73E]
FontSize=11
LeftMouseUpAction=[!ShowMeterGroup Controls][!HideMeterGroup Setters][!SetOptionGroup Button Hidden "1"] [!UpdateMeter *][!WriteKeyValue Variables DefaultSeconds [#DefaultSeconds]][!WriteKeyValue Variables DefaultMinutes [#DefaultMinutes]][!WriteKeyValue Variables DefaultHours [#DefaultHours]][!Redraw][!Refresh]
Group=Setters
Hidden=1
Y=r

========================================
; Buttons
========================================
[sButton]
Shape=Rectangle 0,0,10,10,50 | Extend FillAlpha | StrokeWidth 2 | Extend StrokeAlpha
FillAlpha=FillColor #StrokeColor0#
StrokeAlpha=StrokeColor 128,255,0,0
MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "StrokeColor 255,255,0,255"] [!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha ""] [!UpdateMeter *] [!Redraw] 
LeftMouseUpAction=[!SetOptionGroup Button FillAlpha "FillColor #StrokeColor0#"][!SetOption #CURRENTSECTION# FillAlpha "FillColor #Color2#"][!WriteKeyValue Variables Act [##CURRENTSECTION#]] [!WriteKeyValue Variables ActionText [#CURRENTSECTION]] [!UpdateMeter *][!Redraw]
ToolTipText=[#CURRENTSECTION]
DynamicVariables=1
Group=Button
Hidden=1
MouseActionCursor=0
UpdateDivider=-1
X=20r
Y=0r

[CloseApps]
Meter=Shape
MeterStyle=sButton
X=70
Y=10

[Hibernate]
Meter=Shape
MeterStyle=sButton

[Shutdown]
Meter=Shape
MeterStyle=sButton

[Lock]
Meter=Shape
MeterStyle=sButton

[Off]
Meter=Shape
MeterStyle=sButton

========================================
; Message
========================================
[Action]
Meter=String
MeterStyle=sAllText
FontSize=9
FontColor=255,228,110,255
Text=#ActionText#
Group=Controls | Timer
Hidden=1
X=115
Y=7
EDIT: Oh, I forgot to do some cleaning up! And I plan to add ability to start timer whne certain processes are running, so not quite finished yet! Will update when done.
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7286
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

sl23 wrote: August 3rd, 2021, 12:17 pm Well, I managed to combine the Timer code into my clock skin :D
It's not fantastic, but it works how I want it to.
Whoa, I beg to disagree - it looks awesome. :great: :great: :great:
Didn't explore the whole functionality though (some possibilities to "cancel" after pressing to configure would be nice, although I guess that's what the "OFF" little disk does anyway), but visually it's superb, IMHO. Well done. :thumbup:

EDIT: No, the "OFF" disk logs off, just tried, by setting the alarm. Still think it would be nice to have it do "nothing", or some X button to cancel if pressing the configuration button by mistake.

Also, the time in the alarm is like 16:00, but the clock is showing 4:00. Better set the clock to show 16:00 as well, much more consistent...
Last edited by Yincognito on August 3rd, 2021, 1:03 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
death.crafter
Rainmeter Sage
Posts: 1398
Joined: April 24th, 2021, 8:13 pm

Re: Simple countdown timer

Post by death.crafter »

sl23 wrote: August 3rd, 2021, 12:17 pm Well, I managed to combine the Timer code into my clock skin :D
It's not fantastic, but it works how I want it to.
I post it here only that others might find some use for the code.
Here's the final code...

EDIT: Oh, I forgot to do some cleaning up! And I plan to add ability to start timer whne certain processes are running, so not quite finished yet! Will update when done.
For us to use the skin we need the images too :Whistle

So pack the skin up in a neat rmskin. Or a dirty zip. Whatever works.
Also I didn't consent being in the author's list. While I don't mind much, but I don't like being credited big time for someone else's work (since I just modified Yincognito's work here).
from the Realm of Death
User avatar
jsmorley
Developer
Posts: 22633
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Simple countdown timer

Post by jsmorley »

death.crafter wrote: August 3rd, 2021, 1:01 pm For us to use the skin we need the images too :Whistle

So pack the skin up in a neat rmskin. Or a dirty zip. Whatever works.
Also I didn't consent being in the author's list. While I don't mind much, but I don't like being credited big time for someone else's work (since I just modified Yincognito's work here).
One option for doing attribution / credits is:

Code: Select all

[Metadata]
Name=System
Author=JSMorley
Information=Description: System information||Instructions: Set Variables in @Resources\System.inc||Credits: Bob, John, Harold
Version=Aug 3, 2021
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0

1.jpg
You do not have the required permissions to view the files attached to this post.