Thanks to Rajat for his example and Gre and Ranomore for their example
;dLocation = URL of download, path = where to download to and what name Download(path, dLocation, FullFileName) { Progress, H80, , Downloading..., %FullFileName% Download SetTimer, GetSize, 1000 UrlDownloadToFile, %dLocation%, %path% Progress, Off SetTimer, GetSize, Off Return } GetSize: FullSize := HttpQueryInfo(dLocation, 5) ; get download file size in bytes FileGetSize, FSize, %path%, K ; Get file size in kb FullSize := FullSize / 1000 ; Make in to kb UpdateSize := FSize / FullSize ; get percentage UpdateSize := UpdateSize * 100 ; take out of decimal form UpdateSize := Floor(UpdateSize) IfEqual, FSize, FullSize, Return IfNotEqual, ErrorLevel, 1 Progress, %UpdateSize%, %UpdateSize%`% Complete, Downloading..., %FullFileName% Download - %UpdateSize%`% Complete Return
Note: FullFileName, Path and dLocation need to be declared earlier in the script for GetSize: to pick up
where:
dLocation is the URL of the downloaded file
FullFileName can be anything, I name it the full name of the file (for example, "TUGZip 3.4")
path is the location you want the file to be downloaded to on the disk (which includes the file name, could be %A_ScriptDir%\tugzip34.exe)
Also, HttpQueryInfo is used, which can be found here
EDIT: There was a slight error where the Progress window didn't close. That's corrected. Also made the timer interval less.
-Kerry
Other keywords: status box