hallo, Ich habe auf dem Gerüst von PokerFace einen mini FTP Client gemacht, um etwas mit der FTP_Ex zu üben, und weil mir Langweilig war
nun will aber die Refresh Funktion nicht so wirklich das machen, was Sie soll, und ich kann und kann den Fehler nicht finden ![]()
Spoiler anzeigen
#RequireAdmin
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <FTP_Ex.au3>
$serveradresse = "##########"
$username = "##########"
$passwort = "##########"
$open = _FTPOpen("dateishare")
$connection = _FTPConnect($open,$serveradresse,$username,$passwort)
$filelist = _FTPFilesListTo2DArray ($connection)
;GUI CODE STARTET HIER;
$Gui = GUICreate("Dateishare",310,500)
$header = GUICtrlCreateLabel("Datei auswählen",65,10)
$liste = GUICtrlCreateList("",20,30,200,450)
$downloadbutton = GUICtrlCreateButton("Download",235,30,55,50)
$uploadbutton = GUICtrlCreateButton("Upload",235,100,55,50)
$filedel = GUICtrlCreateButton("Delete",235,170,55,50)
$refresh = GUICtrlCreateButton("Refresh",235,240,55,50)
$rename = GUICtrlCreateButton("Rename",235,310,55,50)
For $i = 1 to UBound ($filelist) -1
GUICtrlSetData ($liste, $filelist [$i][0]&"|")
Next
GUISetState(@SW_SHOW)
;GUI CODE ENDET HIER;
while 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
_FTPClose($connection)
_FTPUnInit()
Exit
Case $DownloadButton
$DownFile = GUICtrlRead ($liste)
If $DownFile = "" Then
MsgBox (16, "STOP", "Du musst erst eine Datei auswählen")
Else
DirCreate (@ScriptDir&"\Download")
_FTP_DownloadProgress($connection, @ScriptDir&"\Download\"&$DownFile, "/"&$DownFile)
EndIf
Case $uploadbutton
$UploadPfad = FileOpenDialog("Auswählen",@ScriptDir,"Alle (*.*)")
If $UploadPfad = "" Then
MsgBox (0, "Achtung!", "Erst eine Datei auswählen!")
Else
$dateinamensplit = StringSplit($UploadPfad,"\")
$teile = $dateinamensplit[0]
Global $UploadVorgang = _FTP_UploadProgress($connection, $UploadPfad, "/"&$dateinamensplit[$teile])
If $UploadVorgang = 1 Then
MsgBox (64, "Okay", "hochladen erfolgreich")
Else
MsgBox (16, "Error", "Aufgrund eines Fehlers wird das Programm beendet!")
Exit
EndIf
EndIf
Case $filedel
$s_RemoteFile = GUICtrlRead($liste)
_FTPDelFile($connection, $s_RemoteFile)
MsgBox(64,"ok","Ok, Die Datei wurde erfolgreich gelöscht")
Case $refresh
GUICtrlDelete($liste)
_FTPClose($connection)
_FTPUnInit()
$open = ""
$connection = ""
$filelist = ""
$i = ""
$open = _FTPOpen("Homeworker by Alex")
$connection = _FTPConnect($open,$serveradresse,$username,$passwort)
$filelist = _FTPFilesListTo2DArray ($connection)
$liste = GUICtrlCreateList("",20,30,200,450)
For $i = 1 to UBound ($filelist) -1
GUICtrlSetData ($liste, $filelist [$i][0]&"|")
Next
Case $rename
$s_Existing = GUICtrlRead($liste)
$s_New = InputBox("Rename","in welchen Namen soll die Datei umbenannt werden?",$s_Existing)
if Not @error then
_FTPRenameFile($connection, $s_Existing, $s_New)
MsgBox(0,"ok","Die Datei wurde umbeannt")
Else
MsgBox(64,"oioi","Aktion abgebrochen!")
EndIf
EndSwitch
WEnd
Falls sie jemand nciht hat, habe ich die FTP_Ex.au3 angehängt