It is currently April 20th, 2024, 3:14 am

Showing remaining HDD space, always as GB

Get help with creating, editing & fixing problems with skins
node
Posts: 1
Joined: June 1st, 2019, 1:36 pm

Showing remaining HDD space, always as GB

Post by node »

Hello! I've spent a few hours reading and tinkering with the excellent Infinimal skin, however I can't change the HDD display to how I'd prefer.

I'd like the HDD text to show remaining space rather than used/total, and always in GB (never autoscaling to TB). Any help doing this would be greatly appreciated!

Code: Select all

[Metadata]
Name=infinimal
Author=infeeeee
Information=gyetpet(at)gmail(dot)com
License=MIT
Version=3.0.0

@include1=#@#Style.inc

[Variables]
hddLedColor=#colorBarBackground#

; ----------------------------------
; MEASURES return some kind of value
; ----------------------------------

[measureTotalDisk1]
Measure=FreeDiskSpace
Drive=#disk1#
Total=1
UpdateDivider=120
Substitute=" G":"GB"

[measureUsedDisk1]
Measure=FreeDiskSpace
Drive=#disk1#
InvertMeasure=1
UpdateDivider=120
Substitute=" G":"GB"

[MeasureDisk1Temp]
Measure=Plugin
Plugin=SpeedFanPlugin
SpeedFanType=Temperature
SpeedFanNumber=3
SpeedFanScale=C

[measureAccessDisk1]
Measure=Plugin
Plugin=Plugins\PerfMon.dll
PerfMonObject=LogicalDisk
PerfMonCounter="Disk Bytes/sec"
PerfMonInstance="#disk1#"
IfAboveValue=0
IfAboveAction=!RainmeterSetVariable hddLedColor #colorBar#
IfBelowValue=1
IfBelowAction=!RainmeterSetVariable hddLedColor #colorBarBackground#

; ----------------------------------
; METERS display images, text, bars, etc.
; ----------------------------------

[meterLabelDisk1]
Meter=String
MeterStyle=styleTitle
Text=#disk1#
LeftMouseUpAction=["#disk1#\"]

[meterAccessBarDisk1]
Meter=Image
DynamicVariables=1
X=#barAlign#
Y=10
H=16
W=16
SolidColor=#hddLedColor#

[meterValueDisk1perc]
Meter=String
MeterStyle=styleValue
MeasureName=measureUsedDisk1
MeasureName2=measureTotalDisk1
Text=%1%
NumOfDecimals=2
Percentual=1
LeftMouseUpAction=["#disk1#\"]

[meterBarDisk1]
Meter=Bar
MeterStyle=styleBar
MeasureName=measureUsedDisk1
LeftMouseUpAction=["#disk1#\"]

[meterValueDisk1]
Meter=String
MeterStyle=styleBlack
MeasureName=measureUsedDisk1
MeasureName2=measureTotalDisk1
Text=%1/%2
NumOfDecimals=0
AutoScale=1
LeftMouseUpAction=["#disk1#\"]
User avatar
balala
Rainmeter Sage
Posts: 16147
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Showing remaining HDD space, always as GB

Post by balala »

node wrote: June 1st, 2019, 1:42 pm I'd like the HDD text to show remaining space rather than used/total,
Just remove the InvertMeasure option of the [measureUsedDisk1] measure (or alternatively replace it with InvertMeasure=0).
If in plus you'd like to not get the total space, replace the Text option of the [meterValueDisk1] meter with Text=%1.
node wrote: June 1st, 2019, 1:42 pm I'd like the HDD text to show remaining space rather than used/total, and always in GB (never autoscaling to TB). Any help doing this would be greatly appreciated!
In this case you have to calculate manually the space in GB. Add the following Calc measure to your code:

Code: Select all

[measureUsedDisk1GB]
Measure=Calc
Formula=( measureUsedDisk1 / ( 1024 ** 3 ))
This measure returns the space in GB. Now you have to modify the [meterValueDisk1] meter, to properly show the value of this newly added measure. Remove the AutoScale=1 option and replace the Text option with the following one: Text=%1GB. Also replace the MeasureName option with MeasureName=measureUsedDisk1GB. Since the meter now shows the value returned by one single measure, you can remove the MeasureName2 option.

Note a few other details:
  • The !Rainmeter... bang prefix is deprecated. Don't use, simply remove it. For example instead of the !RainmeterSetVariable bang used into the IfAboveAction option of the [measureAccessDisk1] measure, use the following one: IfAboveAction=[!SetVariable hddLedColor "#colorBar#"]
  • Also note that beside removing the !Rainmeter... prefix above, I also added brackets and quotation marks. Although none of these is absolutely needed, it's a good idea to get used to use them. In future can avoid a headache.
  • The PerfMon plugin is deprecated as well. Instead of it, you should have to use the UsageMonitor plugin.