Hilfe FTP

  • Ich habe einen FTP-Programm und funktioniert nicht :-s ?(?(?(

    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <FTPEx.au3>
    #include <TreeViewConstants.au3>

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]

    $Form1 = GUICreate("FileZilla by C0dex", 643, 631, 192, 124)
    $Nick = GUICtrlCreateInput("Nick", 8, 8, 169, 25)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    GUICtrlSetColor(-1, 0xFF0000)
    $password = GUICtrlCreateInput("Password", 192, 8, 169, 25, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    GUICtrlSetColor(-1, 0xFF0000)
    $Server = GUICtrlCreateInput("Server", 384, 8, 169, 25)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    GUICtrlSetColor(-1, 0xFF0000)
    $connect = GUICtrlCreateButton("Connect", 560, 8, 75, 25)
    GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
    $Group1 = GUICtrlCreateGroup("Update File :", 8, 48, 625, 57)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    $up = GUICtrlCreateInput("Upload", 16, 72, 169, 25)
    $Filedirectory= GUICtrlCreateInput("File Directory Server", 200, 72, 201, 25)
    $upload = GUICtrlCreateButton("Upload", 416, 72, 83, 25)
    GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
    $dir = GUICtrlCreateButton("Chosen Dir", 528, 72, 91, 25)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    $Group2 = GUICtrlCreateGroup("Delete a File", 8, 112, 345, 65)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    $del = GUICtrlCreateInput("Delete Directory Server", 24, 136, 233, 25)
    $delete = GUICtrlCreateButton("Delete", 264, 136, 75, 25)
    GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
    $Group3 = GUICtrlCreateGroup("Server File Status", 360, 120, 273, 57)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    $Input4 = GUICtrlCreateInput("Path of server", 368, 144, 185, 25)
    $Button5 = GUICtrlCreateButton("Refresh", 560, 144, 67, 25)
    GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
    $TreeView1 = GUICtrlCreateTreeView(8, 184, 625, 441)
    GUISetState(@SW_SHOW)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit][autoit][/autoit][autoit]

    Case $connect
    $nick=GUICtrlRead($Nick)
    $password=GUICtrlRead($password)
    $server=GUICtrlRead($server)
    $oFTP=_FTP_Open ("oFTP")
    $cFTP=_FTP_Connect ($oFTP,$server,$nick,$password)

    [/autoit][autoit][/autoit][autoit]

    Case $dir
    Local $message = "Press Ctrl or Shift to choose multiple files."
    Local $var = FileOpenDialog($message, @DocumentsCommonDir & "\", "*.*")
    If @error Then
    MsgBox(4096, "", "No File chosen")
    Else
    Global $DirForUpdate = StringReplace($var, "|", @CRLF)
    MsgBox(4096, "", "You chose " & $var)
    EndIf
    GUICtrlSetData($Up,$DirForUpdate)
    Case $upload
    $Fdir=GUICtrlRead($Filedirectory)
    $pFTP=_FTP_FilePut($cFTP,GUICtrlRead($Up),$Fdir)

    [/autoit][autoit][/autoit][autoit]

    Case $delete
    $s_RemoteFile=GUICtrlRead($Del)
    _FTP_FileDelete($cFTP, $Filedirectory)

    [/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit][/autoit][autoit]

    EndSwitch
    WEnd

    [/autoit][autoit][/autoit][autoit][/autoit]
  • Ich habe einen FTP-Programm und funktioniert nicht :-s ?( ?( ?(


    Dies ist keine Fehlerbeschreibung! Was funtioniert nicht?
    Der Code sieht nach einem kurzen Überfliegen funktionstüchtig aus. Hast du korrekte Zugangsdaten verwendet?

    Edit: Das Skript hat wirklich einen Fehler beim FileOpenDialog und scheint auch noch nicht vollendet zu sein. Den Fehler habe ich behoben und zudem Rückmeldungen an den Benutzer eingebaut:

    Spoiler anzeigen
    [autoit]

    #include <StaticConstants.au3>
    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <TreeViewConstants.au3>
    #include <WindowsConstants.au3>
    #include <FTPEx.au3>
    #include <TreeViewConstants.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global $DirForUpdate, $oFTP
    $Form1 = GUICreate("FileZilla by C0dex", 643, 631, 192, 124)
    $Nick = GUICtrlCreateInput("Nick", 8, 8, 169, 25)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    GUICtrlSetColor(-1, 0xFF0000)
    $password = GUICtrlCreateInput("Password", 192, 8, 169, 25, BitOR($GUI_SS_DEFAULT_INPUT, $ES_PASSWORD))
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    GUICtrlSetColor(-1, 0xFF0000)
    $Server = GUICtrlCreateInput("Server", 384, 8, 169, 25)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    GUICtrlSetColor(-1, 0xFF0000)
    $connect = GUICtrlCreateButton("Connect", 560, 8, 75, 25)
    GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
    $Group1 = GUICtrlCreateGroup("Update File :", 8, 48, 625, 57)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    $up = GUICtrlCreateInput("Upload", 16, 72, 169, 25)
    $Filedirectory = GUICtrlCreateInput("File Directory Server", 200, 72, 201, 25)
    $upload = GUICtrlCreateButton("Upload", 416, 72, 83, 25)
    GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
    $dir = GUICtrlCreateButton("Chosen Dir", 528, 72, 91, 25)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    $Group2 = GUICtrlCreateGroup("Delete a File", 8, 112, 345, 65)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    $del = GUICtrlCreateInput("Delete Directory Server", 24, 136, 233, 25)
    $delete = GUICtrlCreateButton("Delete", 264, 136, 75, 25)
    GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
    $Group3 = GUICtrlCreateGroup("Server File Status", 360, 120, 273, 57)
    GUICtrlSetFont(-1, 9, 800, 0, "Palatino Linotype")
    $Input4 = GUICtrlCreateInput("Path of server", 368, 144, 185, 25)
    $Button5 = GUICtrlCreateButton("Refresh", 560, 144, 67, 25)
    GUICtrlSetFont(-1, 10, 800, 0, "Palatino Linotype")
    $TreeView1 = GUICtrlCreateTreeView(8, 184, 625, 400)
    GUICtrlCreateGraphic(0, 595, 643, 2, $SS_BLACKRECT)
    $idLblMessage = GUICtrlCreateLabel("", 8, 600, 637, 25)
    GUICtrlSetData($idLblMessage, "Not connected")
    GUICtrlSetState($upload, $GUI_DISABLE)
    GUICtrlSetState($delete, $GUI_DISABLE)
    GUICtrlSetState($Button5, $GUI_DISABLE)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    _FTP_Close($oFTP)
    Exit

    [/autoit] [autoit][/autoit] [autoit]

    Case $connect
    $Nick = GUICtrlRead($Nick)
    $password = GUICtrlRead($password)
    $Server = GUICtrlRead($Server)
    $oFTP = _FTP_Open("oFTP")
    $cFTP = _FTP_Connect($oFTP, $Server, $Nick, $password)
    If @error Then
    GUICtrlSetData($idLblMessage, "Not connected")
    GUICtrlSetState($upload, $GUI_DISABLE)
    GUICtrlSetState($delete, $GUI_DISABLE)
    GUICtrlSetState($Button5, $GUI_DISABLE)
    MsgBox(16, "Fehler: ", @error)
    Else
    GUICtrlSetState($upload, $GUI_ENABLE)
    GUICtrlSetState($delete, $GUI_ENABLE)
    GUICtrlSetState($Button5, $GUI_ENABLE)
    GUICtrlSetData($idLblMessage, "Connected with " & $Server)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Case $dir
    Local $message = "Press Ctrl or Shift to choose multiple files."
    Local $var = FileOpenDialog($message, @DocumentsCommonDir & "\", "Alle (*.*)")
    If @error Then
    MsgBox(16, "", "No File chosen")
    Else
    $DirForUpdate = StringReplace($var, "|", @CRLF)
    MsgBox(4096, "", "You chose " & $var)
    EndIf
    GUICtrlSetData($up, $DirForUpdate)
    Case $upload
    $Fdir = GUICtrlRead($Filedirectory)
    $pFTP = _FTP_FilePut($cFTP, GUICtrlRead($up), $Fdir)
    If @error Then
    MsgBox(16, "Fehler: ", @error)
    GUICtrlSetData($idLblMessage, "File " & $Fdir & " not uploaded")
    Else
    GUICtrlSetData($idLblMessage, "File " & $Fdir & " uploaded")
    EndIf
    Case $delete
    $s_RemoteFile = GUICtrlRead($del)
    _FTP_FileDelete($cFTP, $s_RemoteFile)
    If @error Then
    MsgBox(16, "Fehler: ", @error)
    GUICtrlSetData($idLblMessage, "File " & $s_RemoteFile & " not deleted")
    Else
    GUICtrlSetData($idLblMessage, "File & " & $s_RemoteFile & " deleted")
    EndIf
    Case $Button5
    MsgBox(0, "", "To be continued!")

    [/autoit] [autoit][/autoit] [autoit]

    EndSwitch
    WEnd

    [/autoit]

    mfg autoBert

    Einmal editiert, zuletzt von autoBert (10. Januar 2013 um 04:46)