Is there a program that constantly checks a certain file size on hard drive, like every 5 minutes or something?
If the file size stops increasing, I would run some action X (X set by the user – like maybe launch an application or play a sound).
OS - Windows 7 Home
The following code is not working. It is not picking up the file size properly. When I right click on the file and check its size, it's constantly updated. However, AutoIt script seems not to be grabbing the correct size every 2 minutes. When I increase the time interval to 5 minutes, only then it picks up the updated size SOMETIMES.
Global $logging = True
$file = $CmdLine[1] & "\" & $CmdLine[2]
_log("Filename: " & $file)
$size = 0 ;set initial size to 0
Sleep(60000) ;sleep 1 minute
If FileExists($file) Then
While 1 ;loop indefinitely
$filesize = FileGetSize($file) ;get current size of file
_log("File Size: " & $filesize)
If $filesize = $size Then ;compare new size with old size
_log("Download Halted: " & $filesize) ;notify that file is complete
Run("AStart.bat", $CmdLine[1])
ExitLoop ;exit
EndIf
$size = $filesize ;save current file size
Sleep(120000) ;sleep 2 minutes
WEnd
Else
MsgBox(0, "File Not Found", "File Not Found! - " & $file)
EndIf
Func _log($message)
If $logging Then ; global variable where you can globally switch OFF/ON logging
FileWriteLine(@ScriptDir & "\file.log", @YEAR & "-" & @MON & "-" & @MDAY & "-" & @HOUR & ":" & @MIN & " --> " & $message)
EndIf
EndFunc
