; by Ritzelrocker04
; mit Hilfe von Oscar

#include <GUIConstants.au3>
#include <String.au3>
#NoTrayIcon

Global $src_LW = "C:\";<= Hier die Anpassung vornehmen!
Global $dest_LW = "D:\";<= Hier die Anpassung vornehmen!

$GUI = GUICreate("SpaceBar v 1.0", 478, 50, -1, 3, $WS_POPUPWINDOW)
$pg_Quelle = GUICtrlCreateProgress(8, 8, 230, 17)
$pg_Ziel = GUICtrlCreateProgress(240, 8, 230, 17)
$tb_Quelle = GUICtrlCreateInput("", 8, 27, 230, 21, $ES_READONLY)
$tb_Ziel = GUICtrlCreateInput("", 240, 27, 230, 21, $ES_READONLY)
$trackmenu = GuiCtrlCreateContextMenu ()
$aboutitem = GuiCtrlCreateMenuitem ("About",$trackmenu)
GuiCtrlCreateMenuitem ("",$trackmenu)
$exititem = GuiCtrlCreateMenuitem ("Exit",$trackmenu)

GuiSetState()

_Update()

AdlibEnable("_Update") ; Empfehlung AdlibEnable("_Update", 300000) = 5min

While 1
	$msg = GuiGetMsg()
	If $msg = $exititem Or $msg = -3 Or $msg = -1 Then ExitLoop
	If $msg = $aboutitem Then Msgbox(0,"About", "SpaceBar v 1.0.06" & @CRLF & "Build 2007-12-18" & @CRLF & "Copyright by Ritzelrocker04 !")
WEnd

GUIDelete()

Exit

Func _Update()

; Quelle
$VOL_Quelle = DriveGetLabel($src_LW)
$TOTAL_Quelle = DriveSpaceTotal($src_LW)	
$FREE_Quelle = DriveSpaceFree($src_LW)
$FREE_Quelle_MB = _StringAddComma(StringReplace(Round ($FREE_Quelle, 2), '.', ','), ".", ",")
$i_Progress_Quelle = StringReplace(Round(($TOTAL_Quelle - $FREE_Quelle) / ($TOTAL_Quelle / 100), 2), ".", ",")
	GUICtrlSetData($pg_Quelle,$i_Progress_Quelle)
	GUICtrlSetData($tb_Quelle,"Auf " & $VOL_Quelle & " sind "& $FREE_Quelle_MB & " MB frei")
; Ziel
$VOL_Ziel = DriveGetLabel($dest_LW)
$TOTAL_Ziel = DriveSpaceTotal($dest_LW)	
$FREE_Ziel = DriveSpaceFree($dest_LW)		
$FREE_Ziel_MB = _StringAddComma(StringReplace(Round ($FREE_Ziel, 2), '.', ','), ".", ",")
$i_Progress_Ziel = StringReplace(Round(($TOTAL_Ziel - $FREE_Ziel) / ($TOTAL_Ziel / 100), 2), ".", ",")
	GUICtrlSetData($pg_Ziel,$i_Progress_Ziel)
	GUICtrlSetData($tb_Ziel,"Auf " & $VOL_Ziel & " sind "& $FREE_Ziel_MB & " MB frei")

EndFunc ; ==> AdlibEnable("_Update")