It is currently May 2nd, 2024, 5:46 pm

Maximum Uptime - Help needed

Get help with creating, editing & fixing problems with skins
brofmuadsudi
Posts: 5
Joined: October 20th, 2011, 8:09 pm

Maximum Uptime - Help needed

Post by brofmuadsudi »

I'm trying to write a skin that records the Maximum Uptime of my computer.

My thinking was, to take the current uptime and check it against a maximum uptime variable (initial input figure being 0), and if it is greater - then overwrite it.

I came up with something rough, which doesn't work. But I'm not sure on the best way to proceed now. This is the rough gubbins I came up with (my actual version is slightly diferent because I've split it over an inc file):
[Variables]
MaximumUptime=0

[MeasureUptime]
Measure=UpTime

[MeasureMaximumUptime]
Measure=Calc
Formula=MeasureUptime
DynamicVariables=1
IfAboveValue=#MaximumUptime#
IfAboveAction=!Execute [!WriteKeyValue Variables MaximumUptime MeasureUptime][!Refresh]

[MeterMaximumUptime]
Meter=String
Text=#MaximumUptime# seconds
(incidentally I want a final value in days and hours, but seconds will do for the moment while I sort this out)

Now, I think the problem in my approach is that the highlighted item isn't returning the measured number, but instead the text MeasureUptime. How can I fix this? Or if there is a much better way of doing this, then please advise. I'm not very good with calc syntax, so I might be making some basic errors!

Of course, as you can gather, a key part of this is that the number has to be retained when the computer is reset/rainmeter is refreshed - therefore I thought WriteKey was the most appropriate route to take.
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: Maximum Uptime - Help needed

Post by smurfier »

You need to put brackets around measure names when you wish to use them as a dynamic variable.

Code: Select all

[Variables]
MaximumUptime=0

[MeasureUptime]
Measure=UpTime
IfAboveValue=#MaximumUptime#
IfAboveAction=!Execute [!WriteKeyValue Variables MaximumUptime [MeasureUptime]][!Refresh]
DynamicVariables=1

[MeterMaximumUptime]
Meter=String
Text=#MaximumUptime# seconds
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 . . .