知识点:
1.节点[Variables],存放变量的节点。在其它的节点可以通过#变量名#的方式来使用相应的变量。
2. Measure=CPU,可以获取系统CPU使用量的返回值。
Measure=FreeDiskSpace,获取系统磁盘剩余的空间
3. Meter类 :Roundline,已填充圆环的方式显示数据。默认圆环从水平向右的位置以顺时针方向开始绘制。
4.Meter中的条件语句:
IfAboveValue=24
IfAboveAction=[!SetOption MeterCPUPercent FontColor #LightRed#][!UpdateMeter *][!Redr
aw]
;代码段的意思是
;我们可以当返回值大于等于 25%时把颜色变成红色,当小于 25%时返回蓝色
4.Meter类 :Line,Line 类 Meter 将一个或多 个 Measure 随时间返回的百分值显示为一系列点,并将其连接起来作为一张折线图。
5.Drive=#磁盘名:# 这个选项告诉 Measure 测量哪一个磁盘。
6.IgnoreRemovable=0 默认地,FreeDiskSpace 将忽略像 USB 或光驱等移动磁盘。设置 IgnoreRemovable=0 来允许测量这些磁盘。
7.InvertMeasure=1默认地,FreeDiskSpace 将测量一个磁盘的剩余空间。为了测量已用空间,你需 要用到通用 Measure 选项 InvertMeasure=1 来反向测量。
8. Meter 中的 AutoScale 选项将对数字进行自 动缩放成 MB、GB、TB 等等,并在数字后添加 M、G、T 的标签。
9.DynamicVariables 用于告诉 Measure 或 Meter 在当前节点每次更新时,当前节点用
;到的所有变量的值都需要重新确认。(因为有使用到动态变量CurrentDrive)
案例
[Rainmeter]
Update=1000
[Variables]
;设定变量
;颜色变量
DarkBlue=27,63,107,255
MediumBlue=92,135,209,255
LightBlue=207,224,255,255
LightRed=250,148,135,255
AlmostBlack=40,40,40,255
;磁盘
CurrentDrive=C:
Drive1=C:
Drive2=D:
[MeasureCPU]
;获取CPU的使用量
Measure=CPU
;*****************************
;条件语句
IfAboveValue=24
IfAboveAction=[!SetOption MeterCPUPercent FontColor #LightRed#][!UpdateMeter *][!Redraw]
;*****************************
IfBelowValue=25
IfBelowAction=[!SetOption MeterCPUPercent FontColor #LightBlue#][!UpdateMeter *][!Redraw]
;*****************************
;获取磁盘总容量
[MeasureDriveTotal]
Measure=FreeDiskSpace
Drive=#CurrentDrive#
Total=1
IgnoreRemovable=0
DynamicVariables=1
UpdateDivider=-1
;获取磁盘剩余容量
[MeasureDriveFree]
Measure=FreeDiskSpace
Drive=#CurrentDrive#
IgnoreRemovable=0
;DynamicVariables 用于告诉 Measure 或 Meter 在当前节点每次更新时,当前节点用
;到的所有变量的值都需要重新确认。
DynamicVariables=1
;用于控制 Measure 或 Meter 的更新频率。
;设定在 FreeDiskSpace 中设定的 UpdateDivider=5 选项用来告诉 Rainmeter 这
;些 Measure 皮肤每更新 5 次时更新一次,在这里就是 5 秒一次
UpdateDivider=1
;获取磁盘已经使用的容量
[MeasureDriveUsed]
Measure=FreeDiskSpace
Drive=#CurrentDrive#
InvertMeasure=1
IgnoreRemovable=0
DynamicVariables=1
UpdateDivider=5
;绘制背景
[MeterBackground]
Meter=Image
X=0
Y=0
W=185
H=110
SolidColor=#AlmostBlack#
MouseOverAction=[!SetVariable CurrentDrive #Drive2#][!UpdateMeasure *][!UpdateMeter*][!Redraw]
MouseLeaveAction=[!SetVariable CurrentDrive #Drive1#][!UpdateMeasure *][!UpdateMeter*][!Redraw]
[MeterCPUCircleBack]
Meter=Roundline
X=5
Y=8
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#MediumBlue#
AntiAlias=1
[MeterCPUCircle]
Meter=Roundline
;绑定CPU使用量
MeasureName=MeasureCPU
X=5
Y=8
;绘制圆环的大小40x40
W=40
H=40
;圆环的起始位置(Roundline以水平向右的方向为0°,顺时针增加。
StartAngle=(Rad(270))
;绘制的总角度是360 °,也就是一圈
RotationAngle=(Rad(360))
;内圈
LineStart=15
;外圈
LineLength=20
Solid=1
;引用变量
LineColor=#LightBlue#
AntiAlias=1
;显示具体的数值
[MeterCPUPercent]
Meter=String
MeasureName=MeasureCPU
FontFace=Segoe UI
FontSize=8
FontColor=#LightBlue#
X=26
Y=28
StringAlign=CenterCenter
StringStyle=Bold
AntiAlias=1
Text=%1%
[MeterCPULine]
Meter=Line
MeasureName=MeasureCPU
X=49
Y=8
W=130
H=38
LineCount=1
;线色
LineColor=#LightBlue#
;线粗
LineWidth=1
;水平线
HorizontalLines=1
;水平线的颜色
HorizontalLineColor=#AlmostBlack#
;背景颜色
SolidColor=#DarkBlue#
[MeterCPUText]
Meter=String
FontFace=Segoe UI
FontSize=15
FontColor=#LightBlue#
X=48
Y=4
StringStyle=Bold
AntiAlias=1
Text=CPU
;****************************************************************
[MeterCPUCircleBack]
Meter=Roundline
X=5
Y=8
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#MediumBlue#
AntiAlias=1
[MeterCPUCircle]
Meter=Roundline
MeasureName=MeasureCPU
X=5
Y=8
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#LightBlue#
AntiAlias=1
[MeterDriveCircleBack]
Meter=Roundline
X=5
Y=63
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#MediumBlue#
AntiAlias=1
[MeterDriveCircle]
Meter=Roundline
MeasureName=MeasureDriveUsed
X=5
Y=63
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#LightBlue#
AntiAlias=1
[MeterDriveCircleLabel]
Meter=String
FontFace=Segoe UI
FontSize=10
FontColor=#LightBlue#
X=26
Y=83
StringAlign=CenterCenter
StringStyle=Bold
Percentual=1
AntiAlias=1
DynamicVariables=1
Text=#CurrentDrive#
[MeterDriveBack]
Meter=Image
X=49
Y=63
W=130
H=38
SolidColor=#DarkBlue#
[MeterDriveTotalLabel]
Meter=String
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=50
Y=64
StringStyle=Bold
StringAlign=Left
AutoScale=1
AntiAlias=1
Text=Total:
[MeterDriveTotal]
Meter=String
MeasureName=MeasureDriveTotal
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=180
Y=64
StringStyle=Bold
StringAlign=Right
AutoScale=1
AntiAlias=1
Text=%1B
[MeterDriveFreeLabel]
Meter=String
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=50
Y=81
W=130
H=18
ClipString=1
StringStyle=Bold
AutoScale=1
AntiAlias=1
Text=Free:
[MeterDriveFree]
Meter=String
MeasureName=MeasureDriveFree
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=180
Y=81
StringStyle=Bold
StringAlign=Right
AutoScale=1
AntiAlias=1
Text=%1B
实现效果