It is currently March 29th, 2024, 3:45 pm

Bar percentage

Get help with creating, editing & fixing problems with skins
ianmartorell
Posts: 10
Joined: July 18th, 2010, 11:13 pm

Bar percentage

Post by ianmartorell »

Hi all! I have an horitzontal bar meter and basically what I want is to show the percentage of the lenght of the bar in a text meter. Any simple way to do it?

Thanks in advance!
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Bar percentage

Post by jsmorley »

The missing piece of your puzzle is what the bar is measuring.

But here is an example using free memory:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
BackgroundMode=2
SolidColor=0,0,0,150

;[GATHER MEMORY]==================================

;Metadata added by RainBrowser
;http://rainmeter.net/cms/Rainmeter101-EditingSkins

[Metadata]
Name=
Config=
Description=
Instructions=
Version=
Tags=
License=
Variant=
Preview=

;End of added Metadata

[MeasurePhysMemTotal]
Measure=PhysicalMemory
Total=1
UpdateDivider=2

[MeasurePhysMemUsed]
Measure=PhysicalMemory
UpdateDivider=2

[MeasurePhysMemFree]
Measure=PhysicalMemory
InvertMeasure=1
UpdateDivider=2

[MeasureMemory%Used]
Measure=Calc
Formula=100 - ((MeasurePhysMemFree / (MeasurePhysMemTotal + 1)) * 100)
MinValue=0
MaxValue=100

[MeasureMemory%Free]
Measure=Calc
Formula=100 - ((MeasurePhysMemUsed / (MeasurePhysMemTotal + 1)) * 100)
MinValue=0
MaxValue=100

;[DISPLAY MEMORY]==================================

[MeterTotalMemoryText]
Meter=String
MeasureName=MeasurePhysMemTotal
X=0
Y=0
FontFace=Trebucet MS
FontSize=11
FontColor=255,255,255,255
AntiAlias=1
AutoScale=1
Text=Memory Total: %1

[MeterFreeMemoryText]
Meter=String
MeasureName=MeasurePhysMemFree
X=0
Y=20R
FontFace=Trebucet MS
FontSize=11
FontColor=255,255,255,255
AntiAlias=1
AutoScale=1
Text=Memory Free: %1

[MeterUsedMemoryText]
Meter=String
MeasureName=MeasurePhysMemUsed
X=0
Y=20R
FontFace=Trebucet MS
FontSize=11
FontColor=255,255,255,255
AntiAlias=1
AutoScale=1
Text=Memory Used: %1

[MeasureBarBackground]
Measure=Calc
Formula=1

[MeterBarBackground]
Meter=Bar
MeasureName=MeasureBarBackground
X=0
Y=20R
W=200
H=15
BarColor=150,150,150,255
BarOrientation=Horizontal

[MeterUsedMemoryBar]
Meter=Bar
MeasureName=MeasureMemory%Used
X=0
Y=0r
W=200
H=15
BarColor=205,232,254,255
BarOrientation=Horizontal

[MeterFreeMemory%Text]
Meter=String
MeasureName=MeasureMemory%Free
X=0
Y=0r
FontFace=Trebucet MS
FontSize=11
FontColor=0,0,0,255
AntiAlias=1
AutoScale=1
Text=Memory % Free: %1
Looks like this:
7-19-2010 10-44-16 AM.jpg
ianmartorell
Posts: 10
Joined: July 18th, 2010, 11:13 pm

Re: Bar percentage

Post by ianmartorell »

Thanks, it was really useful ^^. In fact I was playing with a volume bar that calculates its length through a plugin, but when I made a text meter to echo the same value given to the bar, I got different info. However, I was able to get the percentage just like this:

Code: Select all

[MeasureVolume%]
Measure=Calc
Formula=MeasureWin7Audio
MinValue=0
MaxValue=100
and then apply it to the meter:

Code: Select all

[LabelPercentage]
Meter=STRING
MeasureName=MeasureVolume%
MeterStyle=StyleLabel
Text=Volume: %1%
Thank you

--
Ian
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Bar percentage

Post by jsmorley »

Glad it helped. I use that method to do those "sliders" on my memory and drive space meters on that screenshot in my sig.