Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

WarnIf Errors...

Discuss anything to do with plugins

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
EvylRat
Posts: 53
Joined: September 26th, 2007, 5:33 pm
Contact:

WarnIf Errors...

Post by EvylRat »

Before I begin, I apologize if I've made an error.

Consider this statement
$dll(warnif.dll,2,$dll(warnif.dll,11,$dll(volume,2,,)/15,Good)/15,Bad)
So, if the system volume is less than 15, then show BAD, else show GOOD.
But, it doesn't work.
When the volume is less than 10, it shoes GOOD. and the moment volume hits 100, it shows BAD.

Can anyone help me? I'm just trying to setup free space checking on my hard drive. I test with the volume because it's quick to change realtime

caesar
Forum Supporter
Posts: 734
Joined: October 15th, 2005, 10:39 am
Location: Romania
Contact:

Post by caesar »

$dll(warnif.dll,4,$dll(warnif.dll,2,$dll(volume,2,,)/15,Bad)/Bad,$dll(warnif.dll,11,$dll(volume,2,,)/15,Good))

Here you go!

IF ( IF < 15 THEN BAD) NOT BAD THEN IF => 15 THEN GOOD

EvylRat
Posts: 53
Joined: September 26th, 2007, 5:33 pm
Contact:

Post by EvylRat »

Is there a newer version of WarnIf? I'm still getting the same results.
Once the check value falls below 10, it returns a false for <15 and once it hits 100, it returns a TRUE for < 15.

The WarnIf statements always get me confused, I wish there was an easier way to do logical expressions.

caesar
Forum Supporter
Posts: 734
Joined: October 15th, 2005, 10:39 am
Location: Romania
Contact:

Post by caesar »

EvylRat wrote:Is there a newer version of WarnIf? I'm still getting the same results.

see http://www.eserver.gr
EvylRat wrote:Once the check value falls below 10, it returns a false for <15 and once it hits 100, it returns a TRUE for < 15.
i haven't tested, check if the () are fine.
EvylRat wrote:The WarnIf statements always get me confused, I wish there was an easier way to do logical expressions.
there could be some plugins, ask the search button :wink:
regexp could be your best friend but demanding too http://forums.lcdsmartie.org/viewtopic.php?t=440

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

EvylRat wrote:Is there a newer version of WarnIf? I'm still getting the same results.
Once the check value falls below 10, it returns a false for <15 and once it hits 100, it returns a TRUE for < 15.

The WarnIf statements always get me confused, I wish there was an easier way to do logical expressions.
There are few examples on the Read me text inside the warnif package...
The Warnif Plugin is quite simple to use

Examples:
$dll(warnif.dll,1,$HDFreg(C)/10, Space Normal) returns "Space Normal" if the free space on drive C is more than 10 GB, otherwise returns the free space in GB

$dll(warnif.dll,2,$HDFreg(C)/10, Space Low) returns "Space Low" if the free space on drive C is less than 10 GB , otherwise returns the free space in GB

EvylRat
Posts: 53
Joined: September 26th, 2007, 5:33 pm
Contact:

Post by EvylRat »

$dll(warnif.dll,11,99/15,True)
Returns TRUE, as it should because 99 IS greater than 15
$dll(warnif.dll,11,100/15,True)
returns 100, although it should've returned TRUE.

$dll(warnif.dll,2,15/15,True)
Returns 15 (correct)
$dll(warnif.dll,2,14/15,True)
Returns TRUE, as 14 IS smaller than 15.
$dll(warnif.dll,2,9/15,True)
Returns 9, although it should've returned TRUE.

Am i using the correct syntax?

caesar
Forum Supporter
Posts: 734
Joined: October 15th, 2005, 10:39 am
Location: Romania
Contact:

Post by caesar »

EvylRat wrote:$dll(warnif.dll,11,99/15,True)
Returns TRUE, as it should because 99 IS greater than
Right!
EvylRat wrote:$dll(warnif.dll,11,100/15,True)
returns 100, although it should've returned TRUE.
Right again, but if limbo can notice this:
$dll(warnif.dll,11,100/015,True)
this works!
EvylRat wrote:$dll(warnif.dll,2,15/15,True)
Returns 15 (correct)
$dll(warnif.dll,2,14/15,True)
Returns TRUE, as 14 IS smaller than 15.
Fine also!
EvylRat wrote:$dll(warnif.dll,2,9/15,True)
Returns 9, although it should've returned TRUE.
Right again, but this works...
$dll(warnif.dll,2,09/15,True)

Limbo, could you help if you have any spare time?

EvylRat
Posts: 53
Joined: September 26th, 2007, 5:33 pm
Contact:

Post by EvylRat »

temporary fix... using width
$dll(width.dll,1,3r#0,24)
returns 024
$dll(width.dll,1,3r#0,100)
returns 100
$dll(width.dll,1,3r#0,9)
returns 009

So, as earlier post;
$dll(warnif.dll,11,$dll(width.dll,1,3r#0,100)/$dll(width.dll,1,3r#0,15),True)
Actually returns true!
Maybe I can get my HDfree space warning to work, along using WIDTH to make a bar graph

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

caesar wrote:
EvylRat wrote:$dll(warnif.dll,11,99/15,True)
Returns TRUE, as it should because 99 IS greater than
Right!
EvylRat wrote:$dll(warnif.dll,11,100/15,True)
returns 100, although it should've returned TRUE.
Right again, but if limbo can notice this:
$dll(warnif.dll,11,100/015,True)
this works!
EvylRat wrote:$dll(warnif.dll,2,15/15,True)
Returns 15 (correct)
$dll(warnif.dll,2,14/15,True)
Returns TRUE, as 14 IS smaller than 15.
Fine also!
EvylRat wrote:$dll(warnif.dll,2,9/15,True)
Returns 9, although it should've returned TRUE.
Right again, but this works...
$dll(warnif.dll,2,09/15,True)

Limbo, could you help if you have any spare time?
07/06/08: I'm checking the source code today about this specific error...
The problem is that the check function is a general function that can compare text. which means that if I narrow the code to compare only integers the plugin will fail to compare texts.

The solution is to add some functions to compare only numerical values and release a new version of this plugin.

Hopefully I will release this version one of the following days.

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

The new version of the Warnif plugin is released.
http://forums.lcdsmartie.org/viewtopic. ... 3975#13975

New function added to compare integer values and fix this annoying behavior.


Thanks to Ceasar for his help on the bug localization

Coding time: 11:19:40 to 13:06:50 :D

limbo
Plugin Author
Posts: 1604
Joined: February 13th, 2005, 7:38 pm
Location: Athens - Greece
Contact:

Post by limbo »

EvylRat wrote:temporary fix... using width
$dll(width.dll,1,3r#0,24)
returns 024
$dll(width.dll,1,3r#0,100)
returns 100
$dll(width.dll,1,3r#0,9)
returns 009

So, as earlier post;
$dll(warnif.dll,11,$dll(width.dll,1,3r#0,100)/$dll(width.dll,1,3r#0,15),True)
Actually returns true!
Maybe I can get my HDfree space warning to work, along using WIDTH to make a bar graph
In actions you can use:
if $dll(warnif.dll,1,$CPUUsage%/80,theme2) = theme2 then GotoTheme(2)
and
if $dll(warnif.dll,2,$CPUUsage%/30,theme1) = theme1 then GotoTheme(1)

and you can set only one screen to second theme.
this will cause your display to go to CPU stats when the CPU usage goes higher than 80% and stay there until it drops below 30%

Edit: the functions must be 14 and 15 not 1 and 2
Last edited by limbo on June 7th, 2008, 1:11 pm, edited 1 time in total.

EvylRat
Posts: 53
Joined: September 26th, 2007, 5:33 pm
Contact:

Post by EvylRat »

Very nice! That's an excellent solution. Just been scratching my head with that one. The escalate in conjuction with the new warnif triggered the escalate countdown, but then returned to 0 because the CPU usgae (still either above 80, or idle) doesn't change.

I will use this idea for the hard drive scenario and other error reporting.
I could activate a THEME when a condition is met, and use the ENABLE/DISABLE screen to toggle those error/info screens.
Info screens could return to theme 1 when a threshold value is no longer met, error screens could remain on screen until I use a global hotkey.

caesar/limbo thanks!

Post Reply