Note that this is based on actual elapsed time, not just counting skin updates.
Timer.ini:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
RightMouseUpAction=[!SkinCustomMenu]
ContextTitle=Start Timer
ContextAction=[!EnableMeasureGroup Timers][!UpdateMeasureGroup Timers]
ContextTitle2=Stop Timer
ContextAction2=[!Refresh]
ContextTitle3=----
ContextAction3=[]
ContextTitle4=Edit Time Values
ContextAction4=["#CURRENTPATH#TimeSettings.inc"]
ContextTitle5=----
ContextAction5=[]
ContextTitle6=More actions ...
ContextAction6=[!SkinMenu]
LeftMouseUpAction=[PlayStop][!Refresh]
[Variables]
@Include=TimeSettings.inc
ActionToTake=[PlayLoop "#@#Sounds\Alarm.wav"]
[MeasureNow]
Measure=Time
Group=Timers
UpdateDivider=-1
Disabled=1
[MeasureTotalSeconds]
Measure=Calc
Group=Timers
Formula=(#TimerHours# * 3600) + (#TimerMinutes# * 60) + #TimerSeconds#
UpdateDivider=-1
Disabled=1
[MeasureTarget]
Measure=Time
Group=Timers
Format=%#m/%#d/%Y %#H:%M:%S
TimeStamp=([MeasureNow:TimeStamp] + [MeasureTotalSeconds])
UpdateDivider=1
Disabled=1
DynamicVariables=1
OnUpdateAction=[!SetVariable Target "[MeasureTarget]"][!UpdateMeasure MeasureLua]
[MeasureLua]
Measure=Script
Group=Timers
ScriptFile=#CURRENTPATH#Timer.lua
IfCondition=MeasureLua <= 0
IfTrueAction=#ActionToTake#
Disabled=1
[MeasureHours]
Measure=Calc
Formula=#TimerHours#
[MeasureMinutes]
Measure=Calc
Formula=#TimerMinutes#
[MeasureSeconds]
Measure=Calc
Formula=#TimerSeconds#
[MeterBack]
Meter=Shape
Shape=Rectangle 0.75,0.75,291,98,12 | StrokeWidth 1.5 | Stroke Color 150,150,150,255 | Fill Color 0,0,0,255
[MeterHours]
Meter=Bitmap
MeasureName=MeasureHours
X=10
Y=10
BitmapImage=#@#Nixie\digits60.png
BitmapFrames=10
BitmapExtend=1
BitmapDigits=2
[MeterMinutes]
Meter=Bitmap
MeasureName=MeasureMinutes
X=105
Y=10
BitmapImage=#@#Nixie\digits60.png
BitmapFrames=10
BitmapExtend=1
BitmapDigits=2
[MeterSeconds]
Meter=Bitmap
MeasureName=MeasureSeconds
X=201
Y=10
BitmapImage=#@#Nixie\digits60.png
BitmapFrames=10
BitmapExtend=1
BitmapDigits=2
[MeterHoursText]
Meter=String
X=30
Y=70
FontSize=9
FontColor=255,228,110,255
FontWeight=400
AntiAlias=1
Text=HOURS
[MeterMinutesText]
Meter=String
X=119
Y=70
FontSize=9
FontColor=255,228,110,255
FontWeight=400
AntiAlias=1
Text=MINUTES
[MeterSecondsText]
Meter=String
X=211
Y=70
FontSize=9
FontColor=255,228,110,255
FontWeight=400
AntiAlias=1
Text=SECONDS
Code: Select all
function Update()
targetString = SKIN:GetVariable('Target')
timeTarget = TimeStamp(targetString)
timeNow = os.time(os.date('*t'))
countDown = os.difftime(timeTarget, timeNow)
if countDown < 0 then countDown = 0 end
weeks, days, hours, minutes, seconds = FormatSeconds(countDown)
SKIN:Bang('!SetOption', 'MeasureHours', 'Formula', hours)
SKIN:Bang('!SetOption', 'MeasureMinutes', 'Formula', minutes)
SKIN:Bang('!SetOption', 'MeasureSeconds', 'Formula', seconds)
return(countDown)
end
function TimeStamp(targetString)
-- date format: 7/26/2017 8:32:10
month, day, year, hour, min, sec =
string.match(targetString, "(%d+)/(%d+)/(%d+) (%d+):(%d+):(%d+)")
currentTimeTable = os.date()
currentDST = currentTimeTable['isdst']
timeStamp = os.time({year=year, month=month, day=day, hour=hour, min=min, sec=sec, isdst=currentDST})
return timeStamp
end
function FormatSeconds(secondsArg)
weeks = math.floor(secondsArg / 604800)
remainder = secondsArg % 604800
days = math.floor(remainder / 86400)
remainder = remainder % 86400
hours = math.floor(remainder / 3600)
remainder = remainder % 3600
minutes = math.floor(remainder / 60)
seconds = remainder % 60
return weeks, days, hours, minutes, seconds
end
Set the amount of time in TimeSettings.inc. This can be accessed by right-clicking the skin.
Code: Select all
[Variables]
TimerHours=0
TimerMinutes=0
TimerSeconds=20