Und zwar habe ich die idee von hier.
Will nur wissen ob meine variante bei euch auch klappt oder etwas kürzer geht.
Der file downloader zieht mehre datein nach einander sobald eine fertig ist.
Funktion des Scriptes
- ladet nach einander die Links aus einer Datei runter.
- geschätze Downloadzeit
- Downloadspeed
- Downloadname
- Downloadgröße
- Fortschritt anzeige
Das ganze wird in einer Tooltip angezeigt
Script 1.3
Spoiler anzeigen
#include-once
#include <file.au3>
#Include <Date.au3>
#endregion
Dim $aRecords
[/autoit] [autoit][/autoit] [autoit]$FileopenDialog = FileOpenDialog("", @UserProfileDir& "\", "Datei (*.*)", 1 + 4 )
If @error Then
MsgBox(4096,"Error" ,"No File(s) chosen")
Exit
EndIf
If Not _FileReadToArray($FileopenDialog, $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)
$url = IniRead(@ScriptDir & "\test.ini", "Download", $c, Default)
$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))),$url)
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 (http://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 http://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, $test)
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))
;MsgBox (48, "", $sMSG )
$Time1 = _SecToTime( Round(_FormatFileSize(Round($iSize, 0))/ _SpeedSize($nKBPerSec)),0)
$TimeString = ""
If $Time1[0] > 0 Then $TimeString = $Time1[0] & " sec " & $TimeString
If $Time1[1] > 0 Then $TimeString = $Time1[1] & " min " & $TimeString
If $Time1[2] > 0 Then $TimeString = $Time1[2] & " Std " & $TimeString
If $Time1[3] > 0 Then $TimeString = $Time1[3] & " Tage" & $TimeString
Sleep(750)
ToolTip("File Name.: " & $Name & @CRLF & "Download Grösse.: "& $Groesse & @CRLF & "Status.: " & $sMSG & @CRLF & "Fortschritt.: " & Round($iPercent, 0) & " % " & @CRLF & "Downloadspeed.: " & _SpeedSize($nKBPerSec) & @CRLF & "Downloadzeit ca.: " & $TimeString, 50, 50, "Info", 1)
Return Round($iPercent, 1) & " %"
EndFunc ;==>_CalcPerformance
#cs
****************************************************************************************
****************************************************************************************
****************************************************************************************
******** ********
******** ********
******** Dies ist ein _FormatFileSize & _SpeedSize & _SecToTime ********
******** Copyright: Jam00 (http://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 http://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
Func _SecToTime($Sec, $Flag = 0)
Local $Rechner, $1, $Rest
Local $Zeit[4] = [0, 0, 0, 0]
$Zeit[0] = $Sec
For $1 = 0 To 2
If $1 < 2 Then
$Rechner = 60
Else
$Rechner = 24
EndIf
If $Zeit[$1] > $Rechner - 1 Then
$Rest = Mod($Zeit[$1], $Rechner)
$Zeit[$1 + 1] = ($Zeit[$1] - $Rest) / $Rechner
$Zeit[$1] = $Rest
EndIf
Next
If $Flag = 1 Then
Local $sZeit, $State = 0
For $1 = 3 To 0 Step -1
If $Zeit[$1] > 0 Then
$State = 1
$sZeit &= $Zeit[$1] & ":"
ElseIf $State = 1 Then
$sZeit &= $Zeit[$1] & ":"
EndIf
Next
Return StringTrimRight($sZeit, 1)
EndIf
Return $Zeit
EndFunc ;==>_SecToTime
ini Datei
Spoiler anzeigen
ZitatAlles anzeigen
http://download.thinkbroadband.com/5MB.zip
http://download.thinkbroadband.com/10MB.zip
http://download.thinkbroadband.com/20MB.zip
http://download.thinkbroadband.com/50MB.zip
http://download.thinkbroadband.com/100MB.zip
http://download.thinkbroadband.com/200MB.zip
http://download.thinkbroadband.com/512MB.zip
http://download.thinkbroadband.com/1GB.zip