Download

  • Also, ich habe ein Problem und zwar versuche ich etwas zu Downloaden und dabei soll mir in einem TrayTip angezeigt werden, wieviele Bytes schon runtergeladen wurden. Wenn ich das Script aber testen will, kommt immer folgende Fehlermeldung:
    ERROR: undefined macro

    Einmal editiert, zuletzt von Ineluki (25. März 2010 um 11:04)

  • [autoit]

    Case $Button1
    $Download = InetGet ( "http://etheria.igame-network.de/etheria/MythsOfEtheria.exe" ,"MythsOfEtheria.exe" , 1 , 1 )
    While @InetGetActive
    TrayTip("Download", "Bytes = " & @InetGetBytesRead, 10, 16)
    Sleep(250)
    Wend

    [/autoit]
  • @Inetgetactive gibt es nicht mehr, stattdessen Ingetgetinfo:

    Spoiler anzeigen
    [autoit]

    Local $hDownload = InetGet("http://www.autoitscript.com/autoit3/files/beta/update.dat", @TempDir & "\update.dat", 1, 1)
    $size = InetGetSize("http://www.autoitscript.com/autoit3/files/beta/update.dat")
    Do
    Sleep(10)
    $Bytes = InetGetInfo($hDownload, 0)
    $info = Round($Bytes / $size, 0) * 100 & @CRLF & $Bytes & " / " & $size
    TrayTip("Download", "Percent: " & $info, 1)
    Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
    Local $aData = InetGetInfo($hDownload) ; Get all information.
    InetClose($hDownload) ; Close the handle to release resourcs.
    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]

    Wer immer nur das tut, was er bereits kann - wird auch immer nur das bleiben, was er bereits ist!

  • @inetGetBytesRead kennt er nicht.

    Ich würde behaupten du müsstest erst über InetGetInfo() den Rückgabewert von InetGet() auswerten und das erste element im array gibt dir die aktuelle bytezahl an.

    Sprich sowas:

    [autoit]


    $DownloadInfo = InetGetInfo($Download)
    TrayTip("Download", "Bytes = " & $DownloadInfo[0], 10, 16)

    [/autoit]


    wäre jetzt mein Vorschlag. :)

    greetz Blade

    Weil Denken die schwerste Arbeit ist, die es gibt, beschäftigen sich auch nur wenige damit.