It is currently April 28th, 2024, 4:06 pm

How to set NetTotal to reset with each month?

Get help with creating, editing & fixing problems with skins
Bichrome
Posts: 7
Joined: June 24th, 2012, 7:31 am

How to set NetTotal to reset with each month?

Post by Bichrome »

As stated in the title, I'm having some trouble figuring out how to get a cumulative NetTotal measure to reset itself with each month. From doing a bit of reading I've realised I may have to use a Lua script to set out the specific amount of days for the month, but I am entirely unsure of where to go from there. Any help would be very much appreciated. :)
User avatar
haibusa2005
Posts: 52
Joined: June 15th, 2011, 7:23 pm
Location: Bulgaria, Varna

Re: How to set NetTotal to reset with each month?

Post by haibusa2005 »

On first thought - time measurre that keeps track of current day of the month and the hour. At specific time (like 00:00 on the first day of the month or so) sends !ResetStats bang

here is working code

Code: Select all

[Rainmeter]
Author=Haibusa2005
Update=500
MiddleMouseDownAction=[!Refresh]

[GetNetTotal]
Measure=NetTotal
Cumulative=1

[GetDate]
Measure=Time
Format=%#d

[GetHour]
Measure=Time
Format=%#H

[GetMinute]
Measure=Time
Format=%#M

[GetSecond]
Measure=Time
Format=%#S

[CheckReset]
Measure=Calc
Formula=GetDate=1?(GetHour=0?(GetMinute=0?(GetSecond=1?(-2):(-1)):(-1)):(-1)):(-1)
IfEqualValue=(-2)
IfEqualAction=!ResetStats

[ResetButton]
Meter=Image
x=0
y=0
h=20
w=20
SolidColor=255,255,0,150
LeftMouseUpAction=!ResetStats


[DisplayNetTotal]
Meter=String
MeasureName=GetNetTotal
FontColor=255,255,255,255
FontSize=14
x=0
y=30
AutoScale=1
Bichrome
Posts: 7
Joined: June 24th, 2012, 7:31 am

Re: How to set NetTotal to reset with each month?

Post by Bichrome »

Thank you very much for this code. Just one thing that I would like to ask in case I can't figure it out whilst I fiddle around with a bit of the code, what would I have to change to set it to reset on the 10th of each month? Would it be as simple as changing it to:

Code: Select all

[CheckReset]
Measure=Calc
Formula=GetDate=10?(GetHour=0?(GetMinute=0?(GetSecond=1?(-2):(-1)):(-1)):(-1)):(-1)
IfEqualValue=(-2)
IfEqualAction=!ResetStats
That is, changing the GetDate value to "10?" as opposed to "1?". Would that work or am I missing something?
User avatar
haibusa2005
Posts: 52
Joined: June 15th, 2011, 7:23 pm
Location: Bulgaria, Varna

Re: How to set NetTotal to reset with each month?

Post by haibusa2005 »

Yes, that's all. The formula's meaning is: check if date is 10th, if it is check if hour is 00 and so on. If all condiditions are satisfied, the stats are reset. If there is an unmet requirement the measure returns value of -1
Bichrome
Posts: 7
Joined: June 24th, 2012, 7:31 am

Re: How to set NetTotal to reset with each month?

Post by Bichrome »

Thankyou very much for the help. :)