It is currently April 18th, 2024, 12:11 am

IfCondition and IfTrueAction

Get help with creating, editing & fixing problems with skins
jav26122
Posts: 26
Joined: February 9th, 2015, 8:45 pm

IfCondition and IfTrueAction

Post by jav26122 »

I'm trying to make a battery meter and everything works except I want the color of the bar measure to reflect the % of the battery.
I think it has to be a problem with the if conditions but I have never used them before and can't figure out what wrong.
The bar properly displays the % and I have a text meter and used that to check the % and ACLine measure to make sure they're working and everything works good except the color conditions.

Code: Select all

[MeasureBatteryPercent]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Percent

[MeasureACLine]
Measure=Plugin
Plugin=PowerPlugin
PowerState=ACLine



[BatteryMeter]
MeasureName=MeasureBatteryPercent
Meter=BAR
IfConditionMode=1
IfCondition=(MeasureBatteryPercent > 80)
IfTrueAction=[!SetOption BatteryMeter BarColor 0,255,0]
IfCondition2=(MeasureBatteryPercent >= 60) && (MeasureBatteryPercent < 80)
IfTrueAction2=[!SetOption BatteryMeter BarColor 100,255,0]
IfCondition3=(MeasureBatteryPercent >= 40) && (MeasureBatteryPercent <60)
IfTrueAction3=[!SetOption BatteryMeter BarColor 200,255,0]
IfCondition4=(MeasureBatteryPercent >= 20) && (MeasureBatteryPercent < 40)
IfTrueAction4=[!SetOption BatteryMeter BarColor 255,171,0]
IfCondition5=(MeasureBatteryPercent < 20)
IfTrueAction5=[!SetOption BatteryMeter BarColor 255,40,0]

IfCondition6=MeasureACLine = 1
IfTrueAction6=[!SetOption BatteryMeter BarColor 0,0,255]
OnUpdateAction=[!Redraw]

BarOrientation=Horizontal
y=12r
x=4r
W=55
H=13
Last edited by Brian on June 28th, 2017, 7:35 pm, edited 1 time in total.
Reason: Changed [Snippet] tags to [Code] tags.
User avatar
balala
Rainmeter Sage
Posts: 16143
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: IfCondition and IfTrueAction

Post by balala »

The IfConditions belong to measures. You can't use them on meters. Just move them from the [BatteryMeter], eg to the [MeasureBatteryPercent] measure.
jav26122
Posts: 26
Joined: February 9th, 2015, 8:45 pm

Re: IfCondition and IfTrueAction

Post by jav26122 »

balala wrote:The IfConditions belong to measures. You can't use them on meters. Just move them from the [BatteryMeter], eg to the [MeasureBatteryPercent] measure.
Thanks I thought I tried that before without luck but I must've done something wrong
User avatar
balala
Rainmeter Sage
Posts: 16143
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: IfCondition and IfTrueAction

Post by balala »

jav26122 wrote:Thanks I thought I tried that before without luck but I must've done something wrong
Probably, if it works now. Does it?
jav26122
Posts: 26
Joined: February 9th, 2015, 8:45 pm

Re: IfCondition and IfTrueAction

Post by jav26122 »

balala wrote:Probably, if it works now. Does it?
yes it works now thanks