Hey, habe mal wieder ein kleines Script geschrieben.
Es ist ganz Simpel, an wählt sich eine URL aus, von wo man Downloaden möchte, man gibt den Speicherpfad ein, und mein Tool downloaded.
Ich habe die Progressbar nicht der tatsächlichen Dateigröße angepasst, sondern die Progressbar wird einfach immer größer, aber es ist auch nur ein kleines Script und kein Projekt
Viel Spass!
File Downloader v1.0
-
-
Toll... andere machen sinnvolle Scripte und arbeiten richtig dafür und du stellst ein 5 Minuten Script rein -.-
...
-
Hi pridrage
sieht schon ganz nett aus
aber ich würde die progressbar der dateigröße anpassen und auch mal aufwendigere Scripte schreibengruss Simon
-
paar handgriffe und schon zeigt der prozentbalken den echten fortschritt an
[autoit]
und der download kann auch abgebrochen werden.
(ACHTUNG: code ist für autoit 3.3.1.5 beta, neue inetget)#include <ButtonConstants.au3>
[/autoit][autoit][/autoit][autoit]
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("File Downloader v1.0", 349, 238, 192, 124)
$Input1 = GUICtrlCreateInput("", 24, 48, 289, 21)
$Button1 = GUICtrlCreateButton("Download", 96, 88, 121, 73, $WS_GROUP)
$Progress1 = GUICtrlCreateProgress(24, 184, 289, 25)
$label = GUICtrlCreatelabel("", 24, 210, 289, 20, $SS_CENTER )
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_FileDownload()
EndSwitch
WEndFunc _FileDownload()
[/autoit]
Local $url, $FSDUrl
$url = GUICtrlRead($Input1)
$size = InetGetSize($url)
$FSDUrl = FileSaveDialog("Speichern", @DesktopDir, "Alle Dateien(*.*)")
$update = InetGet($url, $FSDUrl, 1, 1)
$toshow=TimerInit()
local $sofar
sleep(2000)
GUICtrlSetData($button1,"Cancel")
do
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
GUICtrlSetData($button1,"Download")
EndSwitch
if TimerDiff($toshow)>100 Then
$sofar=InetGetInfo($update, 0)
GUICtrlSetData($Progress1, int(($sofar/$size)*100))
GUICtrlSetData($label ,int($sofar/1024) & " kb von " & int($size/1024) & " kb")
$toshow=TimerInit()
endif
if InetGetInfo($update, 2) then GUICtrlSetData($button1,"Download")
until GUICtrlRead ($button1) = "Download"
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($label ,"")
$cancel = 0
if InetGetInfo($update, 2) and InetGetInfo($update, 3) then
InetClose($update)
MsgBox(64,"Info","Download erfolgreich.")
Else
InetClose($update)
msgbox (16,"Info","Download fehlgeschlagen!")
endif
GUICtrlSetData($button1,"Download")
EndFunc