Windows desktop volume usage monitor

This AutoHotKey script shows usages indicators for specified volumes on your Windows desktop.


#SingleInstance, Force

;===================================== Parameters =====================================

Volumes = C E ;Which volume to display; example 1: C example 2: C E
RefreshTime = 5 ;Refresh time in seconds. 600=10 minutes

PlentySpace = 40 ;Up to this percentage the bar is green (or whatever color you specify)
NotMuchSpace = 80 ;From this percentage up the bar is red (or whatever color you specify)

Opacity = 150 ;Bar opacity [0-255]
ColPlenty = Lime ;Color for plenty space left
ColNormal = 6699FF ;Normal color
ColNotMuchLeft = Red ;Disk nearly full

WindowX = 1770 ;Horizontal position on screen, negative values allowed for secundairy monitors left of the primary.
WindowY = 10 ;Top margin

;================================= End of Parameters ==================================

RefreshTime := RefreshTime*1000 ;Convert from seconds to milliseconds; do not change

;This part is for transparency.
CustomColor = EEAA99
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow
Gui, Color, %CustomColor%
WinSet, TransColor, %CustomColor% %opacity%

;Create the progress bars
Loop, Parse, Volumes, %A_SPACE%
Gui, Add, Progress, vVolInfo%A_LoopField%

Gui, Show, x%WindowX% y%WindowY% ;Create the window containing the bar(s)
SetTimer, UpdateVolInfo, %RefreshTime% ;Update it every once in a while

Loop, Parse, Volumes, %A_SPACE%
DriveGet, capacity, capacity, %vol%:\ ;Get drive capacity
DriveSpaceFree, free, %vol%:\ ;Get available disk space
inuse := capacity - free ;Calculate in use capacity
percinuse := (inuse/capacity)*100 ;Calculate percentage in use

;Determine the bar color
ifLess, percinuse, %PlentySpace%
ifGreater, percinuse, %NotMuchSpace%

GuiControl, +c%BarColor%, VolInfo%vol% ;Set the bar color
GuiControl,, VolInfo%vol%, %percinuse% ;Set the bar's progress