It is currently May 5th, 2024, 7:46 am

ResetStats question

Get help with creating, editing & fixing problems with skins
User avatar
dragon57
Posts: 4
Joined: July 29th, 2012, 4:30 am

ResetStats question

Post by dragon57 »

Before I beat my head against a wall trying to do something not supported, I assume when you use a !ResetStats in a skin, it resets saved stats globally across all skins? If so, is there any way to only reset stats for a specific measure?

Case in point, I want a Network skin that shows a Total cumulative value from its first use and another value that shows cumulative network stats since a user specified action, e.g. clicking on a 'Refresh' button.

This would allow me to track, for example, total network stats monthly and total for a longer time, both at the same time.

Thanks for any information or suggestions.
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: ResetStats question

Post by Kaelri »

dragon57 wrote:Before I beat my head against a wall trying to do something not supported, I assume when you use a !ResetStats in a skin, it resets saved stats globally across all skins?
That's correct. Your global network statistics are stored in a file called Rainmeter.stats in your application data folder, and these statistics are used by all skins.
dragon57 wrote:If so, is there any way to only reset stats for a specific measure?

Case in point, I want a Network skin that shows a Total cumulative value from its first use and another value that shows cumulative network stats since a user specified action, e.g. clicking on a 'Refresh' button.

This would allow me to track, for example, total network stats monthly and total for a longer time, both at the same time.
Here would be a simple way to do that, using "NetIn" as an example:

Code: Select all

[Variables]
RefreshValue=0

[MeasureNetInTotal]
Measure=NetIn
Cumulative=1

[MeasureNetInSinceRefresh]
Measure=Calc
Formula=MeasureNetInTotal - #RefreshValue#

[RefreshButton]
Meter=...
DynamicVariables=1
LeftMouseUpAction=[!WriteKeyValue Variables RefreshValue "[MeasureNetInTotal:]"][!Refresh]
How it works: when the button ([RefreshButton]) is clicked, the skin saves the cumulative total NetIn value as a variable (RefreshValue). The calculator measure ([MeasureNetInSinceRefresh]) simply calculates the difference between the current total and the variable.
User avatar
dragon57
Posts: 4
Joined: July 29th, 2012, 4:30 am

Re: ResetStats question

Post by dragon57 »

Hey, that makes sense! Many, many thanks.