#include #include #include #include #include #include #NoTrayIcon $window = GUICreate("Chromium Downloader", 306, 131, 192, 124) $download = GUICtrlCreateButton("Download", 208, 42, 75, 25, $WS_GROUP) $progressbar = GUICtrlCreateProgress(9, 104, 286, 17) $Group1 = GUICtrlCreateGroup("Info", 8, 8, 289, 89) $Label1 = GUICtrlCreateLabel("Size:", 56, 48, 27, 17) $Label2 = GUICtrlCreateLabel("Downloaded:", 16, 72, 67, 17) $Label3 = GUICtrlCreateLabel("Version:", 40, 25, 79, 17) $version = GUICtrlCreateLabel("", 120, 24, 70, 17) $size = GUICtrlCreateLabel("", 120, 48, 70, 17) $percentDone = GUICtrlCreateLabel("0%", 120, 72, 70, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) Global $versionURL = "http://build.chromium.org/buildbot/snapshots/chromium-rel-xp/LATEST" Global $url = "" Global $filename = "chromium.zip" Global $versionNum = "" Global $fileSize = "" Sleep(200) setInfo() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $download download() EndSwitch WEnd Func download() InetGet($url, $filename, 1, 1) While @InetGetActive setPercent(@InetGetBytesRead) $msg = GUIGetMsg() if $msg = $GUI_EVENT_CLOSE then InetGet("abort") FileDelete("chromium.zip") Exit EndIf Sleep(10) WEnd EndFunc Func setInfo() $versionNum = _INetGetSource($versionURL) GUICtrlSetData($version, $versionNum) $url = "http://build.chromium.org/buildbot/snapshots/chromium-rel-xp/" & $versionNum & "/chrome-win32.zip" $fileSize = InetGetSize($url) GUICtrlSetData($size, mbSize($fileSize, 2)) EndFunc Func mbSize($num, $places) return Round( (($num / 1024) / 1024), $places ) & " MB" EndFunc Func setPercent($currentSize) $percent = Round( (($currentSize / $fileSize) * 100) ) & "%" GUICtrlSetData($progressbar, $percent) GUICtrlSetData($percentDone, $percent) EndFunc