Jump to content

Inet and ProgressOn


Recommended Posts

I am trying to get these downloads to show that they are downloading. The first file does fine, everything works download speed, progress bar and all. Once it goes to the second download it freezes up and doesn't show any of the info. The second file still downloads fine but no info is shown?!? I currently have windows 7 with Beta 3.3.1.6 if that makes a difference...

I have tried clearing out the variables with = 0 and = "", adding func's and making variables Local, so the first couple of tries didn't work then I added the MustDeclareVars to make sure they were declared before I used them. Any help would be awesome!!!

#include <IE.au3>
AutoItSetOption("MustDeclareVars", 1)


DWLAFP()
DWLJAVA()
DWLAR9()

Func DWLAFP()
    Local $Url = "", $FileDir = "", $DownloadSize = 0, $Percent = 0, $DownloadSpeed1 = 0, $DownloadSpeed2 = 0, $DownloadRate = 0
    $Url = "http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player_ax.exe"
        ProgressOn("Progress Window", "Initializing...", "", 1, 1, 18)
        $DownloadSize = Int(InetGetSize($Url))
        $FileDir = @ScriptDir & "\Flash.exe"
        InetGet($Url, $FileDir, 1, 1)
        Sleep(1000)
        While @InetGetActive
            $Percent = Int((@InetGetBytesRead / $DownloadSize) * 100)
            $DownloadSpeed1 = @InetGetBytesRead
            Sleep(1000)
            $DownloadSpeed2 = @InetGetBytesRead
            $DownloadRate = Int(($DownloadSpeed2 - $DownloadSpeed1) / 1024)
            If $DownloadRate < 0 Then $DownloadRate = 0
            ProgressSet($Percent, $DownloadRate & " kb/s" & "  " & "   Filesize: " & Round($DownloadSize / 1048576, 1) & "mb" & @CRLF & $Percent & "% of File Downloaded" & @CRLF & "Cancel Downloading by Right Clicking Icon in System Tray!", "Adobe Flash Player")
        WEnd
        ProgressOff()
EndFunc;~ ==> Downloads Adobe Flash Player


Func DWLJAVA()
    Local $Url = "", $FileDir = "", $DownloadSize = 0, $Percent = 0, $DownloadSpeed1 = 0, $DownloadSpeed2 = 0, $DownloadRate = 0
    $Url = "http://javadl.sun.com/webapps/download/AutoDL?BundleId=35684"
        ProgressOn("Progress Window", "Initializing...", "", 1, 1, 18)
        $DownloadSize = Int(InetGetSize($Url))
        $FileDir = @ScriptDir & "\Java.exe"
        InetGet($Url, $FileDir, 1, 1)
        Sleep(2000)
        While @InetGetActive
            $Percent = Int((@InetGetBytesRead / $DownloadSize) * 100)
            $DownloadSpeed1 = @InetGetBytesRead
            Sleep(1000)
            $DownloadSpeed2 = @InetGetBytesRead
            $DownloadRate = Int(($DownloadSpeed2 - $DownloadSpeed1) / 1024)
            If $DownloadRate < 0 Then $DownloadRate = 0
            ProgressSet($Percent, $DownloadRate & " kb/s" & "  " & "   Filesize: " & Round($DownloadSize / 1048576, 1) & "mb" & @CRLF & $Percent & "% of File Downloaded" & @CRLF & "Cancel Downloading by Right Clicking Icon in System Tray!", "Java Update")
        WEnd
        ProgressOff()
EndFunc;~ ==> Downloads Java


Func DWLAR9()
    Local $Url = "", $FileDir = "", $DownloadSize = 0, $Percent = 0, $DownloadSpeed1 = 0, $DownloadSpeed2 = 0, $DownloadRate = 0
    $Url = "http://ardownload.adobe.com/pub/adobe/reader/win/9.x/9.2/enu/AdbeRdr920_en_US.exe"
        ProgressOn("Progress Window", "Initializing...", "", 1, 1, 18)
        $DownloadSize = Int(InetGetSize($Url))
        $FileDir = @TempDir & "\AdbeRdr920_en_US.exe"
        InetGet($Url, $FileDir, 1, 1)
        Sleep(2000)
        While @InetGetActive
            $Percent = Int((@InetGetBytesRead / $DownloadSize) * 100)
            $DownloadSpeed1 = @InetGetBytesRead
            Sleep(1000)
            $DownloadSpeed2 = @InetGetBytesRead
            $DownloadRate = Int(($DownloadSpeed2 - $DownloadSpeed1) / 1024)
            If $DownloadRate < 0 Then $DownloadRate = 0
            ProgressSet($Percent, $DownloadRate & " kb/s" & "  " & "   Filesize: " & Round($DownloadSize / 1048576, 1) & "mb" & @CRLF & $Percent & "% of File Downloaded" & @CRLF & "Cancel Downloading by Right Clicking Icon in System Tray!", "Adobe Reader 9")
        WEnd
        ProgressOff()
EndFunc;~ ==> Downloads Adobe Reader 9
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...