Hallo,
wie kann ich denn einen Upload über "_FtpPutFile" starten und gleichzeitig den Uploadstatus z.B. über GUICtrlCreateProgress in einer EXE realisieren?
das Script bleibt ja immer so lange bei _Ftp_PutFile stehen bis der upload fertig ist!
Hallo,
wie kann ich denn einen Upload über "_FtpPutFile" starten und gleichzeitig den Uploadstatus z.B. über GUICtrlCreateProgress in einer EXE realisieren?
das Script bleibt ja immer so lange bei _Ftp_PutFile stehen bis der upload fertig ist!
Hi,
InetGetSize über Adlibenable ginge denke ich.
So long,
Mega
nein geht leider nicht
Hi,
wieso nicht? Zeig mal deinen Code.
So long,
Mega
Der Upload funktioniert, ich habe ein Sleep eingebaut und lass die Sekunden anzeigen, ab dem Zeitpunkt des Uploades bleiben die stehen!
[autoit]
#include <ftp.au3>
#include <GUIConstants.au3>
$UploadFile="c:\test.rar"
[/autoit][autoit][/autoit][autoit]Dim $FTP_Ordner
Dim $UploadFileName
Dim $Conn
Dim $Size
Dim $Org_Size
Dim $Ornder
Dim $Update_Text
Dim $Update_Text2
Dim $Update_Text3
Dim $Handle
Dim $DllRect
AdlibEnable("Upload_Info")
Update_Gui_open("FTP Upload","")
AdlibEnable("Upload_Info")
Sleep(3000)
$a=StringInStr($UploadFile,"\",0,-1)
$UploadFileName=StringTrimLeft($UploadFile,$a)
$Ornder=StringLeft($UploadFile,$a)
$FTP="IP"
$username="name"
$pass="pass"
$FTP_Ordner="db_backups/"
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $FTP, $username, $pass)
MsgBox(0,"",$Conn)
$Org_Size=FileGetSize($UploadFile)
Local $Ftpp = _FtpPutFile($Conn, $UploadFile, $FTP_Ordner&"/"&$UploadFileName,1)
Local $Ftpc = _FTPClose($Open)
Func Upload_Info()
$Aktuelle_Size=GetSize($FTP_Ordner&$UploadFileName)
Update_Gui("FTP Upload",$UploadFileName&" "&Round($Aktuelle_Size/$Org_Size*100,2)&" %",@SEC)
EndFunc
Func GetSize($Par)
$FileInfo = _FtpFileFindFirst($Conn, $Par, $Handle, $DllRect)
If $FileInfo[0] Then
$Size= $FileInfo[9]
EndIf
_FtpFileFindClose($Handle, $DllRect)
Return Round($Size,2)
EndFunc
Func Update_Gui_open($Text,$Text2,$Text3="")
GUICreate("FTP",450,185,-1,1000,$WS_POPUPWINDOW,$WS_EX_TOPMOST)
$ani1=GUICtrlCreateAvi (@SystemDir & "\shell32.dll",161, 50,10)
$Update_Text=GUICtrlCreateLabel($Text,0,75,450,25,$SS_CENTER)
GUICtrlSetFont(-1,12,600,1,"Verdana")
$Update_Text2=GUICtrlCreateLabel($Text2,0,105,450,25,$SS_CENTER)
GUICtrlSetFont(-1,12,500,1,"Verdana")
$Update_Text3=GUICtrlCreateLabel($Text3,0,140,450,25,$SS_CENTER)
GUICtrlSetFont(-1,12,500,1,"Verdana")
GUICtrlCreateLabel("F10: Abbrechen",0,165,450,25,$SS_CENTER)
GUICtrlSetFont(-1,10,500,1,"Verdana")
GUICtrlSetState ($ani1, 1)
GUISetState()
EndFunc
Func Update_Gui($Update_Text_Par,$Update_Text_Par2,$Update_Text_Par3)
GUICtrlSetData($Update_Text,$Update_Text_Par)
GUICtrlSetData($Update_Text2,$Update_Text_Par2)
GUICtrlSetData($Update_Text3,$Update_Text_Par3)
EndFunc
Func Update_Gui_Close()
GUIDelete()
EndFunc
Hi,
habe mal versucht 'ne Funktion zu schreiben..., kein Plan ob's funzt (sehr wahrscheinlich nicht).
Falls sich jemand in der Materie auskennt, kann er die Funktion ja weiterentwickeln...
http://msdn2.microsoft.com/en-us/library/ms918386.aspx
http://msdn2.microsoft.com/en-us/library/ms918385.aspx
Damit sollte es möglich sein den Uploadprogress hinzukriegen...
;===============================================================================
;
; Function Name: _INTERNET_STATUS_CALLBACK()
; Description: This function is a prototype for an application-defined status callback function.
; Parameter(s): $l_HInternet - Handle for which the callback function is being called.
; $dw_Context - Address of an unsigned long integer value that contains
; the application-defined context value associated with the hInternet parameter.
; $dw_InternetStatus - Unsigned long integer value that contains the status code that indicates
; why the callback function is being called. The following table shows the values
; for this parameter.
; $lpv_StatusInformation - Address of a buffer that contains information pertinent
; to this call to the callback function.
; $dwStatusInformationLength - Unsigned long integer value that contains the size, in TCHARs,
; of the lpvStatusInformation buffer.
; Requirement(s): DllCall, wininet.dll
; Return Value(s): On Success - 1
; On Failure - 0
; Author(s): Greenhorn
;
;===============================================================================
Func _INTERNET_STATUS_CALLBACK($l_HInternet, $dw_Context, $dw_InternetStatus, $lpv_StatusInformation, $dwStatusInformationLength)
[/autoit] [autoit][/autoit] [autoit]Local $ai_INTERNET_STATUS_CALLBACK = DllCall('wininet.dll', 'int', 'INTERNET_STATUS_CALLBACK', 'long', $l_HInternet, 'udword', $dw_Context, 'udword', $dw_InternetStatus, 'ptr', $lpv_StatusInformation, 'udword', $dwStatusInformationLength)
If @error OR $ai_INTERNET_STATUS_CALLBACK[0] = 0 Then
SetError(-1)
Return 0
EndIf
Return $ai_INTERNET_STATUS_CALLBACK[0]
EndFunc ;==> _INTERNET_STATUS_CALLBACK()
;===============================================================================
;
; Function Name: _InternetSetStatusCallback()
; Description: This function sets up a callback function that WinInet functions can call as progress is made during an operation.
; Parameter(s): $l_HInternet - Handle for which the callback is to be set.
; $lpfn_InternetCallback - Long pointer to the callback function
; to call when progress is made, or to
; return NULL to remove the existing callback function.
; For more information about the callback function, see INTERNET_STATUS_CALLBACK.
; Requirement(s): DllCall, wininet.dll
; Return Value(s): On Success - 1
; On Failure - 0
; Author(s): Greenhorn
;
;===============================================================================
Func _InternetSetStatusCallback($l_HInternet, $lpfn_InternetCallback)
[/autoit] [autoit][/autoit] [autoit]Local $ai_InternetSetStatusCallback = DllCall('wininet.dll', 'int', 'InternetSetStatusCallback', 'long', $l_HInternet, 'long_ptr', $lpfn_InternetCallback)
If @error OR $ai_InternetSetStatusCallback[0] = 0 Then
SetError(-1)
Return 0
EndIf
Return $ai_InternetSetStatusCallback[0]
EndFunc ;==> _InternetSetStatusCallback()
Gruß
Greenhorn
Edit: Falls es jemand hinbekommt, bitte PN an mich.
Würde mich freuen...