It is currently April 19th, 2024, 6:44 am

Bartext

General topics related to Rainmeter.
Pimguin
Posts: 1
Joined: November 25th, 2016, 7:06 pm

Bartext

Post by Pimguin »

Hi all,

I started to code another Rainmeter skin today and I'd like to make my text lift on top of a bar. So if the bar goes up 10 pixels the text will also go up 10 pixels. I am currently trying this for my CPU but I also want to do this with my memory and disk space.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Bartext

Post by balala »

Pimguin wrote:Hi all,

I started to code another Rainmeter skin today and I'd like to make my text lift on top of a bar. So if the bar goes up 10 pixels the text will also go up 10 pixels. I am currently trying this for my CPU but I also want to do this with my memory and disk space.
In such cases, you have to dynamically reposition the string, on each update cycle, according to the value returned by the measure.
Take a look at the following code:

Code: Select all

[Rainmeter]
Update=1000

[MeasureCPU]
Measure=CPU

[MeterCPU]
MeasureName=MeasureCPU
Meter=BAR
X=0
Y=0
W=250
H=30
BarColor=185,250,160,255
SolidColor=150,150,150,255
BarOrientation=Horizontal

[MeterBackground]
Meter=Image
SolidColor=150,150,150,255
X=0R
Y=0r
W=72
H=30

[MeterCPUPercentage]
MeasureName=MeasureCPU
Meter=STRING
X=(2.5*[MeasureCPU])
Y=15r
FontColor=0,0,0
FontEffectColor=220,220,220
StringEffect=Shadow
FontSize=18
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFTCENTER
AntiAlias=1
Text=%1%
DynamicVariables=1
See that the horizontal position of the [MeterCPUPercentage] meter (the value of its X option) is set based on the value returned by the [MeasureCPU] measure.
This code is done just for the CPU, but the same way you can add further parameters.
You do not have the required permissions to view the files attached to this post.