It is currently November 26th, 2022, 7:12 pm

## Multiple values in IfEqualValue

Report bugs with the Rainmeter application and suggest features.
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

### Multiple values in IfEqualValue

Since I've started buildning my banary clock, I've become more and more annoyed with the extra work we have do display things that a linked to a IfEqualValue.

As of now, we can just use one (1) value for each statement, correct?
Meaning, it's like this:
[MeasureSomething]
Measure=AMeasure
Format=Whatever
IfEqualValue=20
IfEqualAction=!Execute [!RainmeterShowMeter MeterSomething]

My suggestion: Make us able to have more numbers in the IfEqualValue line.
[MeasureSomething]
Measure=AMeasure
Format=Whatever
IfEqualValue=20 | 40 | 60
IfEqualAction=!Execute [!RainmeterShowMeter MeterSomething]

This would be quite usefull as it would allow us to link one and the same measure to different meters and it still functions as if it was (in this case) three (3) different measures.
And it would seriously decrease the size of some skins (the binary clock I've been working on would drop like... 30kB in size...).

If this feature already excist - Please, add how you do to the wiki and tell me.
I don't think, therefore I'm not.
kenz0
Developer
Posts: 263
Joined: July 31st, 2009, 2:23 pm
Location: Tokyo, JPN

### Re: Multiple values in IfEqualValue

Multiple "IfEqual" is the suggestion that is not bad. actually, I am also sure that "IF" function is one of the weak points of Rainmeter.
But if it is such a simple problem, it may already be solvable by Calc measure.

[MeasureSomething]
Measure=AMeasure
Format=Whatever

[MeasureConditions]
Measure=Calc
Formula=(MeasureSomething=20) || (MeasureSomething=40) || (MeasureSomething60) ? 1 : 0
IfEqualValue=1
IfEqualAction=!Execute [!RainmeterShowMeter MeterSomething]
.
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

### Re: Multiple values in IfEqualValue

Yeah.
That actually does the trick for this task.
But, to have so you can use it however you want, would be great. Makes it easier ( not really... But takes less time :P) to code a skin that depends on several values.

Btw. I'm amazed of how good you are at spawning ideas using the calc measure. ._.
I don't think, therefore I'm not.
gerdgoebel
Posts: 8
Joined: October 17th, 2009, 2:17 pm

### Re: Multiple values in IfEqualValue

I have the same problem with the limitation of not allowing multiple IfBelowValue or IfAboveValue forcing me to have a rather large number of ors in the IfEqualValue.
Being fairly new to Rainmeter i currently us the following got get all values for CPU or RAM that are between 80 and 90. Because the measure returns the value with 1 decimal i have to use
IfEqualValue=80.0 || 80.1 || 80.2 etc
it is a rather long string for my range between 80 and 90.
Is there a way to reduce this string with your "Measure Something" example you mentioned above?
Or is there a "round" calculation that i could add to the measure to get numbers without decimals. that would reduce the number of ors i currently use.
Ideally Rainmeter should support multiple IfAbove(Below)Value statements and further should add a new IfBetweenValue. Hopefully we can get that in a future release.
gerdgoebel
Posts: 8
Joined: October 17th, 2009, 2:17 pm

### Re: Multiple values in IfEqualValue

Is there actually a limit of how many or values we can have?
gerdgoebel
Posts: 8
Joined: October 17th, 2009, 2:17 pm

### When should i use [!RainmeterRedraw]

I use some IfAbove(Below)Values to display the same meters with differenct colors.
I found the [!RainmeterRedraw] in the forum but am not sure when to use it.

My current statement looks like this:

IfAboveValue=89
IfAboveAction=!execute [!RainmeterHideMeter MeterBarOrange][!RainmeterHideMeter MeterBar][!RainmeterShowMeter MeterBarRed][!RainmeterRedraw]

So would i need the redraw parameter or not?
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am

### Re: Multiple values in IfEqualValue

gerdgoebel wrote: Being fairly new to Rainmeter i currently us the following got get all values for CPU or RAM that are between 80 and 90. Because the measure returns the value with 1 decimal i have to use
IfEqualValue=80.0 || 80.1 || 80.2 etc
it is a rather long string for my range between 80 and 90.
That doesn't work at all. IfEqualValue only takes one number, not multiple numbers. Chewtoy was merely suggesting a method to add more than one value. What kenzo then did was put the multiple values inside the "Formula=" with a conditional and have the result checked (ie: 1 if true, 0 otherwise). What you want could be accomplished by doing something like this:

Code: Select all

[MeasureCheckRange]
Measure=Calc
Formula=((MeasureName >= 80) && (MeasureName < 90)) ? 1 : 0
IfEqualValue=1
IfEqualAction=!RainmeterDoSomeStuff
You would need to set the measure name that the values are coming from yourself, and you can set 1 and 0 to whatever you want. They an even be other complete statements.
The conditional statement is like this:

Code: Select all

((condition) ? (value if true) : (value if false))
It checks the condition, which must be a logical comparison that gives a true or false value. If the condition comes out to true, it shows what's in (Value if true). If it is false, it shows the other one. So in the example above, it checks that
the value is greater than or equal to 80 AND it is less than 90 (not including 90). If the value is in that range, the whole thing comes out to 1. Otherwise it will come out to 0. Then it's simple to check for with IfEqualValue.

If you're creative, you can use a combination of conditionals and IfEqualValue, IfBelowValue and IfAboveValue together to get some very nifty measures.
gerdgoebel
Posts: 8
Joined: October 17th, 2009, 2:17 pm

### Re: Multiple values in IfEqualValue

Thanks for you explanation. I am going to give this a try.