DavidRGreen wrote: ↑June 10th, 2020, 12:17 pm
Also, I noticed that adding "r" to the positioning was ignored, so relative placement wasn't allowed. Maybe relative placement relies on element height specification, but I'll look into that one later.
Not very sure what you mean by "relative placement relies on element height specification", but I can assure you it does work:
Code: Select all
[Rainmeter]
Update=1000
Background=Images\basixBg.png
BackgroundMode=3
BackgroundMargins=0,5,0,5
[Metadata]
Author=David Green
Version=1.1
License=Creative Commons
Information=A CPU Meter for 1 to 8 Cores. Each Core is represented as a stack of bars filled, from bottom to top as usage increases on each core; Blue 20%+, Green 40%+, Yellow 60%+, Magenta 80%+ and Red 100%. Each CPU measure is granulated to 20% intervals. Cores 1 to 4 are displayed on the top (or possibly only) row from left to right, if Cores beyond 4 are needed to be displayed they appear on the second row but fill similarly only top to bottom mirroring to the top row. The number in the centre is the average CPU usage, and will shift downwards between the two rows as required to keep centred.
[Variables]
DividerY=59
Bar2Y=63
[InitCPUMon]
Measure=Calc
UpdateDivider=-1
Formula=%NUMBER_OF_PROCESSORS%
IfCondition=(InitCPUMon=1)
IfTrueAction=[!EnableMeasureGroup "Core1"][!ShowMeterGroup "Core1"]
IfCondition2=(InitCPUMon=2)
IfTrueAction2=[!EnableMeasureGroup "Core1"][!ShowMeterGroup "Core1"][!EnableMeasureGroup "Core2"][!ShowMeterGroup "Core2"]
IfCondition3=(InitCPUMon=4)
IfTrueAction3=[!EnableMeasureGroup "Core1"][!ShowMeterGroup "Core1"][!EnableMeasureGroup "Core2"][!ShowMeterGroup "Core2"][!EnableMeasureGroup "Core3"][!ShowMeterGroup "Core3"]
IfCondition4=(InitCPUMon=6)
IfTrueAction4=[!EnableMeasureGroup "Core1"][!ShowMeterGroup "Core1"][!EnableMeasureGroup "Core2"][!ShowMeterGroup "Core2"][!EnableMeasureGroup "Core3"][!ShowMeterGroup "Core3"][!EnableMeasureGroup "Core4"][!ShowMeterGroup "Core4"]
IfCondition5=(InitCPUMon=8)
IfTrueAction5=[!EnableMeasureGroup "Core1"][!ShowMeterGroup "Core1"][!EnableMeasureGroup "Core2"][!ShowMeterGroup "Core2"][!EnableMeasureGroup "Core3"][!ShowMeterGroup "Core3"][!EnableMeasureGroup "Core4"][!ShowMeterGroup "Core4"][!EnableMeasureGroup "Core5"][!ShowMeterGroup "Core5"]
IfCondition6=(InitCPUMon=6) || (InitCPUMon=8)
IfTrueAction6=[!SetOption DisplayText Y 59]
IfFalseAction6=[!MoveMeter 5 5 "DividerRules"][!MoveMeter 5 5 "Skeleton5"][!MoveMeter 5 5 "CPU5"][!MoveMeter 45 5 "Skeleton6"][!MoveMeter 45 5 "CPU6"][!MoveMeter 140 5 "Skeleton7"][!MoveMeter 140 5 "CPU7"][!MoveMeter 180 5 "Skeleton8"][!MoveMeter 180 5 "CPU8"]
; ---- CPU0 ----
[MCPU0]
Measure=CPU
Processor=0
[DisplayText]
Meter=String
MeasureName=MCPU0
X=110
Y=35
FontColor=0,0,0
FontWeight=700
StringAlign=CenterCenter
StringEffect=Border
FontEffectColor=128,128,128,255
NumOfDecimals=0
AntiAlias=1
Text=%1%
; ---- CPU1 ----
[Skeleton1]
Meter=Image
X=-105r
Y=-54r
ImageName=Images\CPUMeterSkeleton.png
Hidden=1
Group=Core1
[MCPU1]
Measure=CPU
Processor=1
Disabled=1
Group=Core1
[MCPU1Step]
Measure=Calc
Formula=Trunc(MCPU1/20)*0.2
Disabled=1
Group=Core1
[CPU1]
Meter=Bar
MeasureName=MCPU1Step
BarOrientation=Vertical
BarImage=Images\CPUMeterSolid.png
X=0r
Y=0r
Hidden=1
Group=Core1
; ---- CPU2 ----
[Skeleton2]
Meter=Image
X=40r
Y=0r
ImageName=Images\CPUMeterSkeleton.png
Hidden=1
Group=Core2
[MCPU2]
Measure=CPU
Processor=2
Disabled=1
Group=Core2
[MCPU2Step]
Measure=Calc
Formula=Trunc(MCPU2/20)*0.2
Disabled=1
Group=Core2
[CPU2]
Meter=Bar
MeasureName=MCPU2Step
BarOrientation=Vertical
BarImage=Images\CPUMeterSolid.png
X=0r
Y=0r
Hidden=1
Group=Core2
; ---- CPU3 ----
[Skeleton3]
Meter=Image
X=95r
Y=0r
ImageName=Images\CPUMeterSkeleton.png
Hidden=1
Group=Core3
[MCPU3]
Measure=CPU
Processor=3
Disabled=1
Group=Core3
[MCPU3Step]
Measure=Calc
Formula=Trunc(MCPU3/20)*0.2
Disabled=1
Group=Core3
[CPU3]
Meter=Bar
MeasureName=MCPU3Step
BarOrientation=Vertical
BarImage=Images\CPUMeterSolid.png
X=0r
Y=0r
Hidden=1
Group=Core3
; ---- CPU4 ----
[Skeleton4]
Meter=Image
X=40r
Y=0r
ImageName=Images\CPUMeterSkeleton.png
Hidden=1
Group=Core3
[MCPU4]
Measure=CPU
Processor=4
Disabled=1
Group=Core3
[MCPU4Step]
Measure=Calc
Formula=Trunc(MCPU4/20)*0.2
Disabled=1
Group=Core3
[CPU4]
Meter=Bar
MeasureName=MCPU4Step
BarOrientation=Vertical
BarImage=Images\CPUMeterSolid.png
X=0r
Y=0r
Hidden=1
Group=Core3
; ---- Divider ----
[DividerRules]
Meter=Shape
X=-180r
Y=-5r
Shape=Line 5,59,90,59 | Stroke Color 255,255,255 | StrokeWidth 2
Shape2=Line 130,59,215,59 | Stroke Color 255,255,255 | StrokeWidth 2
Hidden=1
Group=Core4
; ---- CPU5 ----
[Skeleton5]
Meter=Image
X=5r
Y=63r
ImageFlip=Vertical
ImageName=Images\CPUMeterSkeleton.png
Hidden=1
Group=Core4
[MCPU5]
Measure=CPU
Processor=5
Disabled=1
Group=Core4
[MCPU5Step]
Measure=Calc
Formula=Trunc(MCPU5/20)*0.2
Disabled=1
Group=Core4
[CPU5]
Meter=Bar
MeasureName=MCPU5Step
BarOrientation=Vertical
BarImage=Images\CPUMeterSolid.png
ImageFlip=Vertical
Flip=1
X=0r
Y=0r
Hidden=1
Group=Core4
; ---- CPU6 ----
[Skeleton6]
Meter=Image
X=40r
Y=0r
ImageName=Images\CPUMeterSkeleton.png
ImageFlip=Vertical
Hidden=1
Group=Core4
[MCPU6]
Measure=CPU
Processor=6
Disabled=1
Group=Core4
[MCPU6Step]
Measure=Calc
Formula=Trunc(MCPU6/20)*0.2
Disabled=1
Group=Core4
[CPU6]
Meter=Bar
MeasureName=MCPU6Step
BarOrientation=Vertical
BarImage=Images\CPUMeterSolid.png
ImageFlip=Vertical
Flip=1
X=0r
Y=0r
Hidden=1
Group=Core4
; ---- CPU7 ----
[Skeleton7]
Meter=Image
X=95r
Y=0r
ImageName=Images\CPUMeterSkeleton.png
ImageFlip=Vertical
Hidden=1
Group=Core5
[MCPU7]
Measure=CPU
Processor=7
Disabled=1
Group=Core5
[MCPU7Step]
Measure=Calc
Formula=Trunc(MCPU7/20)*0.2
Disabled=1
Group=Core5
[CPU7]
Meter=Bar
MeasureName=MCPU7Step
BarOrientation=Vertical
BarImage=Images\CPUMeterSolid.png
ImageFlip=Vertical
Hidden=1
Flip=1
X=0r
Y=0r
Group=Core5
; ---- CPU8 ----
[Skeleton8]
Meter=Image
X=40r
Y=0r
ImageName=Images\CPUMeterSkeleton.png
ImageFlip=Vertical
Hidden=1
Group=Core5
[MCPU8]
Measure=CPU
Processor=8
Disabled=1
Group=Core5
[MCPU8Step]
Measure=Calc
Formula=Trunc(MCPU8/20)*0.2
Disabled=1
Group=Core5
[CPU8]
Meter=Bar
MeasureName=MCPU8Step
BarOrientation=Vertical
BarImage=Images\CPUMeterSolid.png
ImageFlip=Vertical
Flip=1
Hidden=1
X=0r
Y=0r
Group=Core5
In this code, as you can see, the only meter positioned absolutely is [DisplayText], all other are positioned relatively.
And one more: especially on new codes, it is an extremely good idea to use the
@Resources folder, to store all kind of resources used by the skin: images, sounds, fonts, script files, included files and so on. That's why I'd create such a @Resources folder into the root folder (
CPUStepBars\@Resources), and would move all images there. If you do this, the Background option of the [Rainmeter] section for instance would be:
Background=#@#Images\basixBg.png.