Hi. I am fairly new to Rainmeter and slowly learning some things about skins. I am using Gnometer skin and I am doing some modifications. I have an external hard drive connected via USB in an enclosure that has a power switch. Sometimes I have the drive on, sometimes not. I have successfully created a .lua script to change the drive usage totals from numerical values to "Not Connected" depending on whether the drive is powered on or not. One thing is baffling me though - I would like the BAR meter for the drive to be empty when the drive is off, but so far I have been unsuccessful. It always shows a full bar when the drive is disconnected.
Is this possible?
Any help appreciated.
It is currently August 26th, 2024, 4:38 am
BAR meter for disk drives
-
- Posts: 3
- Joined: April 7th, 2011, 10:41 pm
-
- Moderator
- Posts: 995
- Joined: June 10th, 2009, 12:44 pm
- Location: Sweden
Re: BAR meter for disk drives
You could pipe the value through a conditional, and if the drive is disconnected you could have the conditional return the value 0.
Think you need to set MaxValue on that, but I'm unsure. You could convert it to a percentage ofc.
Code: Select all
[MeasureDisk]
Measure=FreeDiskSpace
[pipe]
Measure=Calc
Formula=MeasureDisk > 1 ? MeasureDisk : 0
Code: Select all
[MeasureDisk]
Measure=FreeDiskSpace
Drive=#Drive#
[MeasureDiskTotal]
Measure=FreeDiskSpace
Drive=#Drive#
Total=1
[pipe]
Measure=Calc
Formula=MeasureDisk > 1 ? (MeasureDisk / MeasureDiskTotal) : 0
I don't think, therefore I'm not.
-
- Posts: 3
- Joined: April 7th, 2011, 10:41 pm
Re: BAR meter for disk drives
Code: Select all
[Rainmeter]
Author=poiru
AppVersion=1003000
Update=1000
MouseActionCursor=0
MiddleMouseDownAction=!RainmeterDeactivateConfig
BackgroundMode=1
[Metadata]
Name=Disk
Description=Shows your hard disk usage.
Instructions=Click on the icon to open Computer. | To change the displayed disks, activate Gnometer\SkinSettings.ini -> Disks.
Version=1.3.0
License=Creative Commons BY-NC-SA 3.0
[Variables]
skin.Style=Horizontal
@Include=#ROOTCONFIGPATH#SETTINGS\Variables.inc
skin.Width=#width.Disk#
; MEASURES ====================================
[mDisk1]
Measure=FreeDiskSpace
InvertMeasure=1
Drive=#disks.Drive1#
IgnoreRemovable=0
UpdateDivider=120
[mDisk1Total]
Measure=FreeDiskSpace
Total=1
Drive=#disks.Drive1#
IgnoreRemovable=0
UpdateDivider=120
[mDisk2]
Measure=FreeDiskSpace
InvertMeasure=1
Drive=#disks.Drive2#
IgnoreRemovable=0
UpdateDivider=120
[mDisk2Total]
Measure=FreeDiskSpace
Total=1
Drive=#disks.Drive2#
IgnoreRemovable=0
UpdateDivider=120
[mDisk3]
Measure=FreeDiskSpace
InvertMeasure=1
Drive=#disks.Drive3#
IgnoreRemovable=0
UpdateDivider=30
[mDisk3Total]
Measure=FreeDiskSpace
Total=1
Drive=#disks.Drive3#
IgnoreRemovable=0
UpdateDivider=30
[pipe]
Measure=Calc
Formula=mDisk3 > 1 ? (mDisk3 / mDisk3Total) : 0
[mScript]
Measure=Script
ScriptFile="#CURRENTPATH#\Disk.lua"
TableName=#CURRENTCONFIG#
UpdateDivider=2
; STYLES ======================================
@Include2=#ROOTCONFIGPATH#SETTINGS\Style#skin.Style#.inc
[sPopup]
Hidden=0
[sTextL]
Hidden=0
[sTextR]
W=(#skin.Width#-20)
Text="%1B / %2B"
Autoscale=1
Hidden=0
[sSeperator]
Hidden=0
; METERS ======================================
[Line]
Meter=IMAGE
MeterStyle=sLine
[Icon]
Meter=IMAGE
MeterStyle=sIcon
ImageName=Disk.png
ToolTipText="Open Computer"
LeftMouseUpAction=!Execute [explorer.exe shell:MyComputerFolder]
MouseActionCursor=1
[Title]
Meter=STRING
MeterStyle=sTitle
Text="Drives"
[Subtitle]
Meter=STRING
MeterStyle=sSubtitle
MeasureName=mDisk1
Percentual=1
Text="%1% used of #disks.Drive1#"
[Popup]
Meter=IMAGE
MeterStyle=sPopup
H=((#h.Other#*3)+20)
[Drive1Left]
Meter=STRING
MeterStyle=sTextL
Y=#h.Item#
Text="#disks.Drive1#"
LeftMouseUpAction=!Execute ["#disks.Drive1#"]
MouseActionCursor=1
[Drive1Right]
Meter=STRING
MeterStyle=sTextR
MeasureName=mDisk1
MeasureName2=mDisk1Total
[Drive1Bar]
Meter=BAR
MeterStyle=sSeperator
MeasureName=mDisk1
[Drive2Left]
Meter=STRING
MeterStyle=sTextL
Text="#disks.Drive2#"
LeftMouseUpAction=!Execute ["#disks.Drive2#"]
MouseActionCursor=1
[Drive2Right]
Meter=STRING
MeterStyle=sTextR
MeasureName=mDisk2
MeasureName2=mDisk2Total
[Drive2Bar]
Meter=BAR
MeterStyle=sSeperator
MeasureName=mDisk2
[Drive3Left]
Meter=STRING
MeterStyle=sTextL
Text="#disks.Drive3#"
LeftMouseUpAction=!Execute ["#disks.Drive3#"]
MouseActionCursor=1
[Drive3Right]
Meter=STRING
MeterStyle=sTextR
MeasureName=mDisk3
MeasureName2=mDisk3Total
[Drive3Bar]
Meter=BAR
MeterStyle=sSeperator
MeasureName=mDisk3
[Gap]
Meter=IMAGE
MeterStyle=sGap
![Sad :(](./images/smilies/ac.gif)
Edit: Disk3 is the disk I am working on.
-
- Posts: 3
- Joined: April 7th, 2011, 10:41 pm
Re: BAR meter for disk drives
Nevermind, duh. I forgot to change the meter. It works now. Thank you very much for your help!