It is currently April 18th, 2024, 1:06 pm

[SOLVED] Adding Time to Time?

Get help with creating, editing & fixing problems with skins
User avatar
nmdelrio
Posts: 74
Joined: June 28th, 2015, 12:51 pm
Location: Paranaque City, Philippines

[SOLVED] Adding Time to Time?

Post by nmdelrio »

How can I add time to a time variable?

I am trying to add some seconds (or minutes) to a time variable.

Code: Select all

ActivateAction1=57:30
What would be the correct syntax? How do I add some seconds or minutes to #ActivateAction1# ?

Code: Select all

IfMatch2=(#ActivateAction1# + 2secs)
Basically, the aim is to carry out an Actions some secs/mins after a set time variable.

Here's the rest.

Code: Select all

[Variables]
;format MM:SS
ActivateAction1=57:30

[measureTime]
Measure=TIME
Format=%M:%S
IfMatch=#ActivateAction1#
IfMatchAction=[!SetOption meterText FontColor "255,0,0,255"]
IfMatch2=(#ActivateAction1# + 2secs)
IfMatchAction2=[!SetOption meterText FontColor "0,255,0,255"]
IfMatch3=(#ActivateAction1# + SomeSecondsOrMinutes)
IfMatchAction3=[!SetOption meterText FontColor "0,0,255,255"]
IfMatch4=(#ActivateAction1# + SomeSecondsOrMinutes2)
IfMatchAction4=[!SetOption meterText FontColor "0,255,255,255"]
etc...

[meterText]
Meter=String
X=100
Y=200
FontFace=Arial
FontColor=255,255,255,255
FontSize=20
Text=TEXT
Last edited by nmdelrio on September 20th, 2017, 11:39 am, edited 1 time in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Adding Time to Time?

Post by mak_kawa »

First, you can not calculate string values using formula. So, you have to convert the string value to numeric value of second.

Although I am not sure about your exact intension, and always my code is not smart :) , following code may be helpful for you, I hope.

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=128,128,128,192

[Variables]
ActivateAction=57:30

[ActivateActionMinute]
Measure=String
String=#ActivateAction#
RegExpSubstitute=1
Substitute="^(..):(..)$":"\1"

[ActivateActionSecond]
Measure=String
String=#ActivateAction#
RegExpSubstitute=1
Substitute="^(..):(..)$":"\2"

[ActivateActionValue]
Measure=Calc
Formula=([ActivateActionMinute]*60)+[ActivateActionSecond]

[measureTime]
Measure=TIME
Format=%M:%S
IfMatch=#ActivateAction#
IfMatchAction=[!SetOption meterText FontColor "255,0,0,255"]

[measureMinute]
Measure=Time
Format=%M

[measureSecond]
Measure=Time
Format=%S

[measureSecondValue]
Measure=Calc
Formula=(measureMinute*60)+measureSecond
IfCondition=(measureSecondValue+2)=ActivateActionValue
IfTrueAction=[!SetOption meterText FontColor "0,255,0,255"]

IfCondition2=(measureSecondValue-5)=ActivateActionValue
IfTrueAction2=[!SetOption meterText FontColor "255,255,255,255"]

[meterText]
Meter=String
MeasureName=measureTime
X=10
Y=10
FontFace=Arial
FontColor=255,255,255,255
FontSize=20
Text=%1
Last edited by mak_kawa on September 20th, 2017, 12:15 pm, edited 1 time in total.
User avatar
nmdelrio
Posts: 74
Joined: June 28th, 2015, 12:51 pm
Location: Paranaque City, Philippines

[SOLVED] Re: Adding Time to Time?

Post by nmdelrio »

fantastic!

thank you.

exactly what I was looking for. :thumbup:

thanks again.