It is currently May 3rd, 2024, 10:09 pm

Logical expression error

Get help with creating, editing & fixing problems with skins
User avatar
fabularasa
Posts: 76
Joined: February 26th, 2011, 12:51 am
Location: Poland

Logical expression error

Post by fabularasa »

What I need is to reset download and upload bytes.

Code: Select all

[Uptime]
Measure=Uptime
Format="%3!02i!:%2!02i!:%1!02i!"

[Reset]
Measure=Calc
Formula=[Uptime]
IfEqualValue=00:01:00
IfEqualAction=!Execute [!RainmeterResetStats]
User avatar
serjsilva
Posts: 13
Joined: June 19th, 2011, 8:52 pm

Re: Logical expression error

Post by serjsilva »

I think you have to make 3 changes

1. Formula=Uptime (no brackets)

3. The value in IfEqual should be in seconds (IfEqualValue=60 considering that you had 1 minute); don't know why though, lol


Check if this works =)


ps.Just realized my number 2. was causing a constant reset of stats...
Last edited by serjsilva on January 5th, 2012, 9:59 pm, edited 2 times in total.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Logical expression error

Post by jsmorley »

The value returned by Uptime is really a string, not numbers, and you can't use a Calc measure to compare strings like that. In fact, you can't use a formatted string like that in a Calc measure's Formula at all, you will only get a log full of errors. You can however pass a string that is just a single number (you have to get rid of the ":" chars and any other string formatting) through a calc and do math on it.

So you could do something like this:

Code: Select all

[UptimeHours]
Measure=Uptime
Format="%3!i!"

[UptimeMinutes]
Measure=Uptime
Format="%2!i!"

[TotalUpMinutes]
Measure=Calc
Formula=([UptimeMinutes] + ([UptimeHours] * 60))
IfEqualValue=1
IfEqualAction=!RainmeterResetStats
DynamicVariables=1
Creates a number that is the total number of "mintues" of uptime, then you can use an IfEqualAction on that number. We need to factor in hours (which will also include days automatically if there are any) so the action doesn't fire once an hour, when the minutes again become set to "1".
User avatar
fabularasa
Posts: 76
Joined: February 26th, 2011, 12:51 am
Location: Poland

Re: Logical expression error

Post by fabularasa »

THX :bow:
Bgdrls
Posts: 66
Joined: April 29th, 2011, 1:03 am

Re: Logical expression error

Post by Bgdrls »

@jsmorley, how to reset NET stats on every PC reboot/startup, or Rainmeter restart?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Logical expression error

Post by jsmorley »

Bgdrls wrote:@jsmorley, how to reset NET stats on every PC reboot/startup, or Rainmeter restart?
Sorry, but what does this have to do with this old thread on a completely different subject?

There is really no way that Rainmeter itself can know that your PC has just been rebooted vs when Rainmeter has just been restarted. You might be able to do something with the UpTime measure and some calculating to detect that your PC was just restarted, and have a little invisible skin that checks that and sends the !ResetStats bang. To also accommodate a restart of Rainmeter as well is a tad more complicated.

What I would probably do is create a file Rainmeter.vbs, with the following:

Code: Select all

Set objShell = WScript.CreateObject("WScript.Shell")
ObjShell.exec("C:\Program Files\Rainmeter\Rainmeter.exe")
WScript.Sleep(2000)
ObjShell.exec("C:\Program Files\Rainmeter\Rainmeter.exe !ResetStats")
Set ObjShell=Nothing 
Then put that .vbs file in C:\Program Files\Rainmeter and drop a shortcut to it in my Startup folder in the Windows Start menu. Then remove the shortcut that is there now for Rainmeter.exe.

That way when you restart, the vbs script will start Rainmeter, wait 2 seconds to give it time to stand itself up, and fire off a !ResetStats to it. That takes care of things when you reboot, and just using the same .vbs shortcut when you restart Rainmeter for other reasons will take care of the other.

There may be other ways to do this, possibly more clever or simpler, but I can't think of any better way off the top of my head.
Bgdrls
Posts: 66
Joined: April 29th, 2011, 1:03 am

Re: Logical expression error

Post by Bgdrls »

Thank you so much for this example. I'm gonna do this way.
Btw, is there any way to do this with Rainmeter.ini? Maybe to add !RainmeterResetStats to particular scin code in Rainmeter.ini?
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Logical expression error

Post by jsmorley »

Bgdrls wrote:Thank you so much for this example. I'm gonna do this way.
Btw, is there any way to do this with Rainmeter.ini? Maybe to add !RainmeterResetStats to particular scin code in Rainmeter.ini?
Not really. You don't want it to reset the stats on just refresh, and there is no way Rainmeter can know that it was just started.
Bgdrls
Posts: 66
Joined: April 29th, 2011, 1:03 am

Re: Logical expression error

Post by Bgdrls »

jsmorley wrote: Not really. You don't want it to reset the stats on just refresh, and there is no way Rainmeter can know that it was just started.
Ok & tnx a lot.