paar fragen^^

  • Hallo liebe autoit community
    ich habe ein paar probleme ich möchte ein programm schreiben was
    1. die eigenen dateinen zu einem archiv hinzufügt und dies unter @tempdir mir dem namen _Backup.zip speichert
    2. sobald es fertig mit den archiv erstellen ist soll es das archiv hochladen per ftp und das archiv in den temp löschen
    mein problem ist ezz
    Wie finde ich den pfad zu den eigenen datein heraus?
    Wie zippe ich die eigenen datein?
    Wie Lade ich die _backup.zip hoch?

    hoffe ihr könnt mir helfen

    mfg MaStErFrEaK0815

  • Zitat

    Wie finde ich den pfad zu den eigenen datein heraus?


    Steht in der Hilfe:

    Zitat von Hilfe

    @MyDocumentsDir Pfad zu "Eigene Dateien" des aktuellen Benutzers

    Hochladen würde ich mit der ftp.au3

  • Hi,

    1. Der Pfad zu den Eigenen Dateien ist: @MyDocumentsDir: Hier
    2. Schaue dir mal die Zip-UDF an (Eng. Forum): Hier
    3. Per FTP, nimm hierzu die ftp.au3: Hier

    mfg
    Jautois

  • thx
    also punk1 und punkt 2 habe ich geschafft aber punkt drei
    scheitere ich hier mal mein script wo ist der fehler

    [autoit]


    #include <_FTP.au3>

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

    $Folder = "/" & @UserName & "@" & @ComputerName & "_" & @MDAY & ":" & @MON & ":" & @YEAR & "/"
    $server = '******'
    $username = '*****'
    $pass = '******'

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

    $Hand = _FTPOpen('Doesnt Matter')

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

    _FTPMakeDir($Hand, $Folder) ;Make directory in current directory
    if @error then msgbox(0,"Error","MakeDir")

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

    _FtpPutFile($Hand, 'C:\test.exe', $Folder & "Test.exe") ;Upload to top level directory with different file name
    if @error then msgbox(0,"Error","PutFile 2")

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

    _FTPClose($Hand);Close ftp session

    [/autoit]

    ich bekomme beide fehlermeldungen ^^ hoffe ihr könnt helfen ^^

  • Da fehlt noch _FTPConnet("...")

    ich bekomme trotzdem die errors ^^

    [autoit]


    #include <_FTP.au3>

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

    $Folder = "/" & @UserName & "@" & @ComputerName & "_" & @MDAY & ":" & @MON & ":" & @YEAR & "/"
    $server = '******'
    $username = '*****'
    $pass = '******'

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

    $Hand = _FTPOpen('Doesnt Matter')
    _FTPConnect($Hand, $server, $username, $pass)

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

    _FTPMakeDir($Hand, $Folder) ;Make directory in current directory
    if @error then msgbox(0,"Error","MakeDir")

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

    _FtpPutFile($Hand, 'C:\test.exe', $Folder & "Test.exe") ;Upload to top level directory with different file name
    if @error then msgbox(0,"Error","PutFile 2")

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

    _FTPClose($Hand);Close ftp session

    [/autoit]
    • Offizieller Beitrag

    Du musst auch den Identifier von FTPConnect benutzen:

    Spoiler anzeigen
    [autoit]


    #include <_FTP.au3>

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

    $Folder = "/" & @UserName & "@" & @ComputerName & "_" & @MDAY & ":" & @MON & ":" & @YEAR & "/"
    $server = '******'
    $username = '*****'
    $pass = '******'

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

    $Hand = _FTPOpen('Doesnt Matter')
    $FTPConn = _FTPConnect($Hand, $server, $username, $pass)

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

    _FTPMakeDir($FTPConn, $Folder) ;Make directory in current directory
    if @error then msgbox(0,"Error","MakeDir")

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

    _FtpPutFile($FTPConn, 'C:\test.exe', $Folder & "Test.exe") ;Upload to top level directory with different file name
    if @error then msgbox(0,"Error","PutFile 2")

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

    _FTPClose($FTPConn)
    _FTPClose($Hand);Close ftp session

    [/autoit]
  • laut UDF nicht da soll man das Handle von FTPOpen nehmen

    [autoit]

    _FTPConnect($Hand, $server, $username, $pass)
    msgbox(0,'',@error)

    [/autoit]


    was sagt er dazu ?

  • Lesen !

    Er meint das Connect-Handle beim _FTPMakeDir() & _FTPPutFile() ;)

    Zur Nutzung dieses Forum's, ist ein Übersetzer für folgende Begriffe unerlässlich:

    "On-Bort, weier, verscheiden, schädliges, Butten steyling, näckstet, Parr, Porblem, scripe, Kompletenz, harken, manuel zu extramieren, geckukt, würglich, excell, acces oder Compilevorgeng"

  • Lesen !

    Er meint das Connect-Handle beim _FTPMakeDir() & _FTPPutFile() ;)


    Lesen !

    Zitat

    ; Function Name: _FTPPutFile()
    ; Description: Puts an file on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()

    Zitat

    ; Function Name: _FTPMakeDir()
    ; Description: Makes an Directory on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()


    Und jetzt ab in die Ecke schmollen ;)

  • da kommt keine fehler meldung mehr aber der uploaded auch nix und mcht keine dir ^^


    hier meine ftp au3

    Spoiler anzeigen
    [autoit]


    #cs============================================================================
    FTP UDF, Updated By JohnMC On Jan 10th 2009, TeamMC.cc

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

    A Map Of The Handle Array:
    [0]
    [1]= wininet.dll handle from _FTPOpen()
    [2]= Handle from _FTPOpen()
    [3]= Handle from _FTPConnect()
    [4]= FTPFileFindFirst dll struct handle
    [5]= FtpFindFirstFile handle
    #ce=============================================================================

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

    ;===============================================================================
    ;
    ; Function Name: _FTPOpen()
    ; Description: Opens an FTP session.
    ; Parameter(s): $s_Agent - Random name. ( like "myftp" )
    ; $l_AccessType - I dont got a clue what this does.
    ; $s_ProxyName - ProxyName.
    ; $s_ProxyBypass - ProxyByPasses's.
    ; $l_Flags - Special flags.
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - Returns an indentifier.
    ; On Failure - 0 and sets @ERROR
    ; Author(s): Wouter van Kesteren.
    ;
    ;===============================================================================

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

    Func _FTPOpen($s_Agent, $l_AccessType = 1, $s_ProxyName = '', $s_ProxyBypass = '', $l_Flags = 0)

    local $handles[6]
    $handles[1]=DllOpen("wininet.dll")

    Local $ai_InternetOpen = DllCall($handles[1], 'long', 'InternetOpen', 'str', $s_Agent, 'long', $l_AccessType, 'str', $s_ProxyName, 'str', $s_ProxyBypass, 'long', $l_Flags)
    If @error OR $ai_InternetOpen[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    $handles[2]=$ai_InternetOpen[0]

    Return $handles

    EndFunc ;==> _FTPOpen()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPConnect()
    ; Description: Connects to an FTP server.
    ; Parameter(s): $l_InternetSession - Array from _FTPOpen()
    ; $s_ServerName - Server name/ip.
    ; $s_Username - Username.
    ; $s_Password - Password.
    ; $i_ServerPort - Server port ( 0 is default (21) )
    ; $l_Flags - Set To 1 To Enable Passive Mode
    ; $l_Service - Used by wininet for selecting protocol (FTP For this UDF)
    ; - Special flags.
    ; $l_Context - I dont got a clue what this does.
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1.
    ; On Failure - 0 and sets @ERROR
    ; Author(s): Wouter van Kesteren
    ;
    ;===============================================================================

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

    Func _FTPConnect(ByRef $l_InternetSession, $s_ServerName, $s_Username, $s_Password, $i_ServerPort = 21, $l_Service = 1, $l_Flags = 0, $l_Context = 0)

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

    If $l_Flags = 1 Then $l_Flags = 0x08000000

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

    Local $ai_InternetConnect = DllCall($l_InternetSession[1], 'long', 'InternetConnect', 'long', $l_InternetSession[2], 'str', $s_ServerName, 'int', $i_ServerPort, 'str', $s_Username, 'str', $s_Password, 'long', $l_Service, 'long', $l_Flags, 'long', $l_Context)
    If @error OR $ai_InternetConnect[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    $l_InternetSession[3]=$ai_InternetConnect[0]

    Return 1

    EndFunc ;==> _FTPConnect()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPPutFile()
    ; Description: Puts an file on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $s_LocalFile - The local file.
    ; $s_RemoteFile - The remote Location for the file.
    ; $l_Flags - Special flags.
    ; $l_Context - I dont got a clue what this does.
    ; Requirement(s): DllCall, wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Wouter van Kesteren
    ;
    ;===============================================================================

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

    Func _FTPPutFile(ByRef $l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)

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

    If StringRight($s_RemoteFile,1)="/" Then $s_RemoteFile=$s_RemoteFile&StringMid($s_LocalFile,StringInStr ($s_LocalFile,"\",-1,-1)+1)

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

    Local $ai_FTPPutFile = DllCall($l_FTPSession[1], 'int', 'FtpPutFile', 'long', $l_FTPSession[3], 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context)
    If @error OR $ai_FTPPutFile[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    Return $ai_FTPPutFile[0]

    EndFunc ;==> _FTPPutFile()

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

    ;===================================================================================================
    ;
    ; Function Name: _FTPPutFolderContents()
    ; Description: Puts an folder on an FTP server. Recursivley if selected
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $s_LocalFolder - The local folder i.e. "c:\temp".
    ; $s_RemoteFolder - The remote folder i.e. '/website/home'.
    ; $b_RecursivePut - Recurse through sub-dirs. 0=Non recursive, 1=Recursive
    ; Requirement(s): wininet.dll
    ; Author(s): Stumpii
    ;
    ;===================================================================================================

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

    Func _FTPPutFolderContents(ByRef $l_FTPSession, $s_LocalFolder, $s_RemoteFolder, $b_RecursivePut=1, $b_Pattern="*.*")

    local $search = FileFindFirstFile($s_LocalFolder & "\" & $b_Pattern)

    If @error Then Return SetError(1, 0, 0)
    If $search = -1 Then Return SetError(2, 0, 0)

    While 1
    local $file = FileFindNextFile($search)
    If @error Then ExitLoop
    If StringInStr(FileGetAttrib($s_LocalFolder & "\" & $file), "D") Then
    _FTPMakeDir($l_FTPSession, $s_RemoteFolder & "/" & $file)
    If $b_RecursivePut Then
    _FTPPutFolderContents($l_FTPSession, $s_LocalFolder & "\" & $file, $s_RemoteFolder & "/" & $file, $b_RecursivePut)
    EndIf
    Else
    _FTPPutFile($l_FTPSession, $s_LocalFolder & "\" & $file, $s_RemoteFolder & "/" & $file, 0, 0)
    EndIf
    WEnd

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

    FileClose($search)

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

    Return 1

    EndFunc ;==>_FTPPutFolderContents

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

    ;===============================================================================
    ;
    ; Function Name: _FTPGetFoldercontents
    ; Description: Recursively retrieves the contents of a directory on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $s_RemoteDir - The directory on the server to retrieve. (Needs trailing forwardslash)
    ; $s_LocalDir - The Local directory to save to. (Needs trailing backslash)
    ; $b_RecursiveGet - Recurse through sub-dirs. 0=Non recursive (top dir only), 1=Recursive (note that this is not tru recursion)
    ; $s_searchfor - (UNTESTED OTHER THEN DEFAULT) What to download, must be set to default * to download subfolders currently
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): JohnMC
    ;
    ;===============================================================================

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

    Func _FTPGetFolderContents(ByRef $l_FTPSession, $s_RemoteDir, $s_LocalDir, $b_RecursiveGet=1, $s_searchfor="*")
    Local $folderlist[1]
    Local $i=0

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

    While $i < UBound($folderlist)
    Local $subpath=$folderlist[$i]
    _FtpSetCurrentDir($l_FTPSession,"/" & $s_RemoteDir & $subpath)
    Local $FileInfo = _FtpFileFindFirst ($l_FTPSession,$s_searchfor)

    While $FileInfo[0]<>0
    If $FileInfo[1]=16 And $FileInfo[10] <> "." And $FileInfo[10] <> ".." And $b_RecursiveGet<>0 Then
    Local $iUBound = UBound($folderlist)
    ReDim $folderlist[$iUBound + 1]
    $folderlist[$iUBound] = "/" & $subpath & $FileInfo[10] & "/"

    ElseIf $FileInfo[1]=128 Then
    $downloadto = $s_LocalDir & StringReplace ($subpath,"/","\")
    If Not FileExists($downloadto) Then DirCreate($downloadto)
    $return=_FTPGetFile($l_FTPSession,$FileInfo[10],$downloadto&$FileInfo[10])
    endif

    $FileInfo = _FtpFileFindNext($l_FTPSession)
    WEnd

    _FTPFileFindClose($l_FTPSession)
    $i+=1
    WEnd
    EndFunc ;==>_FTPGetFolderContents

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

    ;===============================================================================
    ;
    ; Function Name: _FTPGetFile()
    ; Description: Puts an file on an FTP server.
    ; Parameter(s): $Handle - Array from _FTPOpen()
    ; $s_RemoteFile - The remote file.
    ; $s_LocalFile - The Local Location to download to.
    ; $l_FailEx - If File Exists Localy 1=Fail 0=Proceed (Default) ;Fail Caused Crash For Me On My Vista Machine, changed default -JohnMC
    ; $l_FlagsA - Special flags & Attributes. -JohnMC
    ; $l_Flags - Special flags. 1=BIN 2=ASC
    ; $l_Context - I dont got a clue what this does.
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Dick Bronsdijk
    ; Updated By JohnMC To Add $l_FailEx and $l_FlagsA
    ;
    ;===============================================================================

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

    Func _FTPGetFile(ByRef $Handle, $s_RemoteFile, $s_LocalFile, $l_FailEx = 0, $l_FlagsA = 0, $l_Flags = 1, $l_Context = 0)

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

    If $l_Flags = 1 Then
    $l_Flags = "FTP_TRANSFER_TYPE_BINARY"
    ElseIf $l_Flags = 2 Then
    $l_Flags = "FTP_TRANSFER_TYPE_ASCII"
    EndIf

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

    Local $avResult = DllCall($Handle[1], 'int', 'FtpGetFile', 'long', $Handle[3], 'str', $s_RemoteFile, 'str', $s_LocalFile, 'long', $l_FailEx, 'long', $l_FlagsA, 'long', $l_Flags, 'long', $l_Context)

    If @error Or Not $avResult[0] Then Return SetError(1, 0, False)
    Return True

    EndFunc;==> _FTPGetFile()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPDelFile()
    ; Description: Delete an file from an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $s_RemoteFile - The remote Location for the file.
    ; Requirement(s): DllCall, wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Wouter van Kesteren
    ;
    ;===============================================================================

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

    Func _FTPDelFile(ByRef $l_FTPSession, $s_RemoteFile)

    Local $ai_FTPPutFile = DllCall($l_FTPSession[1], 'int', 'FtpDeleteFile', 'long', $l_FTPSession[3], 'str', $s_RemoteFile)
    If @error OR $ai_FTPPutFile[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    Return $ai_FTPPutFile[0]

    EndFunc ;==> _FTPDelFile()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPRenameFile()
    ; Description: Renames an file on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $s_Existing - The old file name.
    ; $s_New - The new file name.
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Wouter van Kesteren
    ;
    ;===============================================================================

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

    Func _FTPRenameFile(ByRef $l_FTPSession, $s_Existing, $s_New)

    Local $ai_FTPRenameFile = DllCall($l_FTPSession[1], 'int', 'FtpRenameFile', 'long', $l_FTPSession[3], 'str', $s_Existing, 'str', $s_New)
    If @error OR $ai_FTPRenameFile[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    Return $ai_FTPRenameFile[0]

    EndFunc ;==> _FTPRenameFile()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPMakeDir()
    ; Description: Makes an Directory on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $s_Remote - The file name to be deleted.
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0 (DIRECTORY MAY ALREADY EXIST)
    ; Author(s): Wouter van Kesteren
    ;
    ;===============================================================================

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

    Func _FTPMakeDir(ByRef $l_FTPSession, $s_Remote)

    Local $ai_FTPMakeDir = DllCall($l_FTPSession[1], 'int', 'FtpCreateDirectory', 'long', $l_FTPSession[3], 'str', $s_Remote)
    If @error OR $ai_FTPMakeDir[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    Return $ai_FTPMakeDir[0]

    EndFunc ;==> _FTPMakeDir()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPDelDir()
    ; Description: Delete's an Directory on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $s_Remote - The Directory to be deleted.
    ; Requirement(s): DllCall, wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Wouter van Kesteren
    ;
    ;===============================================================================

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

    Func _FTPDelDir(ByRef $l_FTPSession, $s_Remote)

    Local $ai_FTPDelDir = DllCall($l_FTPSession[1], 'int', 'FtpRemoveDirectory', 'long', $l_FTPSession[3], 'str', $s_Remote)
    If @error OR $ai_FTPDelDir[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    Return $ai_FTPDelDir[0]

    EndFunc ;==> _FTPDelDir()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPGetFileSize()
    ; Description: Gets the file size of a remote file
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $s_FileName - Remote file
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): -Ultima-
    ;
    ;===============================================================================

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

    Func _FTPGetFileSize(ByRef $l_FTPSession, $s_FileName)

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

    Local $ai_FTPGetSizeHandle = DllCall($l_FTPSession[1],"ptr","FtpOpenFile","ptr",$l_FTPSession[3],"str",$s_FileName,"dword",0x80000000,"dword",0,"ptr","")

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

    Local $tFileSizeHigh = DllStructCreate("dword")

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

    Local $avResult = DllCall($l_FTPSession[1],"int", "FtpGetFileSize","ptr", $ai_FTPGetSizeHandle,"ptr", DllStructGetPtr($tFileSizeHigh))

    DllCall($l_FTPSession[1], 'int', 'InternetCloseHandle', 'str', $ai_FTPGetSizeHandle[0])

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

    If @error Then Return SetError(1, 0, -1)
    Local $tFileSize = DllStructCreate("dword[2]")
    DllStructSetData($tFileSize, 1, $avResult[0], 1)
    DllStructSetData($tFileSize, 1, DllStructGetData($tFileSizeHigh, 1), 2)

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

    Return DllStructGetData(DllStructCreate("uint64", DllStructGetPtr($tFileSize)), 1)

    EndFunc ;==> _FTPGetFileSize()
    ;===============================================================================
    ;
    ; Function Name: _FTPGetCurrentDir()
    ; Description: Get Current Directory on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - Directory Name
    ; On Failure - 0
    ; Author(s): -Ultima-
    ;
    ;===============================================================================

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

    Func _FTPGetCurrentDir(ByRef $l_FTPSession)

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

    ; Set data/structures up
    Local $tCurrentDirectoryLength = DllStructCreate("dword")
    DllStructSetData($tCurrentDirectoryLength, 1, 2048)

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

    Local $tCurrentDirectory = DllStructCreate("wchar[2048]")

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

    ; Make DLL call
    Local $avResult = DllCall($l_FTPSession[1],"int","FtpGetCurrentDirectoryW","ptr", $l_FTPSession[3],"ptr", DllStructGetPtr($tCurrentDirectory),"ptr", DllStructGetPtr($tCurrentDirectoryLength))

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

    ; Return response
    If @error Then Return SetError(1, 0, "")
    If Not $avResult[0] Then Return SetError(2, DllStructGetData($tCurrentDirectoryLength, 1), "")
    Return DllStructGetData($tCurrentDirectory, 1)
    EndFunc;==> _FTPGetCurrentDir()

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

    ;===============================================================================
    ;
    ; Function Name: _FtpSetCurrentDir()
    ; Description: Set Current Directory on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $s_Remote - The Directory to be set.
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Beast
    ;
    ;===============================================================================

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

    Func _FtpSetCurrentDir(ByRef $l_FTPSession, $s_Remote)

    Local $ai_FTPSetCurrentDir = DllCall($l_FTPSession[1], 'int', 'FtpSetCurrentDirectory', 'long', $l_FTPSession[3], 'str', $s_Remote)
    If @error OR $ai_FTPSetCurrentDir[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    Return $ai_FTPSetCurrentDir[0]

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

    EndFunc;==> _FtpSetCurrentDir()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPFileFindFirst()
    ; Description: Find First File on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $s_RemoteFile - The remote file to find
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Dick Bronsdijk
    ;
    ;===============================================================================

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

    Func _FTPFileFindFirst(ByRef $l_FTPSession, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)

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

    $l_FTPSession[4]=DllStructCreate("int;uint[2];uint[2];uint[2];int;int;int;int;char[256];char[14]")

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

    if @error Then
    SetError(-2)
    Return ""
    endif

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

    Dim $a_FTPFileList[1]
    $a_FTPFileList[0] = 0

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

    Local $ai_FTPPutFile = DllCall($l_FTPSession[1], 'int', 'FtpFindFirstFile', 'long', $l_FTPSession[3], 'str', $s_RemoteFile, 'ptr', DllStructGetPtr($l_FTPSession[4]), 'long', $l_Flags, 'long', $l_Context)
    If @error OR $ai_FTPPutFile[0] = 0 Then
    SetError(-1)
    Return $a_FTPFileList
    EndIf
    $l_FTPSession[5] = $ai_FTPPutFile[0]
    $FileName = DllStructGetData($l_FTPSession[4], 9)

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

    Dim $a_FTPFileList[12]
    $a_FTPFileList[0] = 12
    $a_FTPFileList[1] = DllStructGetData($l_FTPSession[4], 1) ; File Attributes
    $a_FTPFileList[2] = DllStructGetData($l_FTPSession[4], 2, 1) ; Creation Time Low
    $a_FTPFileList[3] = DllStructGetData($l_FTPSession[4], 2, 2) ; Creation Time High
    $a_FTPFileList[4] = DllStructGetData($l_FTPSession[4], 3, 1) ; Access Time Low
    $a_FTPFileList[5] = DllStructGetData($l_FTPSession[4], 3, 2) ; Access Time High
    $a_FTPFileList[6] = DllStructGetData($l_FTPSession[4], 4, 1) ; Last Write Low
    $a_FTPFileList[7] = DllStructGetData($l_FTPSession[4], 4, 2) ; Last Write High
    $a_FTPFileList[8] = DllStructGetData($l_FTPSession[4], 5) ; File Size High
    $a_FTPFileList[9] = DllStructGetData($l_FTPSession[4], 6) ; File Size Low
    $a_FTPFileList[10] = DllStructGetData($l_FTPSession[4], 9) ; File Name
    $a_FTPFileList[11] = DllStructGetData($l_FTPSession[4], 10) ; Altername

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

    Return $a_FTPFileList

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

    EndFunc;==> _FTPFileFindFirst()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPFileFindNext()
    ; Description: Find Next File on an FTP server.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; $l_DllStruct -
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Dick Bronsdijk
    ;
    ;===============================================================================

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

    Func _FTPFileFindNext(ByRef $l_FTPSession)

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

    Dim $a_FTPFileList[1]
    $a_FTPFileList[0] = 0

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

    Local $ai_FTPPutFile = DllCall($l_FTPSession[1], 'int', 'InternetFindNextFile', 'long',$l_FTPSession[5], 'ptr', DllStructGetPtr($l_FTPSession[4]))
    If @error OR $ai_FTPPutFile[0] = 0 Then
    SetError(-1)
    Return $a_FTPFileList
    EndIf

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

    Dim $a_FTPFileList[12]
    $a_FTPFileList[0] = 12
    $a_FTPFileList[1] = DllStructGetData($l_FTPSession[4], 1) ; File Attributes
    $a_FTPFileList[2] = DllStructGetData($l_FTPSession[4], 2, 1) ; Creation Time Low
    $a_FTPFileList[3] = DllStructGetData($l_FTPSession[4], 2, 2) ; Creation Time High
    $a_FTPFileList[4] = DllStructGetData($l_FTPSession[4], 3, 1) ; Access Time Low
    $a_FTPFileList[5] = DllStructGetData($l_FTPSession[4], 3, 2) ; Access Time High
    $a_FTPFileList[6] = DllStructGetData($l_FTPSession[4], 4, 1) ; Last Write Low
    $a_FTPFileList[7] = DllStructGetData($l_FTPSession[4], 4, 2) ; Last Write High
    $a_FTPFileList[8] = DllStructGetData($l_FTPSession[4], 5) ; File Size High
    $a_FTPFileList[9] = DllStructGetData($l_FTPSession[4], 6) ; File Size Low
    $a_FTPFileList[10] = DllStructGetData($l_FTPSession[4], 9) ; File Name
    $a_FTPFileList[11] = DllStructGetData($l_FTPSession[4], 10) ; Altername

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

    Return $a_FTPFileList

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

    EndFunc;==> _FTPFileFindNext()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPFileFindClose()
    ; Description: Delete FindFile Structure.
    ; Parameter(s): $l_FTPSession - Array from _FTPOpen()
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Dick Bronsdijk
    ;
    ;===============================================================================

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

    Func _FTPFileFindClose($l_FTPSession)

    Local $ai_FTPPutFile = DllCall($l_FTPSession[1], 'int', 'InternetCloseHandle', 'long', $l_FTPSession[5])
    If @error OR $ai_FTPPutFile[0] = 0 Then
    SetError(-1)
    Return ""
    EndIf

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

    Return $ai_FTPPutFile[0]

    EndFunc;==> _FTPFileFindClose()

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

    ;===============================================================================
    ;
    ; Function Name: _FTPClose()
    ; Description: Closes the _FTPOpen session.
    ; Parameter(s): $l_InternetSession - Array from _FTPOpen()
    ; Requirement(s): wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Wouter van Kesteren
    ;
    ;===============================================================================

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

    Func _FTPClose($l_InternetSession)

    Local $ai_InternetCloseHandle = DllCall($l_InternetSession[1], 'int', 'InternetCloseHandle', 'long', $l_InternetSession[2])
    DLLClose($l_InternetSession[1])
    If @error OR $ai_InternetCloseHandle[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf


    Return $ai_InternetCloseHandle[0]

    EndFunc ;==> _FTPClose()

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • nix
    ich habe das so eingefügt

    [autoit]

    _FTPConnect($Hand, $server, $username, $pass)
    msgbox(0,'',@error)

    [/autoit]


    aber der sagt nix

  • die geht aber schon auf oder steht halt bloß nix drin ?

    [autoit]

    _FtpPutFile($Hand, 'C:\test.exe', $Folder & "Test.exe") ;Upload to top level directory with different file name
    if @error then msgbox(0,"Error","PutFile 2")

    [/autoit]


    und da

  • Ich versuche gerade mit der Funktion _FTPFileFindFirst klar zu kommen; ich scheitere aber an den Parametern!!! Kann mir jemand einen Tip geben, was die Funktion wirklich braucht, mit der Beschreibung in der FTP.au3 komme ich nicht wirklich klar.

    ERROR: _FTPFileFindFirst() called with wrong number of args.

    so siehts in der FTP.au3 aus:

    Func _FTPFileFindFirst($l_FTPSession, $s_RemotePath, ByRef $h_Handle, ByRef $l_DllStruct, $l_Flags = 0, $l_Context = 0)

    $l_FTPSession = Variable aus dem _FTPConnect
    $s_RemotePath = hier nehme ich zum Test einfach _FTPGetCurrentDir()
    ByRef $h_Handle = ?
    ByRef $l_DllStruct = ?
    $l_Flags = 0 = lass ich weg
    $l_Context = 0 = lass ich weg

    und mit FileFindNext wirds wahrscheinlich ähnlich :cursing: hat vielleicht jemand ein kleines Beispielscipt für mich FTP-Noob?

    THX schon mal .......


    P.S. gelöst --->>>>> dieser Thread gibt Aufklärung