Hey leute .War vor einem Jahr nen guter Coder und will jetzt wieder anfangen .
Das Problem ist über das Jahr habe ich einiges vergessen . Sitze gerade an einem Dateien Loader . Bloß wie kann ich es machen das ich auf den Button Klicke das sich die Datei die in dem Button angegeben ist Herunterlade und eine Anzeige kommt aus Autoit wie viel % Schon geladen ist . Wenn sie Fertig ist das Noch eine andere Anzeige kommt was man damit machen will z.b. Wo man sie Abspeichern will oder man sie ausführen will .
Mfg
Edit :
Das habe ich im Inet gefunden :
Das Problem ist über das Jahr habe ich einiges vergessen . Sitze gerade an einem Dateien Loader . Bloß wie kann ich es machen das ich auf den Button Klicke das sich die Datei die in dem Button angegeben ist Herunterlade und eine Anzeige kommt aus Autoit wie viel % Schon geladen ist . Wenn sie Fertig ist das Noch eine andere Anzeige kommt was man damit machen will z.b. Wo man sie Abspeichern will oder man sie ausführen will .
Mfg
Edit :
Das habe ich im Inet gefunden :
Code:
;Tutorial by GtaSpider
#include <GUIConstants.au3>
;Hier werden die Downloads als array deklariert. $FileToDownload[Wieviele downloads] = [Download1,Download2,...]
Global $FilesToDownload[3] = ["http://www.autoitscript.com/autoit3/files/beta/autoit/autoit-v3.2.9.4-beta-setup.exe","http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe","http://ftp-mozilla.netscape.com/pub/mozilla.org/firefox/releases/2.0.0.8/win32/de/Firefox%20Setup%202.0.0.8.exe"]
;Wieviele downloads es sind
Global $Downloads = UBound($FilesToDownload)
;Wo die daten hingeladen werden sollen
Global $DownloadDir = @ScriptDir
;Gui
GUICreate("Test", 276, 76, 193, 115)
GUISetBkColor(0)
$Progress1 = GUICtrlCreateProgress(8, 8, 262, 9,$PBS_SMOOTH)
$Progress2 = GUICtrlCreateProgress(8, 24, 262, 9,$PBS_SMOOTH)
$StatLab = GUICtrlCreateLabel("",8,59,262,15)
GUICtrlSetColor(-1,0xffffff)
$Button = GUICtrlCreateButton("Start", 8, 37, 262, 20, 0)
GUISetState()
;Mainwhile
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
If Not _Download() Then
;Wenn es bei _Download ein error gab (Abbrechen wurde gedrückt)
GUICtrlSetData($Progress1,0)
GUICtrlSetData($Progress2,0)
GUICtrlSetState($Button,$GUI_DISABLE)
GUICtrlSetData($Button,"Abgebrochen")
Sleep(1500)
GUICtrlSetData($Button,"Neustart")
GUICtrlSetState($Button,$GUI_ENABLE)
Else
;Wenn es kein error gab
GUICtrlSetData($Button,"Erfolgreich")
GUICtrlSetData($StatLab,"Komplett")
EndIf
EndSwitch
WEnd
;Funktionen
Func _Download()
Local $i,$iSize,$iBuf,$msg,$iProz,$iOldProz,$sFileName
GUICtrlSetData($Button,"Abbrechen (0%)"); Setze button
For $i = 0 To $Downloads - 1
$iSize = InetGetSize($FilesToDownload[$i]);Holt sich die größe des downloads
$sFileName = StringTrimLeft($FilesToDownload[$i],StringInStr($FilesToDownload[$i],"/",1,-1));Der Dateiname des downlaods
InetGet($FilesToDownload[$i],$DownloadDir&"\"&$sFileName,0,1);Datei wird gedownloadet
GUICtrlSetData($StatLab,"Download: "&$sFileName &" (0%)");Setze statuslabel
While @InetGetActive; Solange der Download aktiv ist
$msg = GUIGetMsg(); Falls Abbrechen gedrückt wird
If $msg = $Button Then Return InetGet("abort")-1 ; Return ((Returnwert von Inetget = 1) - 1) = 0
$iProz = Round(100*@InetGetBytesRead/$iSize);Gibt die Prozentzahl (gerundet) zurück
If $iProz <> $iOldProz Then;Wenn neue Prozentangaben <> alte Prozentangaben dann.. (Verhinder mögliches Flickern von Label/Button)
$iOldProz = $iProz;Setze alte Prozentangabe = neue Prozentangabe
GUICtrlSetData($Progress1,$iProz);Setze Progress 1 mit Prozentangabe des momentanen downlaods
GUICtrlSetData($Progress2,$iBuf+($iProz/$Downloads));Setze Progress 2 auf die Insgesamte Prozentanzahl
GUICtrlSetData($Button,"Abbrechen ("&Round($iBuf+($iProz/$Downloads))&"%)");Setze Abbrechenbutton
GUICtrlSetData($StatLab,"Download: "&$sFileName &" ("&$iProz&"%)");Setze Statuslabel mit Dateiname des downlaods und prozentangabe des downlaods
EndIf
Sleep(50) ;Damit Prozessorlast < 100% ;-)
WEnd
$iBuf += (100/$Downloads)
Next
Return 1
EndFunc