Downloaddetails anzeigen?

  • Hallo,

    weiß jemand von euch, wie ich die Downloadgeschwindigkeit und die Restzeit eines Downloads anzeigen lassen kann?
    Hier mal mein Script dazu:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.2.0
    Author: myName

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Script Start - Add your code below here

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $DownloadLink = "http://download.mozilla.org/?product=firefox-3.5.6&os=win&lang=de"

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Download-Details", 354, 106, 20, 20)
    $Label1 = GUICtrlCreateLabel("Verbleibende Zeit:", 8, 8, 90, 17)
    $Label2 = GUICtrlCreateLabel("Übertragungsrate:", 8, 32, 89, 17)
    $Label3 = GUICtrlCreateLabel("Fortschritt:", 8, 56, 53, 17)
    $FortschrittsProgressY = GUICtrlCreateProgress(8, 80, 334, 17)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $DownloadHandle = InetGet($DownloadLink, @ScriptDir & "\Firefox.exe", 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    Do
    $DownloadInfo = InetGetInfo($DownloadHandle)
    $Prozent = Int($DownloadInfo[0] * 100 / $DownloadInfo[1])
    GUICtrlSetData($FortschrittsProgress, $Prozent)
    Sleep(100)
    Until $DownloadInfo[2] = True

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]

    Vielen Dank für eure Hilfe :thumbup:

  • Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    $uplog = FileSelectFolder("Ordner wählen... ", "")
    if stringlen ($uplog) > 3 then $uplog &= "\"
    if stringinstr ($uplog, ":\") = 0 then
    $uplog = 0
    msgbox(64,"Test","Vorgang auf Wunsch abgebrochen.")
    exit
    endif
    $download = InetGetSize ( "http://hilfe.telekom.de/dlp/eki/downloads/Internet_Software/Software%206.0%20f.%20WinXP%20u.%20Vista/T-Online_6.0.exe", 1 )
    $Form1 = GUICreate("Test", 300, 120)
    $Button1 = GUICtrlCreateButton("Bitte warten...", 100, 10, 100, 25, $WS_GROUP)
    $Progress1 = GUICtrlCreateProgress(20, 55, 260, 25)
    $label1 = GUICtrlCreatelabel("T-Online_6.0.exe", 21, 38, 260, 15 )
    $label2 = GUICtrlCreatelabel("0 KB von " & int($download/1024) & " KB", 21, 84, 260, 15 )
    GUISetState(@SW_SHOW)
    Opt("GuiOnEventMode", 0)
    if $download > 0 then
    $update = InetGet ( "http://hilfe.telekom.de/dlp/eki/downloads/Internet_Software/Software%206.0%20f.%20WinXP%20u.%20Vista/T-Online_6.0.exe", $uplog & "T-Online_6.0.exe", 1, 1)
    local $sofar, $diff2
    GUICtrlSetData($button1,"abbrechen")
    do
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $Button1
    InetClose($update)
    msgbox(64,"Test","Vorgang auf Wunsch abgebrochen.")
    GUICtrlSetData($button1,".")
    EndSwitch
    $sofar=InetGetInfo($update, 0)
    sleep(50)
    $diff2=InetGetInfo($update, 0)
    GUICtrlSetData($Progress1, int(($sofar/$download)*100))
    GUICtrlSetData($label2, int($sofar/1024) & " KB von " & int($download/1024) & " KB (" & round(($diff2-$sofar)/51.2, 1) & " KB/s)")
    if InetGetInfo($update, 2) then GUICtrlSetData($button1,".")
    until GUICtrlRead ($button1) = "."
    GUIDelete($form1)
    endif

    [/autoit]

    hatte da auch schon mal was gebastelt. was mir an deinem code spontan auffällt ist das sleep() statt timerdiff verwendet wird.

    Einmal editiert, zuletzt von andygo (20. Dezember 2009 um 12:06)

  • Danke ich habs jetzt mal selber versucht. Allerdingst habe ich keine Ahnung, wie man die Restliche Zeit anzeigen lassen könnte.

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.2.0
    Author: myName

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Script Start - Add your code below here

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $DownloadLink = "http://download.mozilla.org/?product=firefox-3.5.6&os=win&lang=de"

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Download-Details", 354, 106, 20, 20)
    $Label1 = GUICtrlCreateLabel("Verbleibende Zeit:", 8, 8, 300, 17)
    $Label2 = GUICtrlCreateLabel("Übertragungsrate:", 8, 32, 300, 17)
    $Label3 = GUICtrlCreateLabel("Fortschritt:", 8, 56, 300, 17)
    $FortschrittsProgress = GUICtrlCreateProgress(8, 80, 334, 17)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $DownloadHandle = InetGet($DownloadLink, @ScriptDir & "\Firefox.exe", 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    ;~ MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _
    ;~ "Size: " & $aData[1] & @CRLF & _
    ;~ "Complete?: " & $aData[2] & @CRLF & _
    ;~ "Successful?: " & $aData[3] & @CRLF & _
    ;~ "@error: " & $aData[4] & @CRLF & _
    ;~ "@extended: " & $aData[5] & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    $AlterWert = 0

    [/autoit] [autoit][/autoit] [autoit]

    Do
    $DownloadInfo = InetGetInfo($DownloadHandle)
    $Prozent = Int($DownloadInfo[0] * 100 / $DownloadInfo[1])
    GUICtrlSetData($FortschrittsProgress, $Prozent)
    ;Fortschritt in Prozent anzeigen.
    GUICtrlSetData($Label3, "Fortschritt: " & $Prozent & " %")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $DownloadInfo = InetGetInfo($DownloadHandle)
    $AlterWert = $DownloadInfo[0]
    Sleep(500)
    $DownloadInfo = InetGetInfo($DownloadHandle)
    ;Übertragungsrate
    $Uebertragungsrate = (($DownloadInfo[0] - $AlterWert) * 5) / 1024
    GUICtrlSetData($Label2, "Übertragungsrate: " _
    & $Uebertragungsrate _
    & " Kb\s")

    [/autoit] [autoit][/autoit] [autoit]

    ;Die restlich verbleibende Zeit anzeigen.

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    GUICtrlSetData($Label1, "Restzeit: " & $DownloadInfo[0] / ($Uebertragungsrate * 1024) * $DownloadInfo[1])

    [/autoit] [autoit][/autoit] [autoit]

    Until $DownloadInfo[2] = True

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]

    Edit: Müsste das mit der Restzeit nicht ungefähr so ausehen:

    Code
    Heutergeladen: 40.000.000 bytes
    Größe: 450.000.000  bytes
    Geschwindigkeit: 200.000 bytes
    
    
    (Größe - Heruntergeladen) / Geschwindigkeit
    • Offizieller Beitrag

    Probier es mal so:

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    AutoIt Version: 3.3.2.0
    Author: myName

    [/autoit] [autoit][/autoit] [autoit]

    Script Function:
    Template AutoIt script.

    [/autoit] [autoit][/autoit] [autoit]

    #ce ----------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit]

    ; Script Start - Add your code below here

    [/autoit] [autoit][/autoit] [autoit]

    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $DownloadLink = "http://download.mozilla.org/?product=firefox-3.5.6&os=win&lang=de"

    [/autoit] [autoit][/autoit] [autoit]

    $Form1 = GUICreate("Download-Details", 354, 106, 20, 20)
    $Label1 = GUICtrlCreateLabel("Verbleibende Zeit:", 8, 8, 300, 17)
    $Label2 = GUICtrlCreateLabel("Übertragungsrate:", 8, 32, 300, 17)
    $Label3 = GUICtrlCreateLabel("Fortschritt:", 8, 56, 300, 17)
    $FortschrittsProgress = GUICtrlCreateProgress(8, 80, 334, 17)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    $DownloadHandle = InetGet($DownloadLink, @ScriptDir & "\Firefox.exe", 1, 1)

    [/autoit] [autoit][/autoit] [autoit]

    ;~ MsgBox(0, "", "Bytes read: " & $aData[0] & @CRLF & _
    ;~ "Size: " & $aData[1] & @CRLF & _
    ;~ "Complete?: " & $aData[2] & @CRLF & _
    ;~ "Successful?: " & $aData[3] & @CRLF & _
    ;~ "@error: " & $aData[4] & @CRLF & _
    ;~ "@extended: " & $aData[5] & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    $AlterWert = 0

    [/autoit] [autoit][/autoit] [autoit]

    Do
    $DownloadInfo = InetGetInfo($DownloadHandle)
    $Prozent = Int($DownloadInfo[0] * 100 / $DownloadInfo[1])
    GUICtrlSetData($FortschrittsProgress, $Prozent)
    ;Fortschritt in Prozent anzeigen.
    GUICtrlSetData($Label3, "Fortschritt: " & $Prozent & " %")
    $AlterWert = $DownloadInfo[0]
    Sleep(500)
    $DownloadInfo = InetGetInfo($DownloadHandle)
    ;Übertragungsrate
    $Uebertragungsrate = (($DownloadInfo[0] - $AlterWert) ) / 1024 *2
    GUICtrlSetData($Label2, "Übertragungsrate: " _
    & $Uebertragungsrate _
    & " Kb\s")

    [/autoit] [autoit][/autoit] [autoit]

    ;Die restlich verbleibende Zeit anzeigen.
    GUICtrlSetData($Label1, "Restzeit: " & Round(($DownloadInfo[1] - $DownloadInfo[0] )/1024/$Uebertragungsrate,0)& " Sekunden")
    Until $DownloadInfo[2] = True

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]
  • Code
    Heutergeladen: 40.000.000 bytes
    Größe: 450.000.000  bytes
    Geschwindigkeit: 200.000 bytes
    
    
    (Größe - Heruntergeladen) / Geschwindigkeit

    nicht eher so ? :

    Code
    Geschwindigkeit (in KB/s )
    Heruntergeladen (in KB)
    Größe (in KB)
    
    
    (Heruntergelden : Geschwindigkeit)*(Größe-Heruntergeladen)