It is currently May 13th, 2024, 1:35 pm
Get help with creating, editing & fixing problems with skins
DarknesFreak
Posts: 12 Joined: September 26th, 2011, 11:14 pm
Post
by DarknesFreak » January 1st, 2012, 6:42 pm
hi
i'm having a problem with the if action, basically what I'm trying to do is make a HDD bar that has color blue
and i want it to change to the color red if HDD capacity is above 75% and to blue if the HDD capacity is blow 75%
can someone please help me with that
her is a simple code
Code: Select all
[MeasureUsedDiskSpace1]
Measure=FreeDiskSpace
Drive=C:
UpdateDivider=30
InvertMeasure=1
IfAboveValue=74
IfAboveAction=!Execute [!RainmeterShowMeter ProgressFill2][!RainmeterHideMeter ProgressFill]
IfBelowValue=75
IfBelowAction=!Execute [!RainmeterShowMeter ProgressFill][!RainmeterHideMeter ProgressFill2]
[ProgressBarBG]
Meter=IMAGE
ImageName=Progress Bar.png
X=r
Y=120
Hidden=0
AntiAlias=1
[ProgressFill1]
Meter=BAR
MeasureName=MeasureUsedDiskSpace1
BarImage=Progress Fill Blue.png
BarOrientation=Horizontal
X=r
Y=120
Hidden=0
AntiAlias=1
[ProgressFill2]
Meter=BAR
MeasureName=MeasureUsedDiskSpace1
BarImage=Progress Fill Orange.png
BarOrientation=Horizontal
X=r
Y=120
Hidden=1
AntiAlias=1
i can't seem to get it to work is there something wrong
Seahorse
Posts: 1175 Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK
Post
by Seahorse » January 1st, 2012, 7:00 pm
I do it with a calc & substitution, Redbar.png is greater than 75% ELSE normal (Bar.png):
Code: Select all
[CalcHD1Bar]
Measure=Calc
Formula=((MeasureHD1Space/MeasureHD1TotalDiskSpace)*100)>75 ? -1 : -2
Substitute=".0":"","-1":"#ROOTCONFIGPATH#\Images\BarRed.png","-2":"#ROOTCONFIGPATH#\Images\Bar.png"
[MeterHD1Bar]
Meter=Bar
MeasureName=MeasureHD1Space
BarOrientation=Horizontal
X=r
Y=r
W=191
H=14
Flip=0
BarImage=[CalcHD1Bar]
DynamicVariables=1
jsmorley
Developer
Posts: 22632 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » January 1st, 2012, 7:38 pm
You just misspelled ProgressFill1 in the two actions. You have it as ProgressFill
Code: Select all
IfAboveAction=!Execute [!RainmeterShowMeter ProgressFill2][!RainmeterHideMeter ProgressFill1]
IfBelowValue=75
IfBelowAction=!Execute [!RainmeterShowMeter ProgressFill1][!RainmeterHideMeter ProgressFill2]
Otherwise, it should work fine.
As Seahorse says, there are several way to come at this. I would probably use:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeasureUsedDiskSpace1]
Measure=FreeDiskSpace
Drive=C:
UpdateDivider=30
InvertMeasure=1
IfAboveValue=74
IfAboveAction=!SetOption ProgressFill BarImage BarRed.jpg
IfBelowValue=75
IfBelowAction=!SetOption ProgressFill BarImage BarGreen.jpg
[ProgressBarBG]
Meter=IMAGE
ImageName=BarBack.jpg
X=r
Y=120
AntiAlias=1
[ProgressFill]
Meter=BAR
MeasureName=MeasureUsedDiskSpace1
BarImage=BarBack.jpg
BarOrientation=Horizontal
X=r
Y=120
AntiAlias=1
Nothing at all wrong with the way you are doing it, but "hiding / showing" meters has often been made unneeded with the addition of !SetOption. Saves a lot of extra meters this way over time.
DarknesFreak
Posts: 12 Joined: September 26th, 2011, 11:14 pm
Post
by DarknesFreak » January 1st, 2012, 9:46 pm
thank you so much for the help
Arne Anka
Posts: 100 Joined: April 18th, 2009, 11:31 am
Location: Sweden
Post
by Arne Anka » January 1st, 2012, 10:34 pm
jsmorley wrote:
As Seahorse says, there are several way to come at this. I would probably use:
Code: Select all
[MeasureUsedDiskSpace1]
Measure=FreeDiskSpace
Drive=C:
UpdateDivider=30
InvertMeasure=1
IfAboveValue=74
IfAboveAction=!SetOption ProgressFill BarImage BarRed.jpg
IfBelowValue=75
IfBelowAction=!SetOption ProgressFill BarImage BarGreen.jpg
But would it work as intended? Probably not, since FreeDiskSpace returns Bytes, not percantage.
Calculation as Seahorse does, do work. But why do the calculation
Code: Select all
[CalcHD1Used]
Measure=Calc
Formula=((MeasureHD1Used/MeasureHD1Total)*100)
Return the Error
Calc: #Infinity somewhere! in [CalcHD1Used]
Is it a bug or a feature?
I hate errors in the log!
Livet är bara en period man ska överleva.
Som filosoferna säger: man föds, man lever och man dör ensam...
jsmorley
Developer
Posts: 22632 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » January 1st, 2012, 11:04 pm
Of course you are right. I was so focused on the !SetOption vs Hide/Show that I forgot you need a calc to get the percentage. Given that, I think Seahorse's approach is as good as any.
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[Variables]
Drive1=C:
[MeasureTotalDrive1]
Measure=FreeDiskSpace
Drive=#Drive1#
Total=1
IgnoreRemovable=0
UpdateDivider=2
[MeasureUsedDrive1]
Measure=FreeDiskSpace
Drive=#Drive1#
InvertMeasure=1
IgnoreRemovable=0
UpdateDivider=2
[CalcHD1Bar]
Measure=Calc
Formula=((MeasureUsedDrive1/MeasureTotalDrive1)*100)>75 ? -1 : -2
Substitute=".0":"","-1":"BarRed.jpg","-2":"Bar.jpg"
[MeterDrive1BarBack]
Meter=Image
SolidColor=150,150,150,150
X=0
Y=1R
W=130
H=2
[MeterDrive1Bar]
Meter=Bar
MeasureName=MeasureUsedDrive1
BarOrientation=Horizontal
Flip=0
BarImage=[CalcHD1Bar]
X=0
Y=0r
W=130
H=2
DynamicVariables=1
You WILL get one error message when the skin is loaded or refreshed, as initially the values of all measures are zero, and you will get a "divide by zero" error from that calc for one update.
DarknesFreak
Posts: 12 Joined: September 26th, 2011, 11:14 pm
Post
by DarknesFreak » January 2nd, 2012, 7:42 pm
it didn't work it stays blue it doesn't change i really don't know what's wrong i did everything you said
her it is
Code: Select all
[MeasureTotalDrive]
Measure=FreeDiskSpace
Drive=C:
Total=1
IgnoreRemovable=0
UpdateDivider=2
[MeasureUsedDrive]
Measure=FreeDiskSpace
Drive=C:
InvertMeasure=1
IgnoreRemovable=0
UpdateDivider=2
[CalcHD1Bar]
Measure=Calc
Formula=((MeasureUsedDrive/MeasureTotalDrive)*100)>75 ? -1 : -2
Substitute=".0":"","-1":"Blue.png","-2":"Red.png"
[ProgressBarBG]
Meter=IMAGE
ImageName=Progress Bar.png
X=r
Y=120
Hidden=0
AntiAlias=1
[ProgressFill]
Meter=BAR
MeasureName=MeasureUsedDrive
BarImage=[CalcHD1Bar]
BarOrientation=Horizontal
X=r
Y=120
Hidden=0
AntiAlias=1
DynamicVariables=1
i kept changing the the limit percentage from 75 to other numbers but it does not change color please help
smurfier
Moderator
Posts: 1931 Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN
Post
by smurfier » January 2nd, 2012, 7:53 pm
I have found in the past that Bar meters do not like Dyanmic Variables.
If this doesn't work for you, you'll have to go back to using two bar meters.
Code: Select all
[MeasureTotalDrive]
Measure=FreeDiskSpace
Drive=C:
Total=1
IgnoreRemovable=0
UpdateDivider=2
[MeasureUsedDrive]
Measure=FreeDiskSpace
Drive=C:
InvertMeasure=1
IgnoreRemovable=0
UpdateDivider=2
[CalcHD1Bar]
Measure=Calc
Formula=(MeasureUsedDrive/MeasureTotalDrive)>0.75 ? -1 : 1
IfAboveValue=0
IfAboveAction=!SetOption ProgressFill BarImage "Red.png"
IfBelowValue=0
IfBelowAction=!SetOption ProgressFill BarImage "Blue.png"
[ProgressBarBG]
Meter=IMAGE
ImageName=Progress Bar.png
X=r
Y=120
Hidden=0
AntiAlias=1
[ProgressFill]
Meter=BAR
MeasureName=MeasureUsedDrive
BarImage=Blue.png
BarOrientation=Horizontal
X=r
Y=120
Hidden=0
AntiAlias=1
DynamicVariables=1
GitHub |
DeviantArt |
Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
Arne Anka
Posts: 100 Joined: April 18th, 2009, 11:31 am
Location: Sweden
Post
by Arne Anka » January 2nd, 2012, 8:29 pm
DarknesFreak wrote: it didn't work it stays blue it doesn't change i really don't know what's wrong i did everything you said
I don't use images, just colors. And it works...
Code: Select all
[Variables]
Drive1=C:
BarRed=255,0,0,255
BarGreen=0,255,0,255
Line=0,0,0,128
[MeasureHD1Total]
Measure=FreeDiskSpace
Total=1
Drive=#Drive1#
[MeasureHD1Used]
Measure=FreeDiskSpace
Drive=#Drive1#
InvertMeasure=1
[CalcHD1Used]
Measure=Calc
Formula=Trunc((MeasureHD1Used/MeasureHD1Total)*100)
IfAboveValue=74
IfAboveAction=!SetVariable BarColor1 "#BarRed#"
IfBelowValue=75
IfBelowAction=!SetVariable BarColor1 "#BarGreen#"
UpdateDivider=2
[BarLine11]
Meter=IMAGE
X=0
Y=0
W=180
H=2
SolidColor=#Line#
[BarLine12]
Meter=IMAGE
X=r
Y=8r
W=180
H=2
SolidColor=#Line#
[BarStart11]
Meter=IMAGE
X=r
Y=-6r
H=6
W=2
SolidColor=#Line#
[BarEnd11]
Meter=IMAGE
X=178
Y=r
H=6
W=2
SolidColor=#Line#
[MeterDrive1Bar]
Meter=BAR
MeasureName=MeasureHD1Used
X=2
Y=r
W=176
H=6
BarOrientation=HORIZONTAL
BarColor=#BarColor1#
DynamicVariables=1
I hope you can make use of it...
Livet är bara en period man ska överleva.
Som filosoferna säger: man föds, man lever och man dör ensam...
Seahorse
Posts: 1175 Joined: June 9th, 2010, 5:56 pm
Location: Locks heath, UK
Post
by Seahorse » January 2nd, 2012, 9:36 pm
A quick glance suggests [CalcHD1Used] is not shown in BarColor=#BarColor1# which should read BarColor=[CalcHD1Used]