It is currently April 16th, 2024, 9:28 am

Simple countdown timer

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Glad I'm not the only one! :oops: :D
- MuLab -
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

New version with MouseScroll working, but not perfect... yet!
Still can't figure out that RoundBar issue though, any ideas?

Code: Select all

[Rainmeter]
Author=zzeneg & balala
AppVersion=10
Update=50
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
;MouseOverAction=[!ShowMeterGroup Menu]
;MouseLeaveAction=[!HideMeterGroup Menu]
OnRefreshAction=[!ShowMeter Action1][!DisableMeasure mTimer4][!HideMeter Stop]
AccurateText=1

[Bg]
Meter=Shape
Shape=Rectangle Rectangle 1,1,150,60,5 | Extend StrokeSize | Stroke Color 128,255,0,100 | Fill Color 0,0,0,120
StrokeSize=StrokeWidth 0
MouseOverAction=[!SetOption #CURRENTSECTION# StrokeSize "StrokeWidth 2"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeSize "StrokeWidth 0"][!UpdateMeter *][!Redraw]
StrokeAlpha=Stroke Color 128,255,0,100
DynamicVariables=1

[Variables]
Alarm=alarm.wav

DefaultInitialValue=6000
MaxVal=#DefaultInitialValue#
;DefaultInitialValue is the time (in one-tenth of seconds!) which appears when you refresh the skin. 

CloseApps=RightMouseUpAction=[!CommandMeasure mPlayer "ClosePlayer"]

Hibernate=rundll32.exe powrprof.dll,SetSuspendState
Shutdown=shutdown.exe -s -t 60 -f
HybridShutdown=shutdown.exe /s /hybrid /f /t 60
Restart=shutdown.exe -r -t 0
Lock=rundll32.exe user32.dll, LockWorkStation
Act=CloseApps

========================================
; STYLES
========================================
[sAllText]
FontFace=Aller
StringStyle=Bold
StringAlign=Center
FontSize=9
FontColor=255,255,255,200
AntiAlias=1

StringEffect=SHADOW
FontEffectColor=0,0,0,40

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "128,255,0"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]

========================================
; MEASURES
========================================
[mTime]
Measure=Time

[mCounterTimer]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? ( mTime - mTimer / 10 ) : mCounterTimer )
Disabled=1

[mTimer]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? mTimer : ( mTime - mCounterTimer ) * 10 )

[mSp]
Measure=Calc
Formula=(( mSp + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mSp]

[mSm]
Measure=Calc
Formula=(( mSm + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mSm]

[mMp]
Measure=Calc
Formula=(( mMp + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mMp]

[mMm]
Measure=Calc
Formula=(( mMm + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mMm]

[mHp]
Measure=Calc
Formula=(( mHp + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mHp]

[mHm]
Measure=Calc
Formula=(( mHm + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mHm]

[mTimerSet]
Measure=Calc
Formula=((( mTimerSet + 10 * mSp - 10 * mSm + 600 * mMp - 600 * mMm + 36000 * mHp - 36000 * mHm + #DefaultInitialValue# ) < 0 ) ? ( #DefaultInitialValue# * ( -1 )) : ( mTimerSet + 10 * mSp - 10 * mSm + 600 * mMp - 600 * mMm + 36000 * mHp - 36000 * mHm ))

[mTimer2]
Measure=Calc
Format=%S
Formula=( #DefaultInitialValue# - mTimer + mTimerSet )
IfBelowValue=1
IfBelowAction=[!DisableMeasure mCounterTimer]
MinValue=0
MaxValue=#MaxVal#
DynamicVariables=1

[mTimer3]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? 1 : ( mTimer2 - 1 ))
IfBelowValue=0
IfBelowAction=[!DisableMeasure mCounterTimer]["#CURRENTPATH#nircmd.exe" #Act#][!HideMeter Stop][!HideMeter Start][!ShowMeter Reset]
DynamicVariables=1

[mTimer4]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? 1 : ( mTimer2 - 1 ))
IfBelowValue=0
IfBelowAction=[PLAY #Alarm#][!HideMeter Stop][!HideMeter Start][!ShowMeter Reset]
DynamicVariables=1

[mTimerHours]
Measure=Calc
Formula=(( FLOOR ( mTimer2 / 36000 )) % 100 )
RegExpSubstitute=1
Substitute="^(.*)$":"0\1","^.*(.{2})$":"\1"

[mTimerMinutes]
Measure=Calc
Formula=(( FLOOR ( mTimer2 / 600 )) % 60 )
RegExpSubstitute=1
Substitute="^(.*)$":"0\1","^.*(.{2})$":"\1"

[mTimerSeconds]
Measure=Calc
Formula=(( FLOOR ( mTimer2 / 10 )) % 60 )
RegExpSubstitute=1
Substitute="^(.*)$":"0\1","^.*(.{2})$":"\1"

========================================
; METERS
========================================
;[TimerDisplay]
;Meter=String
;MeterStyle=sAllText
;MeasureName=mTimerHours
;MeasureName2=mTimerMinutes
;MeasureName3=mTimerSeconds
;FontSize=16
;Text=%1:%2 %3
;InlineSetting=Size | 10
;InlinePattern=.+( .+)
;X=60
;Y=20
;H=24
[sTimerDisplay]
FontSize=16
Group=TimerDisplay


[TimerDisplayHr]
Meter=String
MeterStyle=sAllText | sHighlight | sTimerDisplay
MeasureName=mTimerHours
Text=%1:
MouseScrollUpAction=[!EnableMeasure mHp] [!Redraw]
MouseScrollDownAction=[!EnableMeasure mHm] [!Redraw]
X=40
Y=20

[TimerDisplayMin]
Meter=String
MeterStyle=sAllText | sHighlight | sTimerDisplay
MeasureName=mTimerMinutes
Text=%1
MouseScrollUpAction=[!EnableMeasure mMp] [!Redraw]
MouseScrollDownAction=[!EnableMeasure mMm] [!Redraw]
X=28r
Y=r

[TimerDisplaySec]
Meter=String
MeterStyle=sAllText | sHighlight | sTimerDisplay
MeasureName=mTimerSeconds
FontSize=10
Text=%1
InlineSetting=Size | 10
InlinePattern=.+( .+)
;MouseScrollUpAction=[!EnableMeasure mSp] [!Redraw]
;MouseScrollDownAction=[!EnableMeasure mSm] [!Redraw]
X=26r
Y=9r

========================================
; Actions
========================================
[sAction]
StringAlign=Left
FontColor=255,255,255,200
Hidden=1
X=r
Y=r

[Action1]
Meter=String
MeterStyle=sAllText | sHighlight | sAction
Text=Close Apps
X=10
Y=6

[Action2]
Meter=String
MeterStyle=sAllText | sHighlight | sAction
Text=Hibernate

[Action3]
Meter=String
MeterStyle=sAllText | sHighlight | sAction
Text=Shutdown

[Action4]
Meter=String
MeterStyle=sAllText | sHighlight | sAction
Text=Hybrid S/d

[Action5]
Meter=String
MeterStyle=sAllText | sHighlight | sAction
Text=Restart

[Action6]
Meter=String
MeterStyle=sAllText | sHighlight | sAction
Text=Lock

========================================
; Controls
========================================
[sControls]
Group=Controls
Y=45

[Start]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Start
LeftMouseDownAction=[!EnableMeasure mCounterTimer][!HideMeter Start][!ShowMeter Stop][!HideMeter Reset][!HideMeter Set][!SetOptionGroup TimerDisplay FontColor "255,255,0"][!SetOptionGroup TimerDisplay MeterStyle "sAllText | sTimerDisplay"]
X=25

[Stop]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Stop
LeftMouseDownAction=[!DisableMeasure mCounterTimer][!HideMeter Stop][!ShowMeter Start][!ShowMeter Reset][!ShowMeter Set][!SetOptionGroup TimerDisplay FontColor ""][!SetOptionGroup TimerDisplay MeterStyle "sAllText | sHighlight | sTimerDisplay"]
Hidden=1
X=25

[Reset]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Reset
LeftMouseDownAction=[!DisableMeasure mTimer]
LeftMouseUpAction=[!EnableMeasure mTimer][!ShowMeter Start]
Hidden=1
X=71

[Set]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Set
LeftMouseupAction=[!HideMeterGroup Controls][!ShowMeterGroup SetTimer]   [!SetOption Action1 LeftMouseDownAction """ [!ShowMeter Action2][!HideMeter Action1][!SetVariable Act "CloseApps"][!EnableMeasure mTimer3][!DisableMeasure mTimer4]"""]  [!SetOption Action2 LeftMouseDownAction """ [!ShowMeter Action3][!HideMeter Action2][!SetVariable Act "Shutdown"][!EnableMeasure mTimer3][!DisableMeasure mTimer4]"""]  [!SetOption Action3 LeftMouseDownAction """ [!ShowMeter Action4][!HideMeter Action3][!SetVariable Act "HybridShutdown"][!EnableMeasure mTimer3][!DisableMeasure mTimer4]"""]  [!SetOption Action4 LeftMouseDownAction """ [!ShowMeter Action5][!HideMeter Action4][!SetVariable Act "Restart"][!EnableMeasure mTimer3][!DisableMeasure mTimer4]"""]  [!SetOption Action5 LeftMouseDownAction """ [!ShowMeter Action6][!HideMeter Action5][!SetVariable Act "Lock"][!DisableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action6 LeftMouseDownAction """ [!ShowMeter Action1][!HideMeter Action6][!EnableMeasure mTimer3][!DisableMeasure mTimer4]"""][!DisableMeasure mCounterTimer]
X=118

========================================
; Setting
========================================
[sSetting]
Hidden=1
Group=SetTimer
Y=45

[HrSetUp]
Meter=String
MeterStyle=sAllText | sHighlight | sSetting
Text=+
LeftMouseDownAction=[!EnableMeasure mHp]
X=25

[HrSetDown]
Meter=String
MeterStyle=sAllText | sHighlight | sSetting
Text=-
LeftMouseDownAction=[!EnableMeasure mHm]
X=35

[MinSetUp]
Meter=String
MeterStyle=sAllText | sHighlight | sSetting
Text=+
LeftMouseDownAction=[!EnableMeasure mMp]
X=55

[MinSetDown]
Meter=String
MeterStyle=sAllText | sHighlight | sSetting
Text=-
LeftMouseDownAction=[!EnableMeasure mMm]
X=65

[SecSetUp]
Meter=String
MeterStyle=sAllText | sHighlight | sSetting
Text=+
LeftMouseDownAction=[!EnableMeasure mSp]
X=85

[SecSetDown]
Meter=String
MeterStyle=sAllText | sHighlight | sSetting
Text=-
LeftMouseDownAction=[!EnableMeasure mSm]
X=95

[OK]
Meter=String
MeterStyle=sAllText | sHighlight | sSetting
Text=OK
LeftMouseupAction=[!HideMeterGroup SetTimer][!ShowMeterGroup Controls]   [!ShowMeter Reset][!ShowMeter Start][!SetOption Action1 LeftMouseDownAction ""][!SetOption Action2 LeftMouseDownAction ""][!SetOption Action3 LeftMouseDownAction ""][!SetOption Action4 LeftMouseDownAction ""][!SetOption Action5 LeftMouseDownAction ""][!SetOption Action6 LeftMouseDownAction ""][!ShowMeter Start][!ShowMeter Reset][!HideMeter Stop]
X=118

========================================
; Round Bar
========================================
[sRoundBar]
LineStart=12
LineLength=16
StartAngle=(Rad(270))
RotationAngle=6.2831853
Antialias=1
Solid=1
X=130
Y=20

[RoundBarBack]
Meter=RoundLine
MeterStyle=sRoundBar
LineColor=255,85,85

[RoundBarFore]
Meter=RoundLine
MeasureName=mTimer2
MeterStyle=sRoundBar
LineColor=100,100,200
LineWidth=4

========================================
; Menu
========================================
;[Menu]
;Meter=IMAGE
;ImageName=;MenuXR.png
;Hidden=1
;Group=Menu
;X=127
;Y=0
;
;[Close]
;Meter=Shape
;Shape=Rectangle 127,0,20,20,15 | FillColor 200,100,100 | StrokeWidth 2 | Extend StrokeAlpha
;StrokeAlpha=Stroke Color 128,255,0,100
;LeftMouseupAction=!DeactivateConfig
;MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 0,255,255,255"] [!UpdateMeter *][!Redraw]
;MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 128,255,0,100"] [!UpdateMeter *] [!Redraw] 
;DynamicVariables=1
;Hidden=1
;Group=Menu
;
;[More]
;Meter=Shape
;Shape=Rectangle 127,21,20,20,15 | FillColor 100,100,200 | StrokeWidth 2 | Extend StrokeAlpha
;StrokeAlpha=Stroke Color 128,255,0,100
;LeftMouseupAction=!ActivateConfig "#CURRENTCONFIG#" "Stopwatch.ini"
;MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 0,255,255,255"] [!UpdateMeter *][!Redraw]
;MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 128,255,0,100"] [!UpdateMeter *] [!Redraw] 
;DynamicVariables=1
;Hidden=1
;Group=Menu
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7118
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

sl23 wrote: July 30th, 2021, 9:06 pm New version with MouseScroll working, but not perfect... yet!
Still can't figure out that RoundBar issue though, any ideas?
If I understood correctly what you want, adding either this:

Code: Select all

OnChangeAction=[!SetVariable MaxVal (#DefaultInitialValue#-[mTimer:]+[mTimerSet:])]
DynamicVariables=1
or this:

Code: Select all

IfCondition=(mTimerSet>0)
IfTrueAction=[!SetVariable MaxVal (#DefaultInitialValue#-[mTimer:]+[mTimerSet:])]
IfConditionMode=1
DynamicVariables=1
to your [mTimerSet] measure should do. Unless balala thinks otherwise, since he knows better the ins and outs of this skin.
Basically, it's about changing the MaxValue option's value in [mTimer2] according to the time being set.

P.S. Normally, the first variant would be logical, but personally I have this slight distrust in how OnChangeAction works in relation with other things that happen in a skin, so I included a (not that logical, but feasible) alternative. Don't let my personal opinions change your mind though, choose what you think it's best.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Thanks for the solution. :thumbup:
The first one seems to work ok, so for now I'll stick to that.
- MuLab -
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Latest code on this one:

Code: Select all

[Rainmeter]
Author=zzeneg & balala
AppVersion=10
Update=50
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
;MouseOverAction=[!ShowMeterGroup Menu]
;MouseLeaveAction=[!HideMeterGroup Menu]
OnRefreshAction=[!ShowMeter Action1][!DisableMeasure mTimer4]
AccurateText=1

[Bg]
Meter=Shape
Shape=Rectangle Rectangle 1,1,150,60,5 | Extend StrokeSize | Stroke Color 128,255,0,100 | Fill Color 0,0,0,120
StrokeSize=StrokeWidth 0
MouseOverAction=[!SetOption #CURRENTSECTION# StrokeSize "StrokeWidth 2"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeSize "StrokeWidth 0"][!UpdateMeter *][!Redraw]
StrokeAlpha=Stroke Color 128,255,0,100
DynamicVariables=1

[Variables]
Alarm=Alarm.wav

DefaultInitialValue=100
MaxVal=#DefaultInitialValue#
;DefaultInitialValue is the time (6000=10mins in one-tenth of seconds!) which appears when you refresh the skin. 

CloseApps=CloseApps.bat

Hibernate=rundll32.exe powrprof.dll,SetSuspendState
Shutdown=shutdown.exe -s -t 60 -f
HybridShutdown=shutdown.exe /s /hybrid /f /t 60
Restart=shutdown.exe -r -t 0
Lock=rundll32.exe user32.dll, LockWorkStation

Act=#CloseApps#

[mPlayer]
Measure=Plugin
Plugin=NowPlaying
PlayerName=CAD
PlayerType=Title
DisableLeadingZero=1
========================================
; STYLES
========================================
[sAllText]
FontFace=Aller
StringStyle=Bold
StringAlign=Center
FontSize=9
FontColor=255,255,255,200
AntiAlias=1

StringEffect=SHADOW
FontEffectColor=0,0,0,40

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "128,255,0"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]

========================================
; MEASURES
========================================
[mTime]
Measure=Time

[mCounterTimer]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? ( mTime - mTimer / 10 ) : mCounterTimer )
Disabled=1

[mTimer]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? mTimer : ( mTime - mCounterTimer ) * 10 )

[mSp]
Measure=Calc
Formula=(( mSp + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mSp]

[mSm]
Measure=Calc
Formula=(( mSm + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mSm]

[mMp]
Measure=Calc
Formula=(( mMp + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mMp]

[mMm]
Measure=Calc
Formula=(( mMm + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mMm]

[mHp]
Measure=Calc
Formula=(( mHp + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mHp]

[mHm]
Measure=Calc
Formula=(( mHm + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mHm]

[mTimerSet]
Measure=Calc
Formula=((( mTimerSet + 10 * mSp - 10 * mSm + 600 * mMp - 600 * mMm + 36000 * mHp - 36000 * mHm + #DefaultInitialValue# ) < 0 ) ? ( #DefaultInitialValue# * ( -1 )) : ( mTimerSet + 10 * mSp - 10 * mSm + 600 * mMp - 600 * mMm + 36000 * mHp - 36000 * mHm ))
OnChangeAction=[!SetVariable MaxVal (#DefaultInitialValue#-[mTimer:]+[mTimerSet:])]
DynamicVariables=1

[mTimer2]
Measure=Calc
Format=%S
Formula=( #DefaultInitialValue# - mTimer + mTimerSet )
IfBelowValue=1
IfBelowAction=[!DisableMeasure mCounterTimer]
MinValue=0
MaxValue=#MaxVal#
DynamicVariables=1

[mTimer3]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? 1 : ( mTimer2 - 1 ))
IfBelowValue=0
IfBelowAction=[!DisableMeasure mCounterTimer][#Act#][!HideMeter Stop][!HideMeter Start][!ShowMeter Reset]
DynamicVariables=1

[mTimer4]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? 1 : ( mTimer2 - 1 ))
IfBelowValue=0
IfBelowAction=[PLAY #Alarm#][!HideMeter Stop][!HideMeter Start][!ShowMeter Reset]
DynamicVariables=1

[mTimerHours]
Measure=Calc
Formula=(( FLOOR ( mTimer2 / 36000 )) % 100 )
RegExpSubstitute=1
Substitute="^(.*)$":"0\1","^.*(.{2})$":"\1"

[mTimerMinutes]
Measure=Calc
Formula=(( FLOOR ( mTimer2 / 600 )) % 60 )
RegExpSubstitute=1
Substitute="^(.*)$":"0\1","^.*(.{2})$":"\1"

[mTimerSeconds]
Measure=Calc
Formula=(( FLOOR ( mTimer2 / 10 )) % 60 )
RegExpSubstitute=1
Substitute="^(.*)$":"0\1","^.*(.{2})$":"\1"

========================================
; METERS
========================================
[sTimerDisplay]
FontSize=16
Group=TimerDisplay

[TimerDisplayHr]
Meter=String
MeterStyle=sAllText | sTimerDisplay
MeasureName=mTimerHours
Text=%1:
MouseScrollUpAction=
MouseScrollDownAction=
X=40
Y=20

[TimerDisplayMin]
Meter=String
MeterStyle=sAllText | sTimerDisplay
MeasureName=mTimerMinutes
Text=%1
MouseScrollUpAction=
MouseScrollDownAction=
X=28r
Y=r

[TimerDisplaySec]
Meter=String
MeterStyle=sAllText | sTimerDisplay
MeasureName=mTimerSeconds
FontSize=10
Text=%1
InlineSetting=Size | 10
InlinePattern=.+( .+)
;MouseScrollUpAction=[!EnableMeasure mSp] [!Redraw]
;MouseScrollDownAction=[!EnableMeasure mSm] [!Redraw]
X=26r
Y=9r

========================================
; Actions
========================================
[sAction]
StringAlign=Left
FontColor=255,255,255,200
Hidden=1
Group=Action
X=r
Y=r

[Action1]
Meter=String
MeterStyle=sAllText | sAction
Text=Close Apps
X=10
Y=6

[Action2]
Meter=String
MeterStyle=sAllText | sAction
Text=Hibernate

[Action3]
Meter=String
MeterStyle=sAllText | sAction
Text=Shutdown

[Action4]
Meter=String
MeterStyle=sAllText | sAction
Text=Hybrid S/d

[Action5]
Meter=String
MeterStyle=sAllText | sAction
Text=Restart

[Action6]
Meter=String
MeterStyle=sAllText | sAction
Text=Lock

========================================
; Controls
========================================
[sControls]
Group=Controls
Y=45

[Start]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Start
LeftMouseDownAction=[!EnableMeasure mCounterTimer][!HideMeter Start][!ShowMeter Stop][!HideMeter Reset][!HideMeter Set][!SetOptionGroup TimerDisplay FontColor "255,255,0"]
X=25

[Stop]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Stop
LeftMouseDownAction=[!DisableMeasure mCounterTimer][!HideMeter Stop][!ShowMeter Start][!ShowMeter Reset][!ShowMeter Set][!SetOptionGroup TimerDisplay FontColor ""]
Hidden=1
X=25

[Reset]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Reset
LeftMouseDownAction=[!DisableMeasure mTimer]
LeftMouseUpAction=[!EnableMeasure mTimer][!ShowMeter Start][PlayStop "#Alarm#"]
Hidden=1
X=71

[Set]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Set
LeftMouseUpAction=[!HideMeterGroup Controls][!ShowMeterGroup SetTimer]   [!SetOption Action1 LeftMouseDownAction """ [!ShowMeter Action2][!HideMeter Action1][!SetVariable Act "#CloseApps#"][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action2 LeftMouseDownAction """ [!ShowMeter Action3][!HideMeter Action2][!SetVariable Act "#Shutdown#"][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action3 LeftMouseDownAction """ [!ShowMeter Action4][!HideMeter Action3][!SetVariable Act "#HybridShutdown#"][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action4 LeftMouseDownAction """ [!ShowMeter Action5][!HideMeter Action4][!SetVariable Act "#Restart#"][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action5 LeftMouseDownAction """ [!ShowMeter Action6][!HideMeter Action5][!SetVariable Act "#Lock#"][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action6 LeftMouseDownAction """ [!ShowMeter Action1][!HideMeter Action6][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""][!DisableMeasure mCounterTimer]   [!SetOptionGroup TimerDisplay MeterStyle "sAllText | sHighlight | sTimerDisplay"][!SetOptionGroup Action MeterStyle "sAllText | sHighlight | sAction"]   [!SetOption TimerDisplayHr MouseScrollUpAction """ [!EnableMeasure mHp]"""]   [!SetOption TimerDisplayHr MouseScrollDownAction """ [!EnableMeasure mHm]"""]   [!SetOption TimerDisplayMin MouseScrollUpAction """ [!EnableMeasure mMp]"""]   [!SetOption TimerDisplayMin MouseScrollDownAction """ [!EnableMeasure mMm]"""]
X=118

[OK]
Meter=String
MeterStyle=sAllText | sHighlight | sSetting
Text=OK
LeftMouseupAction=[!HideMeterGroup SetTimer][!ShowMeterGroup Controls]   [!ShowMeter Reset][!ShowMeter Start][!HideMeter Stop]   [!SetOptionGroup Action LeftMouseDownAction ""][!SetOptionGroup TimerDisplay MouseScrollUpAction ""][!SetOptionGroup TimerDisplay MouseScrollDownAction ""]   [!SetOptionGroup TimerDisplay MeterStyle "sAllText | sTimerDisplay"]   [!SetOptionGroup Action MeterStyle "sAllText | sAction"]
Hidden=1
Group=SetTimer
X=118
Y=45

========================================
; Round Bar
========================================
[sRoundBar]
LineStart=12
LineLength=16
StartAngle=(Rad(270))
RotationAngle=6.2831853
Antialias=1
Solid=1
X=130
Y=20

[RoundBarBack]
Meter=RoundLine
MeterStyle=sRoundBar
LineColor=255,255,255,20

[RoundBarFore]
Meter=RoundLine
MeasureName=mTimer2
MeterStyle=sRoundBar
LineColor=100,100,200
LineWidth=4
Ok so everything seems to work ok wrt MouseScroll and the RoundBar, although I have one issue with Scroll updating being very sluggish. I just don't understand the need for such a high Update=50? It's just that other skins are set to Update=1000 and react instantly to the changes. I've tried adding [!UpdateMeter *] or Measure and [!Redraw]

Also, in the [Set] section there are bangs to [!EnableMeasure mTimer3][!EnableMeasure mTimer4], what exactly is this doing? The problem here is that changing these has no effect on playing the alarm or even acting on the Act variable. I have the Variables in order as balala described, so that the Act variable is after the others that it is set to. But this just won't work.

Btw, here's the batch file code I used to test Act=#CloseApps#

Code: Select all

@echo
cls
taskkill /IM foobar2000.exe /T /F
exit
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7118
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

sl23 wrote: July 31st, 2021, 11:50 amI just don't understand the need for such a high Update=50? It's just that other skins are set to Update=1000 and react instantly to the changes. I've tried adding [!UpdateMeter *] or Measure and [!Redraw]

Also, in the [Set] section there are bangs to [!EnableMeasure mTimer3][!EnableMeasure mTimer4], what exactly is this doing? The problem here is that changing these has no effect on playing the alarm or even acting on the Act variable.
Same here, I was wondering the same thing - that's why I said balala would probably offer more of an insight into these, since he's the original coder and all. That being said, he probably had some reason for that when he wrote the skins, but it's quite likely he forgot it after all these years - it would probably be the same for me in a similar scenario. After all, after just a couple of months writing some (more complex, I admit) code in my own skins, I had to start all over and read it and wondered "what/why the heck did I just did here at that time?!" :lol:
sl23 wrote: July 31st, 2021, 11:50 amBtw, here's the batch file code I used to test Act=#CloseApps#

Code: Select all

@echo
cls
taskkill /IM foobar2000.exe /T /F
exit
Bear in mind that this won't work to kill some (Micro...cough cough...$oft legit...I mean telemetry) processes, since it's not ran as an administrator. Even if you did, I'm not sure it will work for those cases (and the alternative is not so straightforward for a non-technical user). Of course, if it's only about foobar2000 and the like, it will do its job just fine.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

Thanks for the feedback. Yeah I was kind of hoping balala would take a look at some point.

Regarding that batch file, I already discussed with jsmorley about that and he pointed me to the RunCommand plugin with some code, so that's sorted, just need to figure out how to get the timer to activate it!!! O.O
- MuLab -
User avatar
balala
Rainmeter Sage
Posts: 16141
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Simple countdown timer

Post by balala »

sl23 wrote: July 31st, 2021, 8:54 pm Yeah I was kind of hoping balala would take a look at some point.
I can take, but today had a more or less full day. However I thought Yincognito fixed your problem. What should I take a look to?
User avatar
sl23
Posts: 1140
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Simple countdown timer

Post by sl23 »

No problem, you are allowed a real life outside of this forum! :D
Yincognito solved the RoundBar issue. I'm onto the next one now :Whistle

Latest code:

Code: Select all

[Rainmeter]
Update=50
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
;MouseOverAction=[!ShowMeterGroup Menu]
;MouseLeaveAction=[!HideMeterGroup Menu]
OnRefreshAction=[!ShowMeter Action1][!DisableMeasure mTimer4]
AccurateText=1

[Metadata]
Name=Countdown Timer
Author=zzeneg & balala, Yincognito, eclectic tech, death crafter, jsmorley
Version=2021.7.31

[Bg]
Meter=Shape
Shape=Rectangle Rectangle 1,1,150,60,5 | Extend StrokeSize | Stroke Color 128,255,0,100 | Fill Color 0,0,0,120
StrokeSize=StrokeWidth 0
MouseOverAction=[!SetOption #CURRENTSECTION# StrokeSize "StrokeWidth 2"][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeSize "StrokeWidth 0"][!UpdateMeter *][!Redraw]
StrokeAlpha=Stroke Color 128,255,0,100
DynamicVariables=1

[Variables]
Alarm=Alarm.wav

DefaultTime=100
MaxVal=#DefaultTime#
;DefaultTime is the time (6000=10mins in one-tenth of seconds!) which appears when you refresh the skin. 

CloseApps=[!CommandMeasure mClose "Run"]
APP1=Dolphin.exe
APP2=pcsx2.exe
APP3=rpcs3.exe
APP4=retroarch.exe
APP5=

Hibernate=rundll32.exe powrprof.dll,SetSuspendState
Shutdown=shutdown.exe -s -t 60 -f
HybridShutdown=shutdown.exe /s /hybrid /f /t 60
Restart=shutdown.exe -r -t 0
Lock=rundll32.exe user32.dll, LockWorkStation

Act=#CloseApps#

========================================
; STYLES
========================================
[sAllText]
FontFace=Aller
StringStyle=Bold
StringAlign=Center
FontSize=9
FontColor=255,255,255,200
StringEffect=Shadow
FontEffectColor=0,0,0,150
AntiAlias=1

[sHighlight]
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "128,255,0"] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor ""] [!UpdateMeter #CURRENTSECTION#] [!Redraw]

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

[MeterOne]
Meter=String
FontSize=13
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Close Apps
LeftMouseUpAction=[!CommandMeasure mClose "Run"]
Y=60
========================================
; MEASURES
========================================
[mTime]
Measure=Time

[mCounterTimer]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? ( mTime - mTimer / 10 ) : mCounterTimer )
Disabled=1

[mTimer]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? mTimer : ( mTime - mCounterTimer ) * 10 )

[mSp]
Measure=Calc
Formula=(( mSp + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mSp]

[mSm]
Measure=Calc
Formula=(( mSm + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mSm]

[mMp]
Measure=Calc
Formula=(( mMp + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mMp]

[mMm]
Measure=Calc
Formula=(( mMm + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mMm]

[mHp]
Measure=Calc
Formula=(( mHp + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mHp]

[mHm]
Measure=Calc
Formula=(( mHm + 1 ) % 2 )
Disabled=1
IfAboveValue=0
IfAboveAction=[!DisableMeasure mHm]

[mTimerSet]
Measure=Calc
Formula=((( mTimerSet + 10 * mSp - 10 * mSm + 600 * mMp - 600 * mMm + 36000 * mHp - 36000 * mHm + #DefaultTime# ) < 0 ) ? ( #DefaultTime# * ( -1 )) : ( mTimerSet + 10 * mSp - 10 * mSm + 600 * mMp - 600 * mMm + 36000 * mHp - 36000 * mHm ))
OnChangeAction=[!SetVariable MaxVal (#DefaultTime#-[mTimer:]+[mTimerSet:])]
DynamicVariables=1

[mTimer2]
Measure=Calc
Format=%S
Formula=( #DefaultTime# - mTimer + mTimerSet )
IfBelowValue=1
IfBelowAction=[!DisableMeasure mCounterTimer]
MinValue=0
MaxValue=#MaxVal#
DynamicVariables=1

[mTimer3]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? 1 : ( mTimer2 - 1 ))
IfBelowValue=0
IfBelowAction=[!DisableMeasure mCounterTimer][#Act#][!HideMeter Stop][!HideMeter Start][!ShowMeter Reset]
DynamicVariables=1

[mTimer4]
Measure=Calc
Formula=(( mCounterTimer = 0 ) ? 1 : ( mTimer2 - 1 ))
IfBelowValue=0
IfBelowAction=[PLAY #Alarm#][!HideMeter Stop][!HideMeter Start][!ShowMeter Reset]
DynamicVariables=1

[mTimerHours]
Measure=Calc
Formula=(( FLOOR ( mTimer2 / 36000 )) % 100 )
RegExpSubstitute=1
Substitute="^(.*)$":"0\1","^.*(.{2})$":"\1"

[mTimerMinutes]
Measure=Calc
Formula=(( FLOOR ( mTimer2 / 600 )) % 60 )
RegExpSubstitute=1
Substitute="^(.*)$":"0\1","^.*(.{2})$":"\1"

[mTimerSeconds]
Measure=Calc
Formula=(( FLOOR ( mTimer2 / 10 )) % 60 )
RegExpSubstitute=1
Substitute="^(.*)$":"0\1","^.*(.{2})$":"\1"

========================================
; METERS
========================================
[sTimerDisplay]
FontSize=16
Group=TimerDisplay

[TimerDisplayHr]
Meter=String
MeterStyle=sAllText | sTimerDisplay
MeasureName=mTimerHours
Text=%1:
MouseScrollUpAction=
MouseScrollDownAction=
X=40
Y=20

[TimerDisplayMin]
Meter=String
MeterStyle=sAllText | sTimerDisplay
MeasureName=mTimerMinutes
Text=%1
MouseScrollUpAction=
MouseScrollDownAction=
X=28r
Y=r

[TimerDisplaySec]
Meter=String
MeterStyle=sAllText | sTimerDisplay
MeasureName=mTimerSeconds
FontSize=10
Text=%1
InlineSetting=Size | 10
InlinePattern=.+( .+)
;MouseScrollUpAction=[!EnableMeasure mSp] [!Redraw]
;MouseScrollDownAction=[!EnableMeasure mSm] [!Redraw]
X=26r
Y=9r

========================================
; Actions
========================================
[sAction]
StringAlign=Left
FontColor=255,255,255,200
Hidden=1
Group=Action
X=r
Y=r

[Action1]
Meter=String
MeterStyle=sAllText | sAction
Text=Close Apps
X=10
Y=6

[Action2]
Meter=String
MeterStyle=sAllText | sAction
Text=Hibernate

[Action3]
Meter=String
MeterStyle=sAllText | sAction
Text=Shutdown

[Action4]
Meter=String
MeterStyle=sAllText | sAction
Text=Hybrid S/d

[Action5]
Meter=String
MeterStyle=sAllText | sAction
Text=Restart

[Action6]
Meter=String
MeterStyle=sAllText | sAction
Text=Lock

========================================
; Controls
========================================
[sControls]
Group=Controls
Y=45

[Start]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Start
LeftMouseDownAction=[!EnableMeasure mCounterTimer][!HideMeter Start][!ShowMeter Stop][!HideMeter Reset][!HideMeter Set][!SetOptionGroup TimerDisplay FontColor "255,255,0"]
X=25

[Stop]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Stop
LeftMouseDownAction=[!DisableMeasure mCounterTimer][!HideMeter Stop][!ShowMeter Start][!ShowMeter Reset][!ShowMeter Set][!SetOptionGroup TimerDisplay FontColor ""]
Hidden=1
X=25

[Reset]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Reset
LeftMouseDownAction=[!DisableMeasure mTimer]
LeftMouseUpAction=[!EnableMeasure mTimer][!ShowMeter Start][!ShowMeter Set][!HideMeter Reset][PlayStop "#Alarm#"]
Hidden=1
X=71

[Set]
Meter=String
MeterStyle=sAllText | sHighlight | sControls
Text=Set
LeftMouseUpAction=[!HideMeterGroup Controls][!ShowMeterGroup SetTimer]   [!SetOption Action1 LeftMouseDownAction """ [!ShowMeter Action2][!HideMeter Action1][!SetVariable Act "#CloseApps#"][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action2 LeftMouseDownAction """ [!ShowMeter Action3][!HideMeter Action2][!SetVariable Act "#Shutdown#"][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action3 LeftMouseDownAction """ [!ShowMeter Action4][!HideMeter Action3][!SetVariable Act "#HybridShutdown#"][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action4 LeftMouseDownAction """ [!ShowMeter Action5][!HideMeter Action4][!SetVariable Act "#Restart#"][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action5 LeftMouseDownAction """ [!ShowMeter Action6][!HideMeter Action5][!SetVariable Act "#Lock#"][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""]  [!SetOption Action6 LeftMouseDownAction """ [!ShowMeter Action1][!HideMeter Action6][!EnableMeasure mTimer3][!EnableMeasure mTimer4]"""][!DisableMeasure mCounterTimer]   [!SetOptionGroup TimerDisplay MeterStyle "sAllText | sHighlight | sTimerDisplay"][!SetOptionGroup Action MeterStyle "sAllText | sHighlight | sAction"]   [!SetOption TimerDisplayHr MouseScrollUpAction """ [!EnableMeasure mHp]"""]   [!SetOption TimerDisplayHr MouseScrollDownAction """ [!EnableMeasure mHm]"""]   [!SetOption TimerDisplayMin MouseScrollUpAction """ [!EnableMeasure mMp]"""]   [!SetOption TimerDisplayMin MouseScrollDownAction """ [!EnableMeasure mMm]"""]
X=118

[OK]
Meter=String
MeterStyle=sAllText | sHighlight | sSetting
Text=OK
LeftMouseupAction=[!HideMeterGroup SetTimer][!ShowMeterGroup Controls]   [!HideMeter Reset][!ShowMeter Start][!HideMeter Stop]   [!SetOptionGroup Action LeftMouseDownAction ""][!SetOptionGroup TimerDisplay MouseScrollUpAction ""][!SetOptionGroup TimerDisplay MouseScrollDownAction ""]   [!SetOptionGroup TimerDisplay MeterStyle "sAllText | sTimerDisplay"]   [!SetOptionGroup Action MeterStyle "sAllText | sAction"]
Hidden=1
Group=SetTimer
X=118
Y=45

========================================
; Round Bar
========================================
[sRoundBar]
LineStart=12
LineLength=16
StartAngle=(Rad(270))
RotationAngle=6.2831853
Antialias=1
Solid=1
X=130
Y=20

[RoundBarBack]
Meter=RoundLine
MeterStyle=sRoundBar
LineColor=255,255,255,20

[RoundBarFore]
Meter=RoundLine
MeasureName=mTimer2
MeterStyle=sRoundBar
LineColor=100,100,200
LineWidth=4
Solid=0

========================================
; Menu
========================================
;[Menu]
;Meter=IMAGE
;ImageName=;MenuXR.png
;Hidden=1
;Group=Menu
;X=127
;Y=0
;
;[Close]
;Meter=Shape
;Shape=Rectangle 127,0,20,20,15 | FillColor 200,100,100 | StrokeWidth 2 | Extend StrokeAlpha
;StrokeAlpha=Stroke Color 128,255,0,100
;LeftMouseupAction=!DeactivateConfig
;MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 0,255,255,255"] [!UpdateMeter *][!Redraw]
;MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 128,255,0,100"] [!UpdateMeter *] [!Redraw] 
;DynamicVariables=1
;Hidden=1
;Group=Menu
;
;[More]
;Meter=Shape
;Shape=Rectangle 127,21,20,20,15 | FillColor 100,100,200 | StrokeWidth 2 | Extend StrokeAlpha
;StrokeAlpha=Stroke Color 128,255,0,100
;LeftMouseupAction=!ActivateConfig "#CURRENTCONFIG#" "Stopwatch.ini"
;MouseOverAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 0,255,255,255"] [!UpdateMeter *][!Redraw]
;MouseLeaveAction=[!SetOption #CURRENTSECTION# StrokeAlpha "Stroke Color 128,255,0,100"] [!UpdateMeter *] [!Redraw] 
;DynamicVariables=1
;Hidden=1
;Group=Menu

Essentially, I'm trying to understand how the [Set] section works as I can't get any alarm to sound or acts acted upon. The timer reaches zero and... that's it... nothing happens. What am I missing?

Also, this:
I have one issue with Scroll updating being very sluggish. I just don't understand the need for such a high Update=50? It's just that my other skins are set to Update=1000 and react instantly to the changes. I've tried adding [!UpdateMeter *] or Measure and [!Redraw]
No rush balala, I appreciate the help when you have time to. :thumbup:
Last edited by sl23 on August 1st, 2021, 12:16 pm, edited 2 times in total.
- MuLab -
User avatar
Yincognito
Rainmeter Sage
Posts: 7118
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Simple countdown timer

Post by Yincognito »

sl23 wrote: July 31st, 2021, 8:54 pmRegarding that batch file, I already discussed with jsmorley about that and he pointed me to the RunCommand plugin with some code, so that's sorted, just need to figure out how to get the timer to activate it!!! O.O
Let me know of that code as well. I have my own, it works perfectly, but since it's about PowerShell, is also slower (compared to CMD related alternatives), so if by any chance that code is fast AND effective, I'm interested in finding out more about the approach.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth