Hallo
Ich hätte gern einen FTP-Download mit Progressbar, den Download hab ich schon, der klappt. Wie aber kann ich jetzt die Progressbar auf den Download beziehen?
Hallo
Ich hätte gern einen FTP-Download mit Progressbar, den Download hab ich schon, der klappt. Wie aber kann ich jetzt die Progressbar auf den Download beziehen?
Schau mal in der Hilfe nach "_FTP_SetStatusCallback".
Und wie bau ich da ne Progressbar ein? Das Beispiel ist zu hoch für mich...
Ich hab was einfacheres gefunden, hier ein Beispiel:
[autoit]
#include <FTPEx.au3>
#include <Debug.au3>
Local $server = 'ftp.mozilla.org'
Local $username = ''
Local $pass = ''
Local $Open = _FTP_Open('MyFTP Control')
Local $Conn = _FTP_Connect($Open, $server, $username, $pass, 0, $INTERNET_DEFAULT_FTP_PORT, $INTERNET_SERVICE_FTP, 0)
ProgressOn ( "title", "maintext")
_FTP_ProgressDownload($Conn, "xulrunner.zip", "/pub/xulrunner/releases/14.0b6/runtimes/xulrunner-14.0b6.en-US.win32.zip","_UpdateProgress")
Local $Ftpc = _FTP_Close($Open)
Func _UpdateProgress($percent)
ProgressSet($percent, int($percent) & "%")
return 1
EndFunc ;==>_UpdateProgress
eine andere Callbackfunktion, die ein normales Progressbar GUI Element steuert, steht in der Hilfe zu _FTP_ProgressDownload.
Was bei meinem Beispiel nervt, ist dass man es nicht so einfach abbrechen kann.
In der Hilfe stehen 2 Beispiele, wie du oben genannt hast - keinst mit einer GUI Progressbar...
--
In der Hilfe stehen 2 Beispiele, wie du oben genannt hast - keinst mit einer GUI Progressbar...
Tja, da ist nur die Callbackfunktion...
Komplettes Beispiel:
#include <FTPEx.au3>
#include <Debug.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
GUICreate("Dings", 220, 250, 100, 200, -1)
GUISetState(@SW_SHOW)
$progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20)
Local $server = 'ftp.mozilla.org'
Local $username = ''
Local $pass = ''
Local $Open = _FTP_Open('MyFTP Control')
Local $Conn = _FTP_Connect($Open, $server, $username, $pass, 0, $INTERNET_DEFAULT_FTP_PORT, $INTERNET_SERVICE_FTP, 0)
_FTP_ProgressDownload($Conn, "xulrunner.zip", "/pub/xulrunner/releases/14.0b6/runtimes/xulrunner-14.0b6.en-US.win32.zip", "_UpdateProgress")
Local $Ftpc = _FTP_Close($Open)
Func _UpdateProgress($percent)
GUICtrlSetData($progressbar1, $percent)
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Return -1 ; _FTP_DownloadProgress Aborts with -1, so you can exit you app afterwards
EndSwitch
Return 1 ; Otherwise contine Download
EndFunc ;==>_UpdateProgress
Sorry, war in der englischen Hilfe. Mit deinem Beispiel gibts zwar ne GUI, aber die Progressbar ist weiterhin eine eigene GUI?!
[Blockierte Grafik: http://www.gamesync.de/pb.PNG]
Sorry, war in der englischen Hilfe. Mit deinem Beispiel gibts zwar ne GUI, aber die Progressbar ist weiterhin eine eigene GUI?!
Dann hast du noch irgendwo einen "ProgressOn", der nicht gebraucht wird.
Eben nicht, das ist das Problem?! Hier der Code:
#include <FTPEx.au3>
#include <Debug.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
GUICreate("Dings", 220, 250, 100, 200, -1)
GUISetState(@SW_SHOW)
$progressbar1 = GUICtrlCreateProgress(10, 10, 200, 20)
Local $server = '***'
Local $username = '***'
Local $pass = '***'
Local $Open = _FTP_Open('MyFTP Control')
Local $Conn = _FTP_Connect($Open, $server, $username, $pass, 0, $INTERNET_DEFAULT_FTP_PORT, $INTERNET_SERVICE_FTP, 0)
_FTP_ProgressDownload($Conn, @ProgramFilesDir & "\MBDevelopment\GameSync\update.zip", "/Update/1.2.zip")
Local $Ftpc = _FTP_Close($Open)
Func _UpdateProgress($percent)
GUICtrlSetData($progressbar1, $percent)
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Return -1 ; _FTP_DownloadProgress Aborts with -1, so you can exit you app afterwards
EndSwitch
Return 1 ; Otherwise contine Download
EndFunc ;==>_UpdateProgress
Da fehlt der vierte Parameter bei _FTP_ProgressDownload. Du musst den Namen der Callback-Funktion angeben.
Der letzte Parameter für _FTP_ProgressDownload fehlt.
EDIT: hehe, Progandy war schneller.. schlauer Bursche, das.
So?
_FTP_ProgressDownload($Conn, @ProgramFilesDir & "\MBDevelopment\GameSync\update.zip", "/Update/1.2.zip", $FunctionToCall = "_UpdateProgress")
So?
_FTP_ProgressDownload($Conn, @ProgramFilesDir & "\MBDevelopment\GameSync\update.zip", "/Update/1.2.zip", $FunctionToCall = "_UpdateProgress")
Vergleiche mal:
_FTP_ProgressDownload($Conn, "xulrunner.zip", "/pub/xulrunner/releases/14.0b6/runtimes/xulrunner-14.0b6.en-US.win32.zip", "_UpdateProgress")
Peinlich
DANKE!
Script geht nicht mhm ;/