It is currently May 2nd, 2024, 8:26 am

Timer measure reset

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16194
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Timer measure reset

Post by balala »

On a skin I'm working on, I have this simple measure:

Code: Select all

[Timer]
Measure=Calc
Formula=( Timer + 1 )
DynamicVariables=1
After refresh, this measure increment continuously, while it is enabled. I need a button, which could restart the measure's value from 0, without disabling it. I tried to use this command: ButtonCommand=[!DisableMeasure Timer][!EnableMeasure Timer], but it doesn't work, nothing's happening. Does exists any possibility to restart the measure's value from 0, with a button?

Thank you in advance
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Timer measure reset

Post by fonpaolo »

You've posted in the wrong section, however, read this
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Timer measure reset

Post by moshi »

Code: Select all

[Variables]
minusone=-1

[Timer]
Measure=Calc
DynamicVariables=1
Formula=#minusone#+1
OnUpdateAction=[!SetVariable minusone "[Timer]"]

[Meter]
...
LeftMouseUpAction=[!SetVariable minusone "-1"]
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Timer measure reset

Post by moshi »

fonpaolo wrote:You've posted in the wrong section, however, read this
not to be rude, but the problem is not covered in your link.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Timer measure reset

Post by fonpaolo »

moshi wrote:not to be rude, but the problem is not covered in your link.
You're not rude, you're right. ;-)
I was focused on counters and I reminded that page.
Sorry.
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Timer measure reset

Post by Brian »

You could also do it a few other ways.

1) The reason ButtonCommand=[!DisableMeasure Timer][!EnableMeasure Timer] did not work is because the measure did not update in between disabling and re-enabling. You might try: ButtonCommand=[!DisableMeasure Timer][!UpdateMeasure Timer][!EnableMeasure Timer]

2) Take a look at smurfier's "Resetting a counter" in his excellent counter's guide. This is similar to moshi's idea.

Hope that helps a little bit.

-Brian
User avatar
balala
Rainmeter Sage
Posts: 16194
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Timer measure reset

Post by balala »

Brian wrote:You might try: ButtonCommand=[!DisableMeasure Timer][!UpdateMeasure Timer][!EnableMeasure Timer]

Hope that helps a little bit.
-Brian
Thanks to all of you, fonpaolo, moshi and Brian, for your help. It seems that I have more solutions, for now I like this one, but I'll see how they are working. But anyway thanks once again.