Hi.
I want a simple stopwatch.
It does not count seconds, only minutes and hours.
Click on it to reset and restart.
I'm new to this and don't know where to start. Grateful for help.
It is currently September 11th, 2024, 9:03 am
Simple stopwatch [Edit to Simple Elapsed Time]
-
- Posts: 9
- Joined: August 13th, 2023, 2:07 pm
Simple stopwatch [Edit to Simple Elapsed Time]
Last edited by HLHM on August 13th, 2023, 6:57 pm, edited 1 time in total.
-
- Rainmeter Sage
- Posts: 5506
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Simple stopwatch
Skin requests are not supported in this forum...
However, here is a dynamic stopwatch by raiduard: Stopwatch
or a simple countdown timer by JSMorley to try: TimerNixie
If you need to customize them, simply ask your question here.
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Posts: 9
- Joined: August 13th, 2023, 2:07 pm
Re: Simple stopwatch
Hi. I wasn't looking for a finished skin but the code in its simplest form.
Realize that it's not the stopwatch I need, but the time that has passed since the refresh
When I have understood it, I will build further, but right now I have no idea how. Thanks
Realize that it's not the stopwatch I need, but the time that has passed since the refresh
When I have understood it, I will build further, but right now I have no idea how. Thanks
-
- Rainmeter Sage
- Posts: 5506
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Simple stopwatch
You can start from nothing if you like, but it should be much easier to modify an existing skin that already deals with time; the TimerNixie skin does that and with small changes could result in what you are looking for; it shows remaining time from a set date and time.
If you want to start completely new, here are some helpful links for you to study:
Time Measure
Time & Uptime Measures
Good luck and feel free to ask questions, it's how we all started
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Posts: 9
- Joined: August 13th, 2023, 2:07 pm
Re: Simple stopwatch
Thanks. Part one is complete. Mixed from what I found here on the forum and managed to get it working. Now for part 2, clicking and restarting the counter. This is fun but now it's time for a coffee
Code: Select all
[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,255
[mStartingTime]
Measure=Time
UpdateDivider=-1
[mTimeNow]
Measure=Time
[mTimmar]
Measure=Time
TimeStamp=([mTimeNow:]-[mStartingTime:])
DynamicVariables=1
Format=%#H
[mMinuter]
Measure=Time
TimeStamp=([mTimeNow:]-[mStartingTime:])
DynamicVariables=1
Format=%M
[Meter1]
Meter=String
MeasureName=mTimmar
MeasureName2=mMinuter
FontFace=Trebuchet MS
FontSize=12
FontWeight=400
FontColor=255,255,255,255
Text="Elapsed time since last COFFEE break: %1 hour %2 minutes!"
-
- Rainmeter Sage
- Posts: 8072
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Simple stopwatch
Time that has passed since the refresh of the skin, or time that has passed since you clicked to start the stopwatch?
Both can be solved in a simple way. You need a basic Time measure, and an equally basic Uptime measure having a SecondsValue option. Then, in the meter where you show the text result, add some appropriate LeftMouseUpAction where you set a variable named, say, StartTime, to the timestamp value of the Time measure on left click. As a consequence, the value of the SecondsValue option from the Uptime measure should be set to the timestamp value of the Time measure (i.e. the current time as a number) minus the value of the variable you just created (i.e. the start time as a number). The Uptime measure would format that numerical difference in seconds to days, hours, minutes and so on, depending on what you set as the value of its Format option. As long as the meter references the Uptime measure and displays it, you're good to go. Resetting can be simulated by creating another variable, say, Reset, which you can multiply the above difference with, in the SecondsValue option from the Uptime measure. Obviously, you should set the value of the newly created Reset variable to 0, in a, say, RightMouseUpAction that you add to the meter (to reset) taking care to set it to 1 in the LeftMouseUpAction (to count time).
Check the code at
https://forum.rainmeter.net/viewtopic.php?t=42717#p217029
and adjust it as mentioned, removing the unneeded stuff, and take a look at
https://docs.rainmeter.net/manual/skins/option-types/#Action
to see how to set variables using mouse actions.
Also, you should check
https://docs.rainmeter.net/manual/bangs/#UpdateMeasure
https://docs.rainmeter.net/manual/bangs/#UpdateMeter
https://docs.rainmeter.net/manual/bangs/#Redraw
to see how to update the measures and meters relevant to the changes you make, and redraw the skin afterwards in order to make those changes visible in the skin.
EDIT: Well, looks like you got a nice start already, but the above is still applicable.
P.S. The Uptime measure and the meter would need to have a DynamicVariables=1 line added to them, so that Rainmeter sees the changes in those variables.
-
- Posts: 9
- Joined: August 13th, 2023, 2:07 pm
Re: Simple stopwatch
Thanks for your help.
I put the line in the Meter1-section and it did the trick.
I put the line
Code: Select all
LeftMouseUpAction=!UpdateMeasure mStartingTime
-
- Rainmeter Sage
- Posts: 8072
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Simple stopwatch
Sure thing. Just another way of doing the same - your code does it using a measure, while my approach would have done it using a variable. Both ways are valid, as long as you get the desired outcome.HLHM wrote: ↑August 13th, 2023, 6:45 pm Thanks for your help.
I put the linein the Meter1-section and it did the trick.Code: Select all
LeftMouseUpAction=!UpdateMeasure mStartingTime