It is currently November 29th, 2021, 11:47 am

Shopping days left!

Clocks and timer skins
User avatar
jsmorley
Developer
Posts: 22414
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Shopping days left!

Post by jsmorley »

ChrismasCountdown_1.0.rmskin
1.png

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureNow]
Measure=Time

[MeasureChristmas]
Measure=Time
TimeStamp=12/25/2016 00:00:00
TimeStampFormat=%m/%d/%Y %H:%M:%S

[MeasureSecondsDiff]
Measure=Calc
Formula=([MeasureChristmas:TimeStamp] - [MeasureNow:TimeStamp])
DynamicVariables=1

[MeasureFormatSeconds]
Measure=Script
ScriptFile=FormatSeconds.lua

[MeterChristmasHeader]
Meter=String
FontSize=54
FontFace=KingThings Christmas 2
InlineSetting=GradientColor | 180 | 240,34,34 ; 0.1 | 92,240,34 ; 0.5 | 34,181,240 ; 1.0
InlinePattern=.*
SolidColor=0,0,0,1
AntiAlias=1
Text=Christmas is in

[MeterChristmasCountdown]
Meter=String
Y=-5R
FontSize=15
InlineSetting=GradientColor | 180 | 240,34,34 ; 0.1 | 92,240,34 ; 0.5 | 34,181,240 ; 1.0
InlinePattern=.*
SolidColor=0,0,0,1
AntiAlias=1

Code: Select all

function Initialize()

	measureSecondsDiff = SKIN:GetMeasure('MeasureSecondsDiff')

end

function Update()

	secondsDiff = measureSecondsDiff:GetValue()
	diffDays, diffHours, diffMinutes, diffSeconds = FormatSeconds(math.abs(secondsDiff))
	
	if diffDays == 1 then
		outputDays = diffDays..' Day'
	else
		outputDays = diffDays..' Days'
	end
   
	if diffHours == 1 then
		outputHours = diffHours..' Hour'
	else
		outputHours = diffHours..' Hours'
	end
   
	if diffMinutes == 1 then
		outputMinutes = diffMinutes..' Minute'
	else
		outputMinutes = diffMinutes..' Minutes'
	end   
   
	if diffSeconds == 1 then
		outputSeconds = diffSeconds..' Second'
	else
		outputSeconds = diffSeconds..' Seconds'
	end
	
	if diffDays > 0 then
		outputString = outputDays..'  '..outputHours..'  '..outputMinutes..'  '..outputSeconds
	elseif diffHours > 0 then
		outputString = outputHours..'  '..outputMinutes..'  '..outputSeconds
	elseif diffMinutes > 0 then
		outputString = outputMinutes..'  '..outputSeconds
	else
		outputString = outputSeconds
	end
   
   SKIN:Bang('!SetOption', 'MeterChristmasCountdown', 'Text', outputString)	
	
	return secondsDiff

end

function FormatSeconds(secondsArg)

   local days = math.floor(secondsArg / 86400)
   local remainder = secondsArg % 86400
   local hours = math.floor(remainder / 3600)
   local remainder = remainder % 3600
   local minutes = math.floor(remainder / 60)
   local seconds = remainder % 60
   
   return days, hours, minutes, seconds
   
end
You do not have the required permissions to view the files attached to this post.