Okay here's another Quick n Dirty one for checking percentages rather than freespace:
DriveSpaceFree, FreeSpace, C:\
DriveGet, DriveCap, capacity, C:\
Perc:=Round(FreeSpace/DriveCap*100)
If Perc < 10
MsgBox, 48, Low Disk Warning!, Hey Dan, Windows is running low on diskspace. `nGive me a call and we will sort it out - Deano
ExitApp
Just modify the target percentage and you're good.
and here's a whole enchilada version that reads a .ini file you can edit for different situations:
;First we'll check for the DriveAlarm.ini file, and if it's not there, make one with some sane values.
IfNotExist DriveAlarm.ini
FileAppend, [Drive]`nDrv=C:\`n[Type]`n;1=free percentage `n;2=free Megabytes`nTyp=2`n[Target]`n;If type is set to 1 this is a percentage value minus the percent sign`n;if type is set to 2 this is a value in megabytes rounded up.`nTarg=999`n[Message]`n;And a customisable message to tag at the end`n;like 'empty your Recycle Bin' or something`nMsg=, %A_WorkingDir%\DriveAlarm.ini
;Now we'll read the values into variables...
IniRead, Drv, DriveAlarm.ini, Drive, Drv
IniRead, Typ, DriveAlarm.ini, Type, Typ
IniRead, Targ, DriveAlarm.ini, Target, Targ
IniRead, Msg, DriveAlarm.ini, Message, Msg
;...and get the disk capacity and free space
DriveSpaceFree, FrSpc, %Drv%
DriveGet, DrvCap, Capacity, %Drv%
Perc:=Round(FrSpc/DrvCap*100)
;Figure out what type of space detection you want and run the alarm tests accordingly
If Typ=1
Gosub, Percent
If Typ=2
Gosub, FreeMB
;and exit gracefully if all is good...
ExitApp
Percent:
If Perc <= %Targ%
MsgBox, 48, Low Disk Warning!, Your %Drv% drive is down to %Perc%`% capacity.`n%Msg%
Return
FreeMB:
If FrSpc < %Targ%
MsgBox, 48, Low Disk Warning!, Your %Drv% drive is down to %FrSpc% Megabytes...`n%Msg%
Return
Note: If you want to run this at startup, I would recommend you put it someplace safe and put a
shortcut in startup instead.