; Idee http://www.autoit.de/index.php?page=Thread&threadID=19971&highlight=FileReadLine
#include <file.au3>
#Include <Date.au3>

Dim $aRecords
If Not _FileReadToArray(@ScriptDir & "\download.ini", $aRecords) Then
    MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
    Exit
EndIf

For $a = 1 To $aRecords[0]
    ;Msgbox(0,'Record:' & $x, $aRecords[$x])
    IniWrite(@ScriptDir & "\test.ini", "Download", $a, $aRecords[$a])
    $Test = StringSplit($aRecords[$a], "/")
    IniWrite(@ScriptDir & "\test.ini", "Namen", $a, $Test[$Test[0]])
Next
IniWrite(@ScriptDir & "\test.ini", "zahl", "Key", $aRecords[0])


For $b = 1 To $aRecords[0]
    $var = IniRead(@ScriptDir & "\test.ini", "Download", $b, Default)
    ;MsgBox(4096, "Result", $var)
Next

Global Const $Groesen = StringSplit("KB|MB|GB|TB|?|", "|")
Global Const $SpeedGroesen = StringSplit("kbps|Mbps|Gbps|Tbps|Pbps|?|", "|")
Dim $File[IniRead(@ScriptDir & "\test.ini", "Zahl", "key", Default)] = [IniRead(@ScriptDir & "\test.ini", "Download", Default, Default)]
Dim $Filename[IniRead(@ScriptDir & "\test.ini", "Zahl", "key", Default)] = [IniRead(@ScriptDir & "\test.ini", "Download", Default, Default)]

For $c = 1 To IniRead(@ScriptDir & "\test.ini", "Zahl", "key", Default)
    ;MsgBox(4096, "inet",IniRead(@ScriptDir & "\test.ini", "Download", $i, Default))
    Sleep(50)
    If FileExists(@DesktopDir & "\" & "old_" & IniRead(@ScriptDir & "\test.ini", "Namen", $c, Default)) Then FileDelete(@ScriptDir & "\" & "old_" & IniRead(@ScriptDir & "\test.ini", "Namen", $c, Default))
    If FileExists(@ScriptDir & "\" & IniRead(@ScriptDir & "\test.ini", "Namen", $c, Default)) Then FileMove(@ScriptDir & "\" & IniRead(@ScriptDir & "\test.ini", "Namen", $c, Default), @ScriptDir & "\" & "old_" & IniRead(@ScriptDir & "\test.ini", "Namen", $c, Default))
    $sFILESIZE = InetGetSize(IniRead(@ScriptDir & "\test.ini", "Download", $c, Default))
    $hDL = InetGet(IniRead(@ScriptDir & "\test.ini", "Download", $c, Default), @ScriptDir & "\" & IniRead(@ScriptDir & "\test.ini", "Namen", $c, Default),1,1)
    $tStart = TimerInit()
    Do
    $aDL_Info = InetGetInfo($hDL)
    $iPercent = _CalcPerformance($aDL_Info[0], $aDL_Info[2], $sFILESIZE, $tStart,IniRead(@ScriptDir & "\test.ini", "Namen", $c, Default),_FormatFileSize(InetGetSize(IniRead(@ScriptDir & "\test.ini", "Download", $c, Default))))
    Until $aDL_Info[2]
    InetClose($hDL)
    FileDelete(@ScriptDir & "\" & "old_" & IniRead(@ScriptDir & "\test.ini", "Namen", $c, Default))
    ToolTip("Fertig")
    ToolTip("")
Next
FileDelete(@ScriptDir & "\test.ini")
#cs
****************************************************************************************
****************************************************************************************
****************************************************************************************
********                                                                        ********
********                                                                        ********
********    Dies ist ein  _CalcPerformance                                      ********
********    Copyright: autoBert       (www.autoit.de)                           ********
********                                                                        ********
********                                                                        ********
********    Es läuft zu 100% auf Windows XP                                     ********
********    Es läuft zu 000% auf Windows Vista (wurde noch nicht getestet)      ********
********    Es läuft zu 100% auf Windows 07    x64 7201                         ********
********    Alle anderen Windows Versionen sind nicht getestet!                 ********
********                                                                        ********
********    Mit freundlicher Mithilfe von www.autoit.de                         ********
********    Danke an alle die mir mit diesem Projekt geholfen haben.            *******
********                                                                        ********
********    Bei Fragen oder Problemen, schreib mir eine PN im Forum.            ********
********                                                                        ********
********                                                                        ********
****************************************************************************************
****************************************************************************************
****************************************************************************************
#ce
Func _CalcPerformance($iRead, $bDone, $iSize, $tStart,$Name,$Groesse)
    Local $tDiff = TimerDiff($tStart), $iRTime, $sMSG
    Local $iToDo = Round(($iSize - $iRead) / 1024, 2)
    Local $nKBPerSec = Round($iRead / $tDiff * 1000, 2)
    Local $iPercent = Round($iRead / $iSize * 100, 2)
    if ($iSize = 0) And Not $bDone Then
        $iRTime = "unbekannt"
    Else
        $iRTime = Round($iToDo / $nKBPerSec, 0)
    EndIf
    $sMSG = _FormatFileSize(Round($iRead, 0)) & " / " & _FormatFileSize(Round($iSize, 0))
    Sleep(750)
    ToolTip("File Name.: " & $Name & @CRLF & "Download Grösse.: "& $Groesse & @CRLF & "Status.: " & $sMSG & @CRLF & "Fortschritt.: " & $iPercent & " % " & @CRLF & "Downloadspeed.: " & _SpeedSize($nKBPerSec) & @CRLF & "time.: " &  Round($tDiff/ 3600, 0) & " min",50,50,"Info", 1)
    Return Round($iPercent, 1) & " %"
EndFunc   ;==>_CalcPerformance
#cs
****************************************************************************************
****************************************************************************************
****************************************************************************************
********                                                                        ********
********                                                                        ********
********    Dies ist ein  _FormatFileSize & _SpeedSize                          ********
********    Copyright: Jam00 (www.autoit.de)                                    ********
********                                                                        ********
********                                                                        ********
********    Es läuft zu 100% auf Windows XP                                     ********
********    Es läuft zu 000% auf Windows Vista (wurde noch nicht getestet)      ********
********    Es läuft zu 100% auf Windows 07    x64 7201                         ********
********    Alle anderen Windows Versionen sind nicht getestet!                 ********
********                                                                        ********
********    Mit freundlicher Mithilfe von www.autoit.de                         ********
********    Danke an alle die mir mit diesem Projekt geholfen haben.            ********
********                                                                        ********
********    Bei Fragen oder Problemen, schreib mir eine PN im Forum.            ********
********                                                                        ********
********                                                                        ********
****************************************************************************************
****************************************************************************************
****************************************************************************************
#ce
Func _FormatFileSize($sFunc_Size)
    Local $i = 0
    While $sFunc_Size > 1000
        $sFunc_Size /= 1024
        $i += 1
    WEnd
    If $i > 4 Then $i = 4
    Return Round($sFunc_Size, 2) & " " & $Groesen[$i]
EndFunc   ;==>_FormatFileSize

Func _SpeedSize($Speeds)
    Local $si = 0
    While $Speeds > 1000
        $Speeds /= 1024
        $si+=1
    WEnd
    If $si > 5 Then $si = 5
    Return Round ($Speeds,2) & " " & $SpeedGroesen[$si]
EndFunc   ;==>_SpeedSize