It is currently April 27th, 2024, 6:59 am

Conditional Measure(s)

General topics related to Rainmeter.
KOS_void
Posts: 5
Joined: May 26th, 2011, 5:31 pm

Conditional Measure(s)

Post by KOS_void »

I have been playing with the code a bit, but I'm trying to display multiframe bitmap when the physical memory has reached a certain value. I have tried using the IfAboveValue, and IfBelowValue, as shown here (http://rainmeter.net/cms/Measures-IfActions_beta), however it doesn't seem to play well with a percentual tag(This was when I tested this as a string instead of a bitmap).

Example:

Code: Select all

[Rainmeter]
Author=KOS_void
Update=100

[Metadata]
Name=Memory Low

;-----------------------------------------------------------
;VARIABLES
;-----------------------------------------------------------

[Variables]
@include=#ROOTCONFIGPATH#Configuration/UserVariables.inc

;-----------------------------------------------------------
;MEASURES
;-----------------------------------------------------------

[MeasureMemFree]
Measure=PhysicalMemory
InvertMeasure=1
UpdateDivider=2
IfAboveValue=29
IfAboveAction=!Execute [!RainmeterHideMeter MeterMemLow]
IfBelowValue=30
IfBelowAction=!Execute [!RainmeterShowMeter MeterMemLow]

[MeasureMem]
Measure=Calc
Formula=MeasureMemFree

[MeasureAnimation]
Measure=Calc
Formula=Counter % 10

;-----------------------------------------------------------
;METERS
;-----------------------------------------------------------

[MeterMemLow]
Meter=BITMAP
MeasureName=MeasureAnimation
MeasureName2=MeasureMem
BitmapImage=#ROOTCONFIGPATH#images/memory-low.png
BitmapFrames=10
BitmapExtend=1
Percentual=1
Hidden=1
It seems when I try to do this as a string meter, the value will always be 100 as long as the percentual tag is after the text tag.
Is there a way I can code this skin using the IfAboveValue/IfBelowValue and use the Percentual tag? Or is there an alternate way to do this?

KOS_void
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: Conditional Measure(s)

Post by poiru »

Should work fine with STRINGs. Could you post your STRING meter here, too?
KOS_void
Posts: 5
Joined: May 26th, 2011, 5:31 pm

Re: Conditional Measure(s)

Post by KOS_void »

Yeah, that's why I tried this again as just a string to see if I was doing something wrong with the dual measures. But with the following code, if you comment out the Percentual tags, the proper memory available string will show. Otherwise it just displays 100.

Code: Select all

[Rainmeter]
DynamicWindowSize=1
Update=100

[MeasureMem]
Measure=PhysicalMemory
InvertMeasure=1
UpdateDivider=2
IfAboveValue=29
IfAboveAction=!Execute [!RainmeterHideMeter MeterAboveMem][!RainmeterShowMeter MeterBelowMem]
IfBelowValue=30
IfBelowAction=!Execute [!RainmeterHideMeter MeterBelowMem][!RainmeterShowMeter MeterAboveMem]

[MeasureDelayColor]
Measure=Calc
Formula=MeasureMem

[MeterAboveMem]
Meter=String
MeasureName=MeasureDelayColor
X=0
Y=0
FontSize=15
FontColor=255,0,0,255
AntiAlias=1
AutoScale=1
Text=Memory Available: %1
Percentual=1
Hidden=1

[MeterBelowMem]
Meter=String
MeasureName=MeasureDelayColor
X=0
Y=0
FontSize=15
FontColor=0,255,0,255
AntiAlias=1
AutoScale=1
Text=Memory Available: %1
Percentual=1
Hidden=0
Thanks for the reply,

KOS_void
poiru
Developer
Posts: 2872
Joined: April 17th, 2009, 12:18 pm

Re: Conditional Measure(s)

Post by poiru »

Your issue is the (redundant) Calc measure. This works fine:

Code: Select all

[Rainmeter]
DynamicWindowSize=1
Update=100

[MeasureMem]
Measure=PhysicalMemory
InvertMeasure=1
UpdateDivider=2
IfAboveValue=29
IfAboveAction=!Execute [!RainmeterHideMeter MeterAboveMem][!RainmeterShowMeter MeterBelowMem]
IfBelowValue=30
IfBelowAction=!Execute [!RainmeterHideMeter MeterBelowMem][!RainmeterShowMeter MeterAboveMem]

[MeterAboveMem]
Meter=String
MeasureName=MeasureMem
X=0
Y=0
FontSize=15
FontColor=255,0,0,255
AntiAlias=1
AutoScale=1
Text=Memory Available: %1
Percentual=1
Hidden=1

[MeterBelowMem]
Meter=String
MeasureName=MeasureMem
X=0
Y=0
FontSize=15
FontColor=0,255,0,255
AntiAlias=1
AutoScale=1
Text=Memory Available: %1
Percentual=1
Hidden=0
(When Formula=MeasureMem is used, the Calc recieves the memory amount in bytes, not the percentual value. You could use MaxValue=TOTAL_RAM_IN_BYTES to scale the Calc correctly.)
KOS_void
Posts: 5
Joined: May 26th, 2011, 5:31 pm

Re: Conditional Measure(s)

Post by KOS_void »

I apologize for the late reply for I haven't been able to work with the code much recently. I tried using the code you had given in the previous post today, and it does return the percentual value as I need, however the color change effect did not occur. Once the available memory fell below 30, the color did not transition to red. I am not too sure how to scale the ram like you had mentioned with the MaxValue tag.

I think I am close; it seems as if the IfBelowAction/IfAboveAction tags are ignored.

KOS_void
KOS_void
Posts: 5
Joined: May 26th, 2011, 5:31 pm

Re: Conditional Measure(s)

Post by KOS_void »

KOS_void wrote:I apologize for the late reply for I haven't been able to work with the code much recently. I tried using the code you had given in the previous post today, and it does return the percentual value as I need, however the color change effect did not occur. Once the available memory fell below 30, the color did not transition to red. I am not too sure how to scale the ram like you had mentioned with the MaxValue tag.

I think I am close; it seems as if the IfBelowAction/IfAboveAction tags are ignored.

KOS_void
Anyone? It would be great if I could get this figured out.

Thank you in advance.

KOS_void
User avatar
santa_ryan
Posts: 397
Joined: June 22nd, 2010, 4:11 am

Re: Conditional Measure(s)

Post by santa_ryan »

View in the about window. Is it registering the value properly?
I have three rules when I'm trying to help you.
  • Don't get mad when you don't understand something
  • Be VERY specific with what you ask for.
    The more specific you are, the higher the quality of support you receive.
  • Do not just copy and paste what I put in examples and come back saying it doesn't work.
    It does work, but I purposely left blanks that you need to fill for your specific needs.
KOS_void
Posts: 5
Joined: May 26th, 2011, 5:31 pm

Re: Conditional Measure(s)

Post by KOS_void »

santa_ryan wrote:View in the about window. Is it registering the value properly?
Well, in a sense, yes it is. However it 'MeasureMem' is only displaying the value in Gigs; it doesn't seem to register the 'Percentual' tag in that window.

Is this where the problem lies? Is it possible to use conditional tags such as IfBelowAction/IfAboveAction on a converted value from a measure? Or is there a way to convert the value at the measure level instead of the meter level?

KOS_void