It is currently May 8th, 2024, 10:40 pm

Help make this "stopwatch" skin working (button behavior)

Get help with creating, editing & fixing problems with skins
Olympus112
Posts: 28
Joined: October 17th, 2023, 5:03 am

Help make this "stopwatch" skin working (button behavior)

Post by Olympus112 »

Hello!

I have modified a stopwatch skin to make it work the way I would like it. Link to the skin pack (the Stopwatch Skin is the one in the pack).
I want it to work like this:
When I press the "Stop" button the timer stops, and in this state when I press the reset button (the yellow circle) it doesn't resets and stops the timer, rather resets the timer and immediately restarts the timer counting.

In the current state pressing the reset button, it resets the timer, but it doesn't starts the counting again imediatley.

I only want this behavior to work in the state when the timer is "Stopped" (and the red Stop button is shown), but not when i reset the timer during in the active counting state (so when the "Start button" is shown).

Could you please look at the code, so someone could figure out a solution for this?

Stopwatch.ini (content):

Code: Select all

[Rainmeter]
Author=vlesun (vlesun@newmail.ru) & balala
Background=Background Larger.png
AppVersion=100
Update=50
MouseOverAction=!execute [!ShowMeter Menu][!ShowMeter More][!ShowMeter Close][!ShowMeter MoveBack][!ShowMeter MoveUp]
MouseLeaveAction=!execute [!HideMeter Menu][!HideMeter More][!HideMeter Close][!ShowMeter MoveBack][!ShowMeter MoveUp]
OnRefreshAction=!execute [!ShowMeter StopWatchDigits][!ShowMeter MeterTimerStart][!HideMeter MeterTimerStop][!ShowMeter MeterTimerReset][#!HideMeter TimerReset#]

[Variables]
color.Skin=00000001
color.Title=FFFFFFFF
color.Text=FFFFFFFF
text.Size=8
font.Name=Segoe UI
Snooze=#CURRENTPATH#Ding.wav

[sTimer]
FontColor=#color.Text#
FontEffectColor=00000020
FontFace=#font.Name#
FontSize=#text.Size#
StringAlign=CENTER
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
AntiAlias=1

[sStopWatch]
FontColor=#color.Text#
FontEffectColor=00000020
FontFace=#font.Name#
FontSize=42
StringAlign=CENTER
StringCase=NONE
StringEffect=SHADOW
AntiAlias=1

;--------------------------------------------------------------------
;Interface
;--------------------------------------------------------------------

[MeterTimerWindow]
Meter=Image
ImageName=bgtimer.png

[MeterStopwatchWindow]
Meter=Image
ImageName=bgstopwatch.png
Hidden=1

[MeterSettingsTab]
Meter=Image
X=2
Y=3
ImageName=Settings.png
Hidden=1

[MeterAlarmBeforeTab]
Meter=Image
X=2
Y=3
ImageName=AlarmBefore.png
Hidden=1

;--------------------------------------------------------------------
;Counter for stopwatch
;--------------------------------------------------------------------

[MeasureCounterStopwatchTime]
Measure=Time
AverageSize=20

[MeasureCounterStopwatch]
Measure=Calc
Formula=( MeasureCounterStopwatch = 0 ? ( MeasureCounterStopwatchTime - MeasureStopwatch / 10 ) : MeasureCounterStopwatch )
Disabled=1

[MeasureStopwatch]
Measure=Calc
Formula=( MeasureCounterStopwatch = 0 ? MeasureStopwatch : (MeasureCounterStopwatchTime - MeasureCounterStopwatch) *10 )

;--------------------------------------------------------------------
;Stopwatch
;--------------------------------------------------------------------

[MeasureStopwatchDigit1]
Measure=Calc
Formula=MeasureStopwatch%10
MaxValue=3

[MeasureStopwatchDigit1-2]
Measure=Calc
Formula= ( MeasureStopwatchDigit1 > 9 ? 9 : MeasureStopwatchDigit1 )

[MeasureStopwatchDigit2]
Measure=Calc
Formula=(FLOOR(MeasureStopwatch/10))%60
Substitute="0":"00","1":"01","2":"02","3":"03","4":"04","5":"05","6":"06","7":"07","8":"08","9":"09","0100":"10","0101":"11","0102":"12","0103":"13","0104":"14","0105":"15","0106":"16","0107":"17","0108":"18","0109":"19","0200":"20","0201":"21","0202":"22","0203":"23","0204":"24","0205":"25","0206":"26","0207":"27","0208":"28","0209":"29","0300":"30","0301":"31","0302":"32","0303":"33","0304":"34","0305":"35","0306":"36","0307":"37","0308":"38","0309":"39","0400":"40","0401":"41","0402":"42","0403":"43","0404":"44","0405":"45","0406":"46","0407":"47","0408":"48","0409":"49","0500":"50","0501":"51","0502":"52","0503":"53","0504":"54","0505":"55","0506":"56","0507":"57","0508":"58","0509":"59"

[MeasureStopwatchDigit3]
Measure=Calc
Formula=(FLOOR(MeasureStopwatch/600))%60
Substitute="0":"00","1":"01","2":"02","3":"03","4":"04","5":"05","6":"06","7":"07","8":"08","9":"09","0100":"10","0101":"11","0102":"12","0103":"13","0104":"14","0105":"15","0106":"16","0107":"17","0108":"18","0109":"19","0200":"20","0201":"21","0202":"22","0203":"23","0204":"24","0205":"25","0206":"26","0207":"27","0208":"28","0209":"29","0300":"30","0301":"31","0302":"32","0303":"33","0304":"34","0305":"35","0306":"36","0307":"37","0308":"38","0309":"39","0400":"40","0401":"41","0402":"42","0403":"43","0404":"44","0405":"45","0406":"46","0407":"47","0408":"48","0409":"49","0500":"50","0501":"51","0502":"52","0503":"53","0504":"54","0505":"55","0506":"56","0507":"57","0508":"58","0509":"59"

[MeasureStopwatchDigit4]
Measure=Calc
Formula=(FLOOR(MeasureStopwatch/36000))%100
MaxValue=2
Substitute="0":"00","1":"01","2":"02","3":"03","4":"04","5":"05","6":"06","7":"07","8":"08","9":"09","0100":"10","0101":"11","0102":"12","0103":"13","0104":"14","0105":"15","0106":"16","0107":"17","0108":"18","0109":"19","0200":"20","0201":"21","0202":"22","0203":"23","0204":"24","0205":"25","0206":"26","0207":"27","0208":"28","0209":"29","0300":"30","0301":"31","0302":"32","0303":"33","0304":"34","0305":"35","0306":"36","0307":"37","0308":"38","0309":"39","0400":"40","0401":"41","0402":"42","0403":"43","0404":"44","0405":"45","0406":"46","0407":"47","0408":"48","0409":"49","0500":"50","0501":"51","0502":"52","0503":"53","0504":"54","0505":"55","0506":"56","0507":"57","0508":"58","0509":"59"


[BeepHourly]
Measure=Calc
Formula=((( MeasureStopwatchDigit3=0 ) ? 1 : 0 ) + (( MeasureStopwatchDigit4<>0 ) ? 1 : 0 ))
IfEqualAction=!execute [PLAY #Snooze#]
IfEqualValue=2

;--------------------------------------------------------------------
;Buttons for Stopwatch
;--------------------------------------------------------------------

[MeterTimerStart]
Meter=Image
ImageName=Start Cutted Smaller.png
X=100
Y=95
#MeterStyle=sTimer
#Text=Start
MouseActionCursor=1
LeftMouseDownAction=!Execute [!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch][!HideMeter MeterTimerStart][!ShowMeter MeterTimerStop][#!HideMeter MeterTimerReset#]

[MeterTimerStop]
Meter=Image
ImageName=Stop Cutted Smaller 2.png
X=100
Y=95
#MeterStyle=sTimer
#Text=Stop
MouseActionCursor=1
LeftMouseDownAction=!Execute [!DisableMeasure MeasureCounterStopwatch][!ShowMeter MeterTimerStart][!HideMeter MeterTimerStop][!ShowMeter MeterTimerReset]
MeterTimerReset
#MouseActionCursor=1
#LeftMouseDownAction=Command=!Execute [!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch]


[MeterTimerReset]
Meter=Image
ImageName=Reset Button Small Yellow 1.png
X=199
Y=100
#MeterStyle=sTimer
#Text=Reset
MouseActionCursor=1
#IfCondition=[!ShowMeter MeterTimerStop]
#IfTrueAction=!Execute [!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch]
LeftMouseDownAction=!Execute [!DisableMeasure MeasureStopwatch][!DisableMeasure MeasureCounterStopwatch][!ShowMeter MeterTimerStart][#!HideMeter MeterTimerStop#][#!HideMeter MeterTimerReset#]
#IfCondition=[!ShowMeter MeterTimerStop]
#IfTrueAction=!Execute [!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch]
Hidden=1


[StopWatchDigits]
Meter=String
MeasureName=MeasureStopwatchDigit4
MeasureName2=MeasureStopwatchDigit3
MeasureName3=MeasureStopwatchDigit2
MeasureName4=MeasureStopwatchDigit1-2
X=138
Y=15
MeterStyle=sStopWatch
Text=%1:%2:%3
AntiAlias=1
Hidden=1

###

[Menu]
Meter=IMAGE
ImageName=Menu Buttons Plain 4.png
X=246
Y=12
Hidden=1

[Close]
Meter=BUTTON
ButtonImage=Close.png
X=246
Y=12
ButtonCommand=!DeactivateConfig
Hidden=1

#[More]

[MoveUp]
Meter=BUTTON
ButtonImage=Move UP.png
X=246
Y=34
ButtonCommand=!Execute [!zpos 2 "#CURRENTCONFIG#" "Stopwatch.ini"]
#ButtonCommand=!ActivateConfig "#CURRENTCONFIG#" "Timer.ini"
Hidden=1

[MoveBack]
Meter=BUTTON
ButtonImage=Move Down 01.png
X=246
Y=54
ButtonCommand=!Execute [!zpos -2 "#CURRENTCONFIG#" "Stopwatch.ini"]
#ButtonCommand=!ActivateConfig "#CURRENTCONFIG#" "Timer.ini"
Hidden=1
User avatar
balala
Rainmeter Sage
Posts: 16206
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help make this "stopwatch" skin working (button behavior)

Post by balala »

Olympus112 wrote: October 17th, 2023, 5:25 am I want it to work like this:
When I press the "Stop" button the timer stops, and in this state when I press the reset button (the yellow circle) it doesn't resets and stops the timer, rather resets the timer and immediately restarts the timer counting.
Try adding a few bangs to the LeftMouseDownAction option of the [MeterTimerReset] meter, namely the following ones: [!UpdateMeasure MeasureStopwatch][!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch].
This way the mentioned option should look this way:

Code: Select all

[MeterTimerReset]
...
LeftMouseDownAction=!Execute [!DisableMeasure MeasureStopwatch][!DisableMeasure MeasureCounterStopwatch][!UpdateMeasure MeasureStopwatch][!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch][!ShowMeter MeterTimerStart][#!HideMeter MeterTimerStop#][#!HideMeter MeterTimerReset#]
The skin look (extremely) outdated and the code should be improved a little bit. For first try out what I described above, to see if it does what you want, then I'll describe the improvements as well.
Olympus112
Posts: 28
Joined: October 17th, 2023, 5:03 am

Re: Help make this "stopwatch" skin working (button behavior)

Post by Olympus112 »

balala wrote: October 17th, 2023, 7:35 am Try adding a few bangs to the LeftMouseDownAction option of the [MeterTimerReset] meter, namely the following ones: [!UpdateMeasure MeasureStopwatch][!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch].
This way the mentioned option should look this way:

Code: Select all

[MeterTimerReset]
...
LeftMouseDownAction=!Execute [!DisableMeasure MeasureStopwatch][!DisableMeasure MeasureCounterStopwatch][!UpdateMeasure MeasureStopwatch][!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch][!ShowMeter MeterTimerStart][#!HideMeter MeterTimerStop#][#!HideMeter MeterTimerReset#]
The skin look (extremely) outdated and the code should be improved a little bit. For first try out what I described above, to see if it does what you want, then I'll describe the improvements as well.
Thanks, but It doesn't work as I have described. Whit the code part of yours, it works like this:
When press Start (and thus the Stop button appears) and the counting begins and then I press Reset, but it doesn't do anything.
When I press the Stop button (and thus the Start button appears) the counting stops in it's current state, than if I press Reset, it resets the counting and begins the counting again (with still showing the Start button, despite of Stop).

The way I want it to work:
When I press Start (and thus the Stop button appears) and the counting begins and than I press Reset, it resets the counting and starts it immediately over again.
When I press the Stop button (and thus the Start button appears) the counting stops (pauses) and if in this state I press the Reset button, it just resets the counting, but doesn't starts it over again.

Hope you (or maybe also some others) can figure out the way it should work like I have mentioned!

Thank you!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5408
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Help make this "stopwatch" skin working (button behavior)

Post by eclectic-tech »

Olympus112 wrote: October 17th, 2023, 9:09 am Thanks, but It doesn't work as I have described. {clip}
The way I want it to work:
When I press Start (and thus the Stop button appears) and the counting begins and than I press Reset, it resets the counting and starts it immediately over again.
When I press the Stop button (and thus the Start button appears) the counting stops (pauses) and if in this state I press the Reset button, it just resets the counting, but doesn't starts it over again.

Hope you (or maybe also some others) can figure out the way it should work like I have mentioned!

Thank you!
So, because you want the same Reset button to perform 2 different actions, you will need to monitor the state of the timer and setup the 2 desired actions.

You can do this by creating a variable (name it 'Running') and set it to zero when the timer is not running and 1 when it is.
Then create 2 variables with the action bangs to perform when the rest button is pressed: (name them Reset0 and Reset1).

Now by using !SetVariable when you press the 'Start' and 'Stop' buttons, you can control the value of #Running# variable and use it as a nested variable in the Reset button mouse action bang to do the appropriate actions.

Not: It appears you tried to use IfConditions, but failed due to syntax errors and trying to use them in meters instead of in measures. Also note to comment lines Rainmeter uses ; not #.

Code (with errors removed).

Code: Select all

[Rainmeter]
Author=vlesun (vlesun@newmail.ru) & balala
Background=Background Larger.png
AppVersion=100
Update=50
MouseOverAction=[!ShowMeter Menu][!ShowMeter Close][!ShowMeter MoveBack][!ShowMeter MoveUp][!Redraw]
MouseLeaveAction=[!HideMeter Menu][!HideMeter Close][!ShowMeter MoveBack][!ShowMeter MoveUp][!Redraw]
OnRefreshAction=[!ShowMeter StopWatchDigits][!ShowMeter MeterTimerStart][!HideMeter MeterTimerStop][!ShowMeter MeterTimerReset]

[Variables]
color.Skin=00000001
color.Title=FFFFFFFF
color.Text=FFFFFFFF
text.Size=8
font.Name=Segoe UI
Snooze=#CURRENTPATH#Ding.wav

Running=0

Reset0="[!DisableMeasure MeasureStopwatch][!DisableMeasure MeasureCounterStopwatch][!UpdateMeasure MeasureStopwatch][!UpdateMeasure MeasureCounterStopwatch][!ShowMeter MeterTimerStart]"

Reset1="[!DisableMeasure MeasureStopwatch][!DisableMeasure MeasureCounterStopwatch][!UpdateMeasure MeasureStopwatch][!UpdateMeasure MeasureCounterStopwatch][!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch][!ShowMeter MeterTimerStop]"

[sTimer]
FontColor=#color.Text#
FontEffectColor=00000020
FontFace=#font.Name#
FontSize=#text.Size#
StringAlign=CENTER
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
AntiAlias=1

[sStopWatch]
FontColor=#color.Text#
FontEffectColor=00000020
FontFace=#font.Name#
FontSize=42
StringAlign=CENTER
StringCase=NONE
StringEffect=SHADOW
AntiAlias=1

;--------------------------------------------------------------------
;Interface
;--------------------------------------------------------------------

; [MeterTimerWindow]
; Meter=Image
; ImageName=bgtimer.png

; [MeterStopwatchWindow]
; Meter=Image
; ImageName=bgstopwatch.png
; Hidden=1

; [MeterSettingsTab]
; Meter=Image
; X=2
; Y=3
; ImageName=Settings.png
; Hidden=1

; [MeterAlarmBeforeTab]
; Meter=Image
; X=2
; Y=3
; ImageName=AlarmBefore.png
; Hidden=1

;--------------------------------------------------------------------
;Counter for stopwatch
;--------------------------------------------------------------------

[MeasureCounterStopwatchTime]
Measure=Time
AverageSize=20

[MeasureCounterStopwatch]
Measure=Calc
Formula=( MeasureCounterStopwatch = 0 ? ( MeasureCounterStopwatchTime - MeasureStopwatch / 10 ) : MeasureCounterStopwatch )
Disabled=1

[MeasureStopwatch]
Measure=Calc
Formula=( MeasureCounterStopwatch = 0 ? MeasureStopwatch : (MeasureCounterStopwatchTime - MeasureCounterStopwatch) *10 )

;--------------------------------------------------------------------
;Stopwatch
;--------------------------------------------------------------------

[MeasureStopwatchDigit1]
Measure=Calc
Formula=MeasureStopwatch%10
MaxValue=3

[MeasureStopwatchDigit1-2]
Measure=Calc
Formula= ( MeasureStopwatchDigit1 > 9 ? 9 : MeasureStopwatchDigit1 )

[MeasureStopwatchDigit2]
Measure=Calc
Formula=(FLOOR(MeasureStopwatch/10))%60
Substitute="0":"00","1":"01","2":"02","3":"03","4":"04","5":"05","6":"06","7":"07","8":"08","9":"09","0100":"10","0101":"11","0102":"12","0103":"13","0104":"14","0105":"15","0106":"16","0107":"17","0108":"18","0109":"19","0200":"20","0201":"21","0202":"22","0203":"23","0204":"24","0205":"25","0206":"26","0207":"27","0208":"28","0209":"29","0300":"30","0301":"31","0302":"32","0303":"33","0304":"34","0305":"35","0306":"36","0307":"37","0308":"38","0309":"39","0400":"40","0401":"41","0402":"42","0403":"43","0404":"44","0405":"45","0406":"46","0407":"47","0408":"48","0409":"49","0500":"50","0501":"51","0502":"52","0503":"53","0504":"54","0505":"55","0506":"56","0507":"57","0508":"58","0509":"59"

[MeasureStopwatchDigit3]
Measure=Calc
Formula=(FLOOR(MeasureStopwatch/600))%60
Substitute="0":"00","1":"01","2":"02","3":"03","4":"04","5":"05","6":"06","7":"07","8":"08","9":"09","0100":"10","0101":"11","0102":"12","0103":"13","0104":"14","0105":"15","0106":"16","0107":"17","0108":"18","0109":"19","0200":"20","0201":"21","0202":"22","0203":"23","0204":"24","0205":"25","0206":"26","0207":"27","0208":"28","0209":"29","0300":"30","0301":"31","0302":"32","0303":"33","0304":"34","0305":"35","0306":"36","0307":"37","0308":"38","0309":"39","0400":"40","0401":"41","0402":"42","0403":"43","0404":"44","0405":"45","0406":"46","0407":"47","0408":"48","0409":"49","0500":"50","0501":"51","0502":"52","0503":"53","0504":"54","0505":"55","0506":"56","0507":"57","0508":"58","0509":"59"

[MeasureStopwatchDigit4]
Measure=Calc
Formula=(FLOOR(MeasureStopwatch/36000))%100
MaxValue=2
Substitute="0":"00","1":"01","2":"02","3":"03","4":"04","5":"05","6":"06","7":"07","8":"08","9":"09","0100":"10","0101":"11","0102":"12","0103":"13","0104":"14","0105":"15","0106":"16","0107":"17","0108":"18","0109":"19","0200":"20","0201":"21","0202":"22","0203":"23","0204":"24","0205":"25","0206":"26","0207":"27","0208":"28","0209":"29","0300":"30","0301":"31","0302":"32","0303":"33","0304":"34","0305":"35","0306":"36","0307":"37","0308":"38","0309":"39","0400":"40","0401":"41","0402":"42","0403":"43","0404":"44","0405":"45","0406":"46","0407":"47","0408":"48","0409":"49","0500":"50","0501":"51","0502":"52","0503":"53","0504":"54","0505":"55","0506":"56","0507":"57","0508":"58","0509":"59"


[BeepHourly]
Measure=Calc
Formula=((( MeasureStopwatchDigit3=0 ) ? 1 : 0 ) + (( MeasureStopwatchDigit4<>0 ) ? 1 : 0 ))
IfEqualAction=!execute [PLAY #Snooze#]
IfEqualValue=2

;--------------------------------------------------------------------
;Buttons for Stopwatch
;--------------------------------------------------------------------

[MeterTimerStart]
Meter=Image
ImageName=Start Cutted Smaller.png
X=100
Y=95
MeterStyle=sTimer
Text=Start
MouseActionCursor=1
LeftMouseDownAction=[!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch][!HideMeter MeterTimerStart][!ShowMeter MeterTimerStop][!SetVariable Running 1]

[MeterTimerStop]
Meter=Image
ImageName=Stop Cutted Smaller 2.png
X=100
Y=95
MeterStyle=sTimer
Text=Stop
MouseActionCursor=1
LeftMouseDownAction=[!DisableMeasure MeasureCounterStopwatch][!ShowMeter MeterTimerStart][!HideMeter MeterTimerStop][!ShowMeter MeterTimerReset][!SetVariable Running 0]
MouseActionCursor=1
DynamicVariables=1

[MeterTimerReset]
Meter=Image
ImageName=Reset Button Small Yellow 1.png
X=199
Y=100
MeterStyle=sTimer
Text=Reset
MouseActionCursor=1
LeftMouseDownAction=[#Reset[#Running]]
Hidden=1
DynamicVariables=1


[StopWatchDigits]
Meter=String
MeasureName=MeasureStopwatchDigit4
MeasureName2=MeasureStopwatchDigit3
MeasureName3=MeasureStopwatchDigit2
MeasureName4=MeasureStopwatchDigit1-2
X=138
Y=15
MeterStyle=sStopWatch
Text=%1:%2:%3
AntiAlias=1
Hidden=1

[Menu]
Meter=IMAGE
ImageName=Menu Buttons Plain 4.png
X=246
Y=12
Hidden=1

[Close]
Meter=BUTTON
ButtonImage=Close.png
X=246
Y=12
ButtonCommand=!DeactivateConfig
Hidden=1

[MoveUp]
Meter=BUTTON
ButtonImage=Move UP.png
X=246
Y=34
ButtonCommand=[!zpos 2]
Hidden=1

[MoveBack]
Meter=BUTTON
ButtonImage=Move Down 01.png
X=246
Y=54
ButtonCommand=[!zpos -2]
Hidden=1
Olympus112
Posts: 28
Joined: October 17th, 2023, 5:03 am

Re: Help make this "stopwatch" skin working (button behavior)

Post by Olympus112 »

eclectic-tech wrote: October 17th, 2023, 3:05 pm So, because you want the same Reset button to perform 2 different actions, you will need to monitor the state of the timer and setup the 2 desired actions.

You can do this by creating a variable (name it 'Running') and set it to zero when the timer is not running and 1 when it is.
Then create 2 variables with the action bangs to perform when the rest button is pressed: (name them Reset0 and Reset1).

Now by using !SetVariable when you press the 'Start' and 'Stop' buttons, you can control the value of #Running# variable and use it as a nested variable in the Reset button mouse action bang to do the appropriate actions.

Not: It appears you tried to use IfConditions, but failed due to syntax errors and trying to use them in meters instead of in measures. Also note to comment lines Rainmeter uses ; not #.

Code (with errors removed).

Code: Select all

[Rainmeter]
Author=vlesun (vlesun@newmail.ru) & balala
Background=Background Larger.png
AppVersion=100
Update=50
MouseOverAction=[!ShowMeter Menu][!ShowMeter Close][!ShowMeter MoveBack][!ShowMeter MoveUp][!Redraw]
MouseLeaveAction=[!HideMeter Menu][!HideMeter Close][!ShowMeter MoveBack][!ShowMeter MoveUp][!Redraw]
OnRefreshAction=[!ShowMeter StopWatchDigits][!ShowMeter MeterTimerStart][!HideMeter MeterTimerStop][!ShowMeter MeterTimerReset]

[Variables]
color.Skin=00000001
color.Title=FFFFFFFF
color.Text=FFFFFFFF
text.Size=8
font.Name=Segoe UI
Snooze=#CURRENTPATH#Ding.wav

Running=0

Reset0="[!DisableMeasure MeasureStopwatch][!DisableMeasure MeasureCounterStopwatch][!UpdateMeasure MeasureStopwatch][!UpdateMeasure MeasureCounterStopwatch][!ShowMeter MeterTimerStart]"

Reset1="[!DisableMeasure MeasureStopwatch][!DisableMeasure MeasureCounterStopwatch][!UpdateMeasure MeasureStopwatch][!UpdateMeasure MeasureCounterStopwatch][!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch][!ShowMeter MeterTimerStop]"

[sTimer]
FontColor=#color.Text#
FontEffectColor=00000020
FontFace=#font.Name#
FontSize=#text.Size#
StringAlign=CENTER
StringCase=NONE
StringStyle=BOLD
StringEffect=SHADOW
AntiAlias=1

[sStopWatch]
FontColor=#color.Text#
FontEffectColor=00000020
FontFace=#font.Name#
FontSize=42
StringAlign=CENTER
StringCase=NONE
StringEffect=SHADOW
AntiAlias=1

;--------------------------------------------------------------------
;Interface
;--------------------------------------------------------------------

; [MeterTimerWindow]
; Meter=Image
; ImageName=bgtimer.png

; [MeterStopwatchWindow]
; Meter=Image
; ImageName=bgstopwatch.png
; Hidden=1

; [MeterSettingsTab]
; Meter=Image
; X=2
; Y=3
; ImageName=Settings.png
; Hidden=1

; [MeterAlarmBeforeTab]
; Meter=Image
; X=2
; Y=3
; ImageName=AlarmBefore.png
; Hidden=1

;--------------------------------------------------------------------
;Counter for stopwatch
;--------------------------------------------------------------------

[MeasureCounterStopwatchTime]
Measure=Time
AverageSize=20

[MeasureCounterStopwatch]
Measure=Calc
Formula=( MeasureCounterStopwatch = 0 ? ( MeasureCounterStopwatchTime - MeasureStopwatch / 10 ) : MeasureCounterStopwatch )
Disabled=1

[MeasureStopwatch]
Measure=Calc
Formula=( MeasureCounterStopwatch = 0 ? MeasureStopwatch : (MeasureCounterStopwatchTime - MeasureCounterStopwatch) *10 )

;--------------------------------------------------------------------
;Stopwatch
;--------------------------------------------------------------------

[MeasureStopwatchDigit1]
Measure=Calc
Formula=MeasureStopwatch%10
MaxValue=3

[MeasureStopwatchDigit1-2]
Measure=Calc
Formula= ( MeasureStopwatchDigit1 > 9 ? 9 : MeasureStopwatchDigit1 )

[MeasureStopwatchDigit2]
Measure=Calc
Formula=(FLOOR(MeasureStopwatch/10))%60
Substitute="0":"00","1":"01","2":"02","3":"03","4":"04","5":"05","6":"06","7":"07","8":"08","9":"09","0100":"10","0101":"11","0102":"12","0103":"13","0104":"14","0105":"15","0106":"16","0107":"17","0108":"18","0109":"19","0200":"20","0201":"21","0202":"22","0203":"23","0204":"24","0205":"25","0206":"26","0207":"27","0208":"28","0209":"29","0300":"30","0301":"31","0302":"32","0303":"33","0304":"34","0305":"35","0306":"36","0307":"37","0308":"38","0309":"39","0400":"40","0401":"41","0402":"42","0403":"43","0404":"44","0405":"45","0406":"46","0407":"47","0408":"48","0409":"49","0500":"50","0501":"51","0502":"52","0503":"53","0504":"54","0505":"55","0506":"56","0507":"57","0508":"58","0509":"59"

[MeasureStopwatchDigit3]
Measure=Calc
Formula=(FLOOR(MeasureStopwatch/600))%60
Substitute="0":"00","1":"01","2":"02","3":"03","4":"04","5":"05","6":"06","7":"07","8":"08","9":"09","0100":"10","0101":"11","0102":"12","0103":"13","0104":"14","0105":"15","0106":"16","0107":"17","0108":"18","0109":"19","0200":"20","0201":"21","0202":"22","0203":"23","0204":"24","0205":"25","0206":"26","0207":"27","0208":"28","0209":"29","0300":"30","0301":"31","0302":"32","0303":"33","0304":"34","0305":"35","0306":"36","0307":"37","0308":"38","0309":"39","0400":"40","0401":"41","0402":"42","0403":"43","0404":"44","0405":"45","0406":"46","0407":"47","0408":"48","0409":"49","0500":"50","0501":"51","0502":"52","0503":"53","0504":"54","0505":"55","0506":"56","0507":"57","0508":"58","0509":"59"

[MeasureStopwatchDigit4]
Measure=Calc
Formula=(FLOOR(MeasureStopwatch/36000))%100
MaxValue=2
Substitute="0":"00","1":"01","2":"02","3":"03","4":"04","5":"05","6":"06","7":"07","8":"08","9":"09","0100":"10","0101":"11","0102":"12","0103":"13","0104":"14","0105":"15","0106":"16","0107":"17","0108":"18","0109":"19","0200":"20","0201":"21","0202":"22","0203":"23","0204":"24","0205":"25","0206":"26","0207":"27","0208":"28","0209":"29","0300":"30","0301":"31","0302":"32","0303":"33","0304":"34","0305":"35","0306":"36","0307":"37","0308":"38","0309":"39","0400":"40","0401":"41","0402":"42","0403":"43","0404":"44","0405":"45","0406":"46","0407":"47","0408":"48","0409":"49","0500":"50","0501":"51","0502":"52","0503":"53","0504":"54","0505":"55","0506":"56","0507":"57","0508":"58","0509":"59"


[BeepHourly]
Measure=Calc
Formula=((( MeasureStopwatchDigit3=0 ) ? 1 : 0 ) + (( MeasureStopwatchDigit4<>0 ) ? 1 : 0 ))
IfEqualAction=!execute [PLAY #Snooze#]
IfEqualValue=2

;--------------------------------------------------------------------
;Buttons for Stopwatch
;--------------------------------------------------------------------

[MeterTimerStart]
Meter=Image
ImageName=Start Cutted Smaller.png
X=100
Y=95
MeterStyle=sTimer
Text=Start
MouseActionCursor=1
LeftMouseDownAction=[!EnableMeasure MeasureStopwatch][!EnableMeasure MeasureCounterStopwatch][!HideMeter MeterTimerStart][!ShowMeter MeterTimerStop][!SetVariable Running 1]

[MeterTimerStop]
Meter=Image
ImageName=Stop Cutted Smaller 2.png
X=100
Y=95
MeterStyle=sTimer
Text=Stop
MouseActionCursor=1
LeftMouseDownAction=[!DisableMeasure MeasureCounterStopwatch][!ShowMeter MeterTimerStart][!HideMeter MeterTimerStop][!ShowMeter MeterTimerReset][!SetVariable Running 0]
MouseActionCursor=1
DynamicVariables=1

[MeterTimerReset]
Meter=Image
ImageName=Reset Button Small Yellow 1.png
X=199
Y=100
MeterStyle=sTimer
Text=Reset
MouseActionCursor=1
LeftMouseDownAction=[#Reset[#Running]]
Hidden=1
DynamicVariables=1


[StopWatchDigits]
Meter=String
MeasureName=MeasureStopwatchDigit4
MeasureName2=MeasureStopwatchDigit3
MeasureName3=MeasureStopwatchDigit2
MeasureName4=MeasureStopwatchDigit1-2
X=138
Y=15
MeterStyle=sStopWatch
Text=%1:%2:%3
AntiAlias=1
Hidden=1

[Menu]
Meter=IMAGE
ImageName=Menu Buttons Plain 4.png
X=246
Y=12
Hidden=1

[Close]
Meter=BUTTON
ButtonImage=Close.png
X=246
Y=12
ButtonCommand=!DeactivateConfig
Hidden=1

[MoveUp]
Meter=BUTTON
ButtonImage=Move UP.png
X=246
Y=34
ButtonCommand=[!zpos 2]
Hidden=1

[MoveBack]
Meter=BUTTON
ButtonImage=Move Down 01.png
X=246
Y=54
ButtonCommand=[!zpos -2]
Hidden=1
Now that's exactly what I was asking for! Thank you for the code on for the "tutorial", it finally works now!
User avatar
balala
Rainmeter Sage
Posts: 16206
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help make this "stopwatch" skin working (button behavior)

Post by balala »

Olympus112 wrote: October 17th, 2023, 4:02 pm Now that's exactly what I was asking for! Thank you for the code on for the "tutorial", it finally works now!
Glad if eclectic-tech fixed the code, but as i said in my reply, there are lot of problems with the original and outdated code. These should be fixed as well. If you are interested, please let me know, to describe what should be improved.
Olympus112
Posts: 28
Joined: October 17th, 2023, 5:03 am

Re: Help make this "stopwatch" skin working (button behavior)

Post by Olympus112 »

balala wrote: October 17th, 2023, 6:11 pm Glad if eclectic-tech fixed the code, but as i said in my reply, there are lot of problems with the original and outdated code. These should be fixed as well. If you are interested, please let me know, to describe what should be improved.
Ok, if that would make to code even better.
Olympus112
Posts: 28
Joined: October 17th, 2023, 5:03 am

Re: Help make this "stopwatch" skin working (button behavior)

Post by Olympus112 »

Oh, and one more thing that needs some improvement:
The side "menu" buttons on the skin working a bit "clumsy" and inconvenient and I don't know the reason why.

You can try and see what I'm meaning here: when you move the cursor to one of the menu icons, sometimes they don't get "recognized" and thus couldn't be clicked. It's working when I'm pulling the cursor from upwards or leftwards to the icons, but it doesn't when I'm pulling it from downwards and from Rightwards. So it's kind of very strange behavior.

The icons images concerned are: Menu Buttons Plain 4.png, Close.png, Move UP.png, Move Down 01.png

And the code part, that contains their behavior is:

Code: Select all

[Menu]
Meter=IMAGE
ImageName=Menu Buttons Plain 4.png
X=246
Y=12
Hidden=1

[Close]
Meter=BUTTON
ButtonImage=Close.png
X=246
Y=12
ButtonCommand=!DeactivateConfig
Hidden=1

[MoveUp]
Meter=BUTTON
ButtonImage=Move UP.png
X=246
Y=34
ButtonCommand=[!zpos 2]
Hidden=1

[MoveBack]
Meter=BUTTON
ButtonImage=Move Down 01.png
X=246
Y=54
ButtonCommand=[!zpos -2]
Hidden=1
Or maybe there could be some other parts in the rest of the code that are responsible for how these buttons work, but I couldn't find any clues of them. :confused:

It must be something wrong with either the images or with the code.

So could someone check it out and maybe find out what could be the issue in this case?

Thank you!
Last edited by Olympus112 on October 18th, 2023, 5:18 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16206
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help make this "stopwatch" skin working (button behavior)

Post by balala »

Olympus112 wrote: October 18th, 2023, 2:34 am Ok, if that would make to code even better.
  • The !Execute bang is deprecated and should not be used anymore, even if few (many?) years ago it had to be. Remove them.
  • The Substitute option of the [MeasureStopwatchDigit2], [MeasureStopwatchDigit3] and [MeasureStopwatchDigit4] measures are way too long. It could be shorten, replacing them with the following two options (in all three measures, not just in [MeasureStopwatchDigit2]):

    Code: Select all

    [MeasureStopwatchDigit2]
    ...
    RegExpSubstitute=1
    Substitute="^(.)$":"0\1"
  • There are lot of options which I think should have be commented out, but in fact they are not. Some of them don't even make sense on the sections where they are used. For instance Text options can't be used on Image meters (for example there is a #Text=Start option on the [MeterTimerStart] Image meter). Others are used on not-proper sections and additionally don't even have a correct form either. Like #IfCondition=[!ShowMeter MeterTimerStop], used on the [MeterTimerReset] meter. An IfCondition should contain a mathematical condition, not a bang. Additionally an IfCondition can't be used on meters, just on measures.
    I assume the author wanted to comment out all the above options. He added the # characters in front of those options. But in Rainmeter the commenting out character is the semicolon (;). Replace those # characters by ;.
  • Not entirely sure what the author wanted to do by adding the # characters around bang in different options. I just assume he wanted to comment out those bangs into an existing option, but this CAN'T BE DONE in Rainmeter. You have to remove those bangs to get rid of them, no way to comment them out. I'm talking for example about the [#!HideMeter MeterTimerReset#] bang of the LeftMouseDownAction option of the [MeterTimerReset] meter. So remove all of those bangs.
  • Some bangs have too many parameters. For instance !ZPos bang used into the ButtonCommand option of the [MoveUp] meter. It looks this way: ButtonCommand=!Execute [!zpos 2 "#CURRENTCONFIG#" "Stopwatch.ini"]. The red marked "Stopwatch.ini" parameter is completely useless. The !ZPos bang doesn't require this parameter and can't even be used in any circumstances. "#CURRENTCONFIG#" can be used at least, but doesn't worth to add it, because if it's not used, the bang applies to current config, so no need to add it explicitly. Accordingly the above option should look this way: [!ZPos "2"]. Same applies to the ButtonCommand option of the [MoveBack] meter as well.
  • All resources (images) on the newer approaches should be placed into a folder called @Resources, existing into the root config folder (in this case into the Skins\Timer folder). If you create this folder and move all files excepting Countdown.ini, Stopwatch.ini and Timer.ini into this @Resources folder, add the #@# variable in front of the names of the appropriate files. For example replace the ImageName=bgtimer.png option of the [MeterTimerWindow] meter by ImageName=#@#bgtimer.png.
  • All LeftMouseDownAction options should be replaced by LeftMouseUpAction. You can find out why in the Note of this.
Olympus112
Posts: 28
Joined: October 17th, 2023, 5:03 am

Re: Help make this "stopwatch" skin working (button behavior)

Post by Olympus112 »

balala wrote: October 18th, 2023, 4:52 pm Do you have any further question?
Tomorrow I will try the modifications you have posted, any further questions will depend on the results.
But do you think the mods will help out my issues with the "Menu Buttons behavior" as described in my last post?

And thanks again!