Page 1 of 3

CountUP (down) timer

Posted: May 17th, 2017, 6:19 pm
by bowas1984
Hello i searched whole internet and i couldn't find any day timer which will count days upwards, something like alcohol or smoke timer, i am very bad at coding i only changed some rainmeter parameters like colors lengths so i am very noobish. If some one can help i would very appreciated.

Re: CountUP (down) timer

Posted: May 17th, 2017, 7:45 pm
by balala
I'm not sure is you thought to something like this: https://forum.rainmeter.net/viewtopic.php?p=96578#p96578
Please let me know if not.

Re: CountUP (down) timer

Posted: May 18th, 2017, 8:27 pm
by bowas1984
That is one beautiful skin but sadly its not what i meant. I thought the day counter which will count days upwards (i.e. 1Day left, 2 days left, 3 days left etc.) Something like when alcohol addicts count days (1 day sober, 2 days sober...) Thank you very much for interest to help.

Re: CountUP (down) timer

Posted: May 18th, 2017, 9:10 pm
by balala
bowas1984 wrote:That is one beautiful skin but sadly its not what i meant. I thought the day counter which will count days upwards (i.e. 1Day left, 2 days left, 3 days left etc.) Something like when alcohol addicts count days (1 day sober, 2 days sober...) Thank you very much for interest to help.
Ok, maybe something like this:

Code: Select all

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

[Variables]
Days=0

[MeasureDays]
Measure=Time
Format=%d
OnChangeAction=[!SetVariable Days "(#Days#+1)"][!WriteKeyValue Variables Days "(#Days#+1)"][!UpdateMeter "MeterDays"]

[MeterDays]
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Days: #Days#
DynamicVariables=1

[MeterReset]
Meter=STRING
X=0r
Y=10R
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Reset
LeftMouseUpAction=[!SetVariable Days "0"][!WriteKeyValue Variables Days "0"]
ToolTipText=Click to reset the number of days
Each time the date is changing, the OnChangeAction option of the [MeasureDays] measure will increase the value of the Days variable, with one. In paralel this new value will be written into the [Variables] section. This way even if you restart the computer, the counted value will be kept.
You can reset this value to 0, using the Reset button.
Does this code looks like what you wanted? If so, it can (and must) be improved.

Re: CountUP (down) timer

Posted: May 18th, 2017, 9:15 pm
by eclectic-tech
Balala offered a solution...

But if you were looking for something that counts down to a specific date, you could look at these 2 skins:

JSMorley's Countdown to Christmas: https://forum.rainmeter.net/viewtopic.php?f=27&t=24547 skin

Or this Count Down Days skin: https://forum.rainmeter.net/viewtopic.php?f=5&t=21972&hilit=count+down+days

Re: CountUP (down) timer

Posted: May 19th, 2017, 8:04 am
by bowas1984
@balala
I think that's it! I will test it, day or two then i will come back. Thank you very much again!
@eclectic-tech
Nope that's not it, but thanks for the try.

I am glad that this community is so nice. Thank you all

Re: CountUP (down) timer

Posted: May 20th, 2017, 8:42 am
by bowas1984
Yes that's it! I will try to change it a little, first to make that reset button transparent (show on hover) then we will see. Thank you again, i couldn't find anything similar.

Re: CountUP (down) timer

Posted: May 20th, 2017, 1:58 pm
by balala
bowas1984 wrote:first to make that reset button transparent (show on hover)
Don't make it transparent, instead hide it. It's easier. Just have to add a Hidden=1 option to the [MeterReset] meter and the following two options to the [Rainmeter] section:

Code: Select all

[Rainmeter]
...
MouseOverAction=[!ShowMeter "MeterReset"][!Redraw]
MouseLeaveAction=[!HideMeter "MeterReset"][!Redraw]

Re: CountUP (down) timer

Posted: May 27th, 2017, 3:49 pm
by bowas1984
Sorry for late reply, i was very busy whole weak
I have one more question, because of some reason the days are updated only when computer is power ON is there any way to count days even if the PC is OFF?
Here is my adjusted code for my skin:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
MouseOverAction=[!ShowMeter "MeterReset"][!Redraw]
MouseLeaveAction=[!HideMeter "MeterReset"][!Redraw]



[Variables]
Days=0

[MeasureDays]
Measure=Time
Format=%d
OnChangeAction=[!SetVariable Days "(#Days#+1)"][!WriteKeyValue Variables Days "(#Days#+1)"][!UpdateMeter "MeterDays"]

[MeterDays]
Meter=STRING
X=12
Y=12

FontColor=0, 230, 255
SolidColor=0,0,0,150
FontSize=20
FontFace=IDroid
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Days: #Days#
DynamicVariables=1

[MeterReset]
Hidden=1
Meter=STRING
X=0r
Y=0R

FontColor=220,220,220,
SolidColor=0,0,0,150
FontSize=8
FontFace=IDroid
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Reset
LeftMouseUpAction=[!SetVariable Days "0"][!WriteKeyValue Variables Days "0"]
ToolTipText=Click to reset the number of days

[MeterTopLine1]
Meter=IMAGE
SolidColor=0, 230, 255
X=0
Y=0
W=66
H=1
Antialias=1


[MeterTopLineMarker1]
Meter=IMAGE
SolidColor=0, 230, 255
X=66
Y=0
W=4
H=3
Antialias=1

[MeterMidLine1]
Meter=IMAGE
SolidColor=72, 209, 204
X=66
Y=3
W=72
H=1
Antialias=1

[MeterLeftLineHigh]
Meter=IMAGE
SolidColor=0, 230, 255
X=0
Y=0
W=1
H=56
Antialias=1



[MeterRightLineLineHigh]
Meter=IMAGE
SolidColor=0, 230, 255
X=138
Y=3
W=1
H=54
Antialias=1

[MeterBottomLine]
Meter=IMAGE
SolidColor=0, 230, 255
X=0
Y=56
W=139
H=1
Antialias=1
Thanks for all again

Re: CountUP (down) timer

Posted: May 27th, 2017, 6:33 pm
by balala
bowas1984 wrote:Sorry for late reply, i was very busy whole weak
I have one more question, because of some reason the days are updated only when computer is power ON is there any way to count days even if the PC is OFF?
This definitely is not an easy question. Probably it's not impossible, but neither easy isn't.
So, a quick solution I think would be the following one:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1
MouseOverAction=[!ShowMeter "MeterReset"][!Redraw]
MouseLeaveAction=[!HideMeter "MeterReset"][!Redraw]

[Variables]
Day=152087.88736

[MeasureDate]
Measure=Time

[MeasureDays]
Measure=Calc
Formula=(( [MeasureDate:] / 86400 ) - #Day# )
DynamicVariables=1

[MeterDays]
Meter=STRING
MeasureName=MeasureDays
X=12
Y=12
FontColor=0, 230, 255
SolidColor=0,0,0,150
FontSize=20
FontFace=IDroid
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Days: %1
DynamicVariables=1

[MeterReset]
Hidden=1
Meter=STRING
X=0r
Y=0R
FontColor=220,220,220,
SolidColor=0,0,0,150
FontSize=8
FontFace=IDroid
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Reset
LeftMouseUpAction=[!WriteKeyValue Variables Day "([MeasureDate:]/86400)"][!Refresh]
ToolTipText=Click to reset the number of days

[MeterTopLine1]
Meter=IMAGE
SolidColor=0, 230, 255
X=0
Y=0
W=66
H=1
Antialias=1

[MeterTopLineMarker1]
Meter=IMAGE
SolidColor=0, 230, 255
X=66
Y=0
W=4
H=3
Antialias=1

[MeterMidLine1]
Meter=IMAGE
SolidColor=72, 209, 204
X=66
Y=3
W=72
H=1
Antialias=1

[MeterLeftLineHigh]
Meter=IMAGE
SolidColor=0, 230, 255
X=0
Y=0
W=1
H=56
Antialias=1

[MeterRightLineLineHigh]
Meter=IMAGE
SolidColor=0, 230, 255
X=138
Y=3
W=1
H=54
Antialias=1

[MeterBottomLine]
Meter=IMAGE
SolidColor=0, 230, 255
X=0
Y=56
W=139
H=1
Antialias=1
The Day variable will keep the number of days since January 1, 1601 (which is the date of, let's name it the zero moment), to the moment of reset (when you last time clicked Reset). The ( [MeasureDate:] / 86400 ) expression, used in the Formula option of the [MeasureDays] measure, represents the number of today day, in the same expression mode. If we extract from this the value of the Day variable, we'll get the number of days passed since the last reset, up to today. This is what we need and this value won't be affected neither if you don't start your computer in certain days.
Please run this code for a few days and let me know if it works properly. I didn't test it, so I'm not sure how will it.