It is currently May 21st, 2024, 5:31 pm

Individual Meter Uptime / Manually Resettable Uptime Clock

Get help with creating, editing & fixing problems with skins
naljubes
Posts: 8
Joined: September 17th, 2012, 3:06 am

Individual Meter Uptime / Manually Resettable Uptime Clock

Post by naljubes »

I have a skin that shows the cumulative netin and netout. I can reset this meter by clicking the skin so the counter resets to zero. It is not reset using !ResetStats This works by taking the value of NetIn and storing it into a variable which is then subtracted from the current value of NetIn.

I am wondering if I can have a timer that shows the amount of time since this value was zeroed. Perhaps the time / date could be stored as a value then subtracted from the current time /date value to give the uptime of the meter.

Here is an example of the code for this skin.

Code: Select all


[Variables]
ValStore=0

[meterBackground]
Meter=Image
ImageName=...
MiddleMouseUpAction=[!WriteKeyValue Variables VarStore [MeasureNetInTotal]][!Refresh]

[MeasureNetInTotal]
Measure=NetIn
Cumulative=1

[MeasureNetInSinceMANUALRefresh]
Measure=Calc
Formula=MeasureNetInTotal - #VarStore#

[MeterNetworkInTotalMANUAL]
Meter=String
DynamicVariables=1
MeasureName=MeasureNetInSinceMANUALRefresh
Text="DL: %1"

Thanks everyone
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Individual Meter Uptime / Manually Resettable Uptime Clo

Post by smurfier »

Something like this should work:

Code: Select all

[Variables]
ValStore=0
ValStamp=0

[Time]
Measure=Time

[meterBackground]
Meter=Image
ImageName=...
MiddleMouseUpAction=[!WriteKeyValue Variables VarStore [MeasureNetInTotal]][!WriteKeyValue Variables ValStamp [Time]][!Refresh]

[MeasureNetInTotal]
Measure=NetIn
Cumulative=1

[MeasureNetInSinceMANUALRefresh]
Measure=Calc
Formula=MeasureNetInTotal - #VarStore#

[MeasureHour]
Measure=Calc
Formula=TRUNC((MeasureTime-#ValStamp#)/3600)

[MeasureMinute]
Measure=Calc
Formula=TRUNC((((MeasureTime-#ValStamp#)%3600)/60)

 [MeasureSecond]
 Measure=Calc
 Formula=(MeasureTime-#ValStamp#)%60

[MeterNetworkInTotalMANUAL]
Meter=String
DynamicVariables=1
MeasureName=MeasureNetInSinceMANUALRefresh
Text="DL: %1"
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
naljubes
Posts: 8
Joined: September 17th, 2012, 3:06 am

Re: Individual Meter Uptime / Manually Resettable Uptime Clo

Post by naljubes »

Thanks so much for the help : ) I had to change a few things to make it work, but it works now.

Code: Select all

[Time]
Measure=Time
Would give a value like "22:18:45"
we needed a value without the : symbols in it so I did

Code: Select all

[MeasureTime]
Measure=Calc
Formula=MeasureTime2

[MeasureTime2]
Measure=Time
Now, ValStamp is given a value like "12992567017" an can now be subtracted from to zero the timer.

Here is the code I used to display the uptime.

Code: Select all

[ResetTimerLabel]
Meter=STRING
MeasureName=MeasureHour
MeasureName2=MeasureMinute
MeasureName3=MeasureSecond
Text="%1:%2:%3"
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Individual Meter Uptime / Manually Resettable Uptime Clo

Post by smurfier »

There's an easier solution using Rainmeter 2.4 beta.

By adding a colon at the end of the [Time] dynamic variable we will use the number value of the measure instead.

Code: Select all

[meterBackground]
Meter=Image
ImageName=...
MiddleMouseUpAction=[!WriteKeyValue Variables VarStore [MeasureNetInTotal]][!WriteKeyValue Variables ValStamp [Time:]][!Refresh]
DynamicVariables=1
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5415
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Individual Meter Uptime / Manually Resettable Uptime Clo

Post by eclectic-tech »

smurfier wrote:There's an easier solution using Rainmeter 2.4 beta.

By adding a colon at the end of the [Time] dynamic variable we will use the number value of the measure instead.

Code: Select all

[meterBackground]
Meter=Image
ImageName=...
MiddleMouseUpAction=[!WriteKeyValue Variables VarStore [MeasureNetInTotal]][!WriteKeyValue Variables ValStamp [Time:]][!Refresh]
DynamicVariables=1
Learning a new trick everyday! :thumbup:
Maybe this tip should be added to the TIME MEASURE section of the manual...
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Individual Meter Uptime / Manually Resettable Uptime Clo

Post by Kaelri »

eclectic-tech wrote:Maybe this tip should be added to the TIME MEASURE section of the manual...
This is part of a broader feature called "section variables," which is documented in the beta manual here.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5415
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Individual Meter Uptime / Manually Resettable Uptime Clo

Post by eclectic-tech »

Kaelri wrote: This is part of a broader feature called "section variables," which is documented in the beta manual here.
I looked at the measures and did not see anything related...
Maybe a note or link could be added to the meter and measure info pages to raise awareness of the section variables feature?
Just wondering out loud again :)
User avatar
Kaelri
Developer
Posts: 1721
Joined: July 25th, 2009, 4:47 am

Re: Individual Meter Uptime / Manually Resettable Uptime Clo

Post by Kaelri »

We are working on a major revision to the manual that should (among other things) make these features easier to discover. :)