Good to know the update is 1000 in Mirage's Timer.
Of course, if I share any skins from now on, I will credit everyone here, as mostly everyone here has helped in some way with most of my works.
I was just looking at Mirage again and thought about the MouseScrollActions too just before reading your reply above!
Sure, feel free to use the idea. Glad it helped spur you on.
May I request you add the ability to pause and resume the Mirage Countdown though. That was the only reason I didn't start with that skin.
Then I may tackle this again but start with the Mirage Timer, if that's ok with you?
Thank you to everyone who helped out here
Until the next time...
It is currently April 20th, 2024, 3:21 am
Simple countdown timer
-
- Posts: 1140
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
-
- Posts: 1140
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Simple countdown timer
Well, that didn't take long!
It seems there's one issue remaining, hopefully just the one!
This is the reason I changed from the original Action# Strings to the Button# Shapes.
Basically, a refresh makes #CloseApps# work fine. If I click any other Button#, again it works fine and Hibernates, Shutdown or Locks the PC, but click on Button1 to set the Variable back to #CloseApps# and it doesn't change. What this means is that whatever was clicked last, say, Button4 #Lock#, remains as the Variable when clicking Button1. Even though Button1 is clearly stated as #CloseApps#. WTF?
Here's the latest code:
EDIT:
Maybe it's to do with this?
Where these two Measures are doing similar things?
EDIT2:
Doesn't seem to be that, or removing #CloseApps# from the Variable: [Button1][!SetVariable Act ""]
It seems there's one issue remaining, hopefully just the one!
This is the reason I changed from the original Action# Strings to the Button# Shapes.
Basically, a refresh makes #CloseApps# work fine. If I click any other Button#, again it works fine and Hibernates, Shutdown or Locks the PC, but click on Button1 to set the Variable back to #CloseApps# and it doesn't change. What this means is that whatever was clicked last, say, Button4 #Lock#, remains as the Variable when clicking Button1. Even though Button1 is clearly stated as #CloseApps#. WTF?
Here's the latest code:
Maybe it's to do with this?
Code: Select all
[Button1]
LeftMouseUpAction=.... [!EnableMeasure mTimer3Act][!EnableMeasure mTimer4Alarm]
EDIT2:
Doesn't seem to be that, or removing #CloseApps# from the Variable: [Button1][!SetVariable Act ""]
- MuLab -
-
- Rainmeter Sage
- Posts: 7128
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Simple countdown timer
All you need for such a timer approach is something along these lines:
Code: Select all
[Variables]
; Visuals
Scale=1
ScaleRate=0.1
BackgroundW=220
BackgroundH=65
BackgroundCornerRadius=5
BackgroundColor=0,0,0,130
StrokeW=2
StrokeColor0=255,255,255,60
StrokeColor1=0,255,255,255
StrokeColorIndex=0
FontFace=Aller
FontColor=255,255,255,200
FontSize=16
StringEffect=Shadow
FontEffectColor=0,0,0,150
SolidColor=0,0,0,1
Padding=0
TimeAreaYFactor=0.30
TimeAreaWFactor=0.5
SecondsScale=0.625
; Functionals
DefaultSeconds=10
Seconds=#DefaultSeconds#
Direction=-1
Reset=0
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!PauseMeasureGroup TimerGroup]
---Measures---
[Time]
Group=TimerGroup
Measure=Time
Format=%H:%M %S
OnChangeAction=[!SetVariable Seconds (#Seconds#+#Direction#*(1-#Reset#))]
DynamicVariables=1
[Uptime]
Group=TimerGroup
Measure=Uptime
SecondsValue=#Seconds#
Format="%3!02i!:%2!02i! %1!02i!"
IfCondition=(#CURRENTSECTION#<=0) && (Sgn(#Direction#)=-1)
IfTrueAction=[!PauseMeasureGroup TimerGroup]
IfConditionMode=1
DynamicVariables=1
---Styles---
[TextStyle]
FontFace=#FontFace#
FontSize=(#FontSize#*#Scale#)
FontColor=#FontColor#
StringEffect=#StringEffect#
FontEffectColor=#FontEffectColor#
SolidColor=#SolidColor#
Padding=(#Padding#*#Scale#),(#Padding#*#Scale#),(#Padding#*#Scale#),(#Padding#*#Scale#)
AntiAlias=1
---Meters---
[Background]
Meter=Shape
Shape=Rectangle ((#StrokeW#/2)*#Scale#),((#StrokeW#/2)*#Scale#),(#BackgroundW#*#Scale#),(#BackgroundH#*#Scale#),(#BackgroundCornerRadius#*#Scale#) | Fill Color #BackgroundColor# | StrokeWidth (#StrokeW#*#Scale#) | Stroke Color [#StrokeColor[#StrokeColorIndex]]
UpdateDivider=-1
MouseOverAction=[!SetVariable StrokeColorIndex (1-#StrokeColorIndex#)][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetVariable StrokeColorIndex (1-#StrokeColorIndex#)][!UpdateMeter *][!Redraw]
MouseScrollUpAction=[!SetVariable Scale (Clamp(#Scale#+#ScaleRate#,#ScaleRate#,10))][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable Scale (Clamp(#Scale#-#ScaleRate#,#ScaleRate#,10))][!UpdateMeter *][!Redraw]
DynamicVariables=1
[UptimeText]
Meter=String
MeterStyle=TextStyle
X=(((#BackgroundW#*#TimeAreaWFactor#)/2)*#Scale#)
Y=((#BackgroundH#*#TimeAreaYFactor#)*#Scale#)
W=((#BackgroundW#*#TimeAreaWFactor#)*#Scale#)
FontWeight=700
StringAlign=Center
MeasureName=Uptime
Text=%1
InlineSetting=Size | ((#FontSize#*#SecondsScale#)*#Scale#)
InlinePattern=^.*( .*)$
LeftMouseUpAction=[!TogglePauseMeasureGroup TimerGroup]
MiddleMouseUpAction=[!SetVariable Seconds #DefaultSeconds#][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
DynamicVariables=1
P.S. Scrolling scales the "skin" instead of modifying the DefaultSeconds variable, but left click pauses / resumes the timer while middle click resets it. You control almost everything from [Variables], including the Direction, which basically turns the "timer" into a "stopwatch" if you set DefaultSeconds to 0 and Direction to 1.
Last edited by Yincognito on August 1st, 2021, 10:56 pm, edited 1 time in total.
-
- Posts: 1140
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Simple countdown timer
Wow! Thanks I'll look at that tomorrow
Yeah I understand how you like to start from scratch, but I really am not that good!
Yeah I understand how you like to start from scratch, but I really am not that good!
- MuLab -
-
- Rainmeter Sage
- Posts: 7128
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Simple countdown timer
Well, there are 2 advantages if one starts from scratch in coding:
- you learn faster, since you try things by yourself
- you don't have to figure out what someone else did in his code
I intentionally let this very basic (apart from the multitude of visual variables that are easy to figure out what they're for), so you can understand easier what's going on.
-
- Posts: 1140
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Simple countdown timer
Haha! Funny man! Easier! I get some of it after a quick look but it's getting late here!
One thing though,once the skin reaches zero, it starts counting up, is that intentional?
Actually, would you mind removing all the code for the resizing please, that's really thrown me out!
One thing though,once the skin reaches zero, it starts counting up, is that intentional?
Actually, would you mind removing all the code for the resizing please, that's really thrown me out!
- MuLab -
-
- Rainmeter Sage
- Posts: 7128
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Simple countdown timer
Ok ... MUCH easier then!
No, it was not - sorry 'bout that. I was posting a different version of the code than what I had on my computer, but I edited my reply earlier to produce the correct result (guess you didn't realize it). Basically, when it reaches 0 it pauses itself, but you can accordingly place your code for shutdown or whatever actions there instead, as I didn't bother with that.
Oh no, I hope you didn't hurt yourself after being thrown out like that... But ok, your wish was my command, and guess what: I removed everything that made the code look "big", "complicated" and "scary" (scaling, variables, etc.) - now you don't have to worry about the big bad wolf anymore, as the whole thing is precisely 100 lines of code (89 if you count off comments and my usual section group markers). I added the rest of the features in the meantime (plus the "Aller" font), so this does what the old code did (and probably more) while being 4 times shorter. The longer bang sequence in the scroll actions is nothing to worry about, as apart from changing / setting the time according to the mouse position when scrolling over the meter in the formula, it's mostly a replica of the reset code in the middle mouse up action. I let the old code as a "skin variant" for easy comparison:
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=60
; Seconds left to pass (for a timer), or seconds passed (for a stopwatch)
Seconds=#DefaultSeconds#
; 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
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!PauseMeasureGroup TimerGroup]
---Measures---
[Time]
Group=TimerGroup
Measure=Time
Format=%H:%M %S
OnChangeAction=[!SetVariable Seconds (#Seconds#+#Direction#*(1-#Reset#))]
DynamicVariables=1
[Uptime]
Group=TimerGroup
Measure=Uptime
SecondsValue=#Seconds#
Format="%3!02i!:%2!02i! %1!02i!"
MaxValue=#DefaultSeconds#
IfCondition=(#CURRENTSECTION#<=0) && (Sgn(#Direction#)=-1)
IfTrueAction=[!PauseMeasureGroup TimerGroup]
IfConditionMode=1
DynamicVariables=1
---Styles---
[TextStyle]
FontFace=Aller
FontSize=16
FontColor=255,255,255,200
StringEffect=Shadow
FontEffectColor=0,0,0,150
SolidColor=0,0,0,1
Padding=0,0,0,0
AntiAlias=1
[RoundlineStyle]
LineStart=12
LineLength=16
StartAngle=(Rad(270))
Antialias=1
Solid=1
X=160
Y=33
---Meters---
[Background]
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
MeterStyle=TextStyle
X=25
Y=20
FontWeight=700
MeasureName=Uptime
Text=%1
InlineSetting=Size | 10
InlinePattern=^.*( .*)$
MouseScrollUpAction=[!SetVariable DefaultSeconds (Clamp((#DefaultSeconds#+($MouseX:%$<38?3600:($MouseX:%$<76?60:1))),0,(99*3600+59*60+59)))][!SetVariable Seconds [#DefaultSeconds]][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
MouseScrollDownAction=[!SetVariable DefaultSeconds (Clamp((#DefaultSeconds#-($MouseX:%$<38?3600:($MouseX:%$<76?60:1))),0,(99*3600+59*60+59)))][!SetVariable Seconds [#DefaultSeconds]][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
LeftMouseUpAction=[!TogglePauseMeasureGroup TimerGroup]
MiddleMouseUpAction=[!SetVariable Seconds [#DefaultSeconds]][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
DynamicVariables=1
[RoundBarBackground]
Meter=RoundLine
MeterStyle=RoundlineStyle
LineColor=255,255,255,20
[RoundBarForeground]
Meter=RoundLine
MeterStyle=RoundlineStyle
LineColor=100,100,200,255
LineWidth=4
Solid=0
MeasureName=Uptime
EDIT: Damn, I again posted a modified version of the code than you actually need, LOL. The code / skin was set to be a stopwatch instead of a timer (for testing purposes), but I edited my initial post to correct this. It was not a big deal, just changing the DefaultSeconds and Direction variables accordingly in [Variables], but it had to be done - after all, we don't want you to be "thrown off" again by such a minor detail.
You do not have the required permissions to view the files attached to this post.
-
- Rainmeter Sage
- Posts: 1399
- Joined: April 24th, 2021, 8:13 pm
Re: Simple countdown timer
I would like it if it didn't change the hours and minutes when seconds change. And some other modifications:
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=60
DefaultMinutes=00
DefaultHours=00
; 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
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
OnRefreshAction=[!PauseMeasureGroup TimerGroup]
---Measures---
[Time]
Group=TimerGroup
Measure=Time
Format=%H:%M %S
OnChangeAction=[!SetVariable Seconds (#Seconds#+#Direction#*(1-#Reset#))]
DynamicVariables=1
[Uptime]
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]
IfConditionMode=1
DynamicVariables=1
---Styles---
[TextStyle]
FontFace=Aller
FontSize=16
FontColor=255,255,255,200
StringEffect=Shadow
FontEffectColor=0,0,0,150
SolidColor=0,0,0,1
Padding=0,0,0,0
AntiAlias=1
[RoundlineStyle]
LineStart=14
LineLength=18
StartAngle=(Rad(270))
Antialias=1
Solid=1
X=160
Y=33
---Meters---
[Background]
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
MeterStyle=TextStyle
X=25
Y=20
FontWeight=650
MeasureName=Uptime
Text=%1
InlineSetting=Size | 10
InlinePattern=^.*(\s.*)$
InlineSetting2=Weight | 800
InlinePattern2=^.*(\s.*)$
DynamicVariables=1
[Hours]
Meter=Image
H=25
W=25
X=25
Y=25
SolidColor=0,0,0,1
MouseScrollUpAction=[!SetVariable Default[#CURRENTSECTION] (Clamp([#DefaultHours]+1,0,99))][!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] (Clamp([#DefaultHours]-1,0,99))][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
MouseActionCursor=0
DynamicVariables=1
[Minutes]
Meter=Image
X=5R
MouseScrollUpAction=[!SetVariable Default[#CURRENTSECTION] (Clamp([#DefaultMinutes]+1,0,59))][!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] (Clamp([#DefaultMinutes]-1,0,59))][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
MeterStyle=Hours
[Seconds]
Meter=Image
H=22
X=4R
Y=28
MouseScrollUpAction=[!SetVariable Default[#CURRENTSECTION] (Clamp([#DefaultSeconds]+1,0,59))][!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] (Clamp([#DefaultSeconds]-1,0,59))][!SetVariable Seconds ([#DefaultSeconds]+[#DefaultMinutes]*60+[#DefaultHours]*3600)][!SetVariable Reset 1][!UnpauseMeasureGroup TimerGroup][!UpdateMeasureGroup TimerGroup][!PauseMeasureGroup TimerGroup][!SetVariable Reset 0][!UpdateMeter *][!Redraw]
MeterStyle=Hours
[RoundBarBackground]
Meter=RoundLine
MeterStyle=RoundlineStyle
LineColor=255,255,255,20
[RoundBarForeground]
Meter=RoundLine
MeterStyle=RoundlineStyle
LineColor=#StrokeColor1#
LineWidth=4
MeasureName=Uptime
[Play]
Meter=String
FontFace=Segoe MDL2 Assets
Text=[\xE768]
FontSize=12
FontColor=255,255,255,200
X=160
Y=34
FontWeight=600
AntiAlias=1
StringAlign=CenterCenter
Group=PlayPause
LeftMouseUpAction=[!UnpauseMeasureGroup TimerGroup][!ToggleMeterGroup PlayPause][!Redraw]
[Pause]
Meter=String
Text=[\xE769]
Hidden=1
LeftMouseUpAction=[!PauseMeasureGroup TimerGroup][!ToggleMeterGroup PlayPause][!Redraw]
MeterStyle=Play
[Stop]
Meter=String
FontFace=Segoe MDL2 Assets
Text=[\xE72C]
FontSize=11
FontColor=255,255,255,200
X=190
Y=34
FontWeight=600
AntiAlias=1
StringAlign=LeftCenter
LeftMouseUpAction=!Refresh
You do not have the required permissions to view the files attached to this post.
from the Realm of Death
-
- Rainmeter Sage
- Posts: 7128
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Simple countdown timer
Well, I wouldn't like it either if the superior value didn't change when the inferior one passed its maximum. It's like placing stick groups of 10 on the ground: when you reached the 11th, it's already the 2nd group of 10. But then, it's fine either way, I guess it's up to the user's preference, in the end - after all, neither approach is wrong in any way, you can "clamp it" or you can add it.death.crafter wrote: ↑August 2nd, 2021, 7:04 amI would like it if it didn't change the hours and minutes when seconds change.
Yep, those are welcomed. I was trying to make the code as short as possible while preserving the entire functionality, in order to not scare sl23 with it, so I went for the "all in one" approach. Didn't bother with buttons and all, I let that for the OP to decide (hence mentioning that one can move those actions wherever he likes, buttons included).
-
- Posts: 1140
- Joined: February 17th, 2011, 7:45 pm
- Location: a Galaxy S7 far far away
Re: Simple countdown timer
Thanks for taking the time to write (and rewrite) that skin
It looks much simpler now, hopefully I can work alone with out needing help.
It's just all the calc's and formula's that confuse me, as I don't understand all the code for them. Some of it I do, but then the bits I don't stop me from seeing what's happening. Considering I used to love maths at school, and was pretty good too, that's quite bad!
Sorry if I had sooo much online presence that you had to write that to get shot of me!
Really though, thanks for the help.
EDIT: One other thing, how did you get the images for Play, Pause and Reset? Really like those
It looks much simpler now, hopefully I can work alone with out needing help.
It's just all the calc's and formula's that confuse me, as I don't understand all the code for them. Some of it I do, but then the bits I don't stop me from seeing what's happening. Considering I used to love maths at school, and was pretty good too, that's quite bad!
Sorry if I had sooo much online presence that you had to write that to get shot of me!
Really though, thanks for the help.
EDIT: One other thing, how did you get the images for Play, Pause and Reset? Really like those
- MuLab -