Jump to content
Sign in to follow this  
w0uter

FTP.au3

Recommended Posts

houseonfire

#include <GUIConstants.au3>
#Include <file.au3>
#include <Word.au3> 
#include <Array.au3>
#include <ftp.au3>

I am using the most recent one. I did not change the version of the FTP, i changed my Autoit version.

I thought maybe the file got some how encrypted, or compressed.

It didn't.

I need some one on one chat with someone who knows a lot about autoit..

Please, someone PM me and ask for my hotmail/AIM / Gmail, or something

Edited by houseonfire

Share this post


Link to post
Share on other sites
Zepx

Is there a function that could overwrite existing upload file?

Edit: Overwrite function works automatically OnPut. No necessary function required =/.

Edited by Zepx

Share this post


Link to post
Share on other sites
ficofico

Hi guys, I'm trying to use this script, but I'm not good...

I'm searching a way to mirroring an ftp folder with a folder in desktop pc. Only the changed or newer files have to be downloaded in the pc folder.... it's possible with this script? I've downloaded ftp.au3 and ftp example from originale source link, but I'm not able to use it, It's simple ? thanks

Share this post


Link to post
Share on other sites
Ontosy

do it is possibile to use a secure ftp: ftps?

Share this post


Link to post
Share on other sites
sensalim

Hi,

I have the FTPOpen() to return an identifier, but I can't get the _FTPConnect() to work.

My ftp is (username).freehostia.com

(of course the (username) is something else I'm not telling).

Password and username are correct, I could connect using ftp (start > run > cmd > ftp)

So maybe freehostia doesn't work with your ftp.au3? Any alternative website?

Thanks!

Edit1:

Zedna told me to open DLL first:

$dllhandle = DLLOpen('wininet.dll')

$Open = _FTPOpen(...)

...

DLLClose($dllhandle)

I'll try that. Thanks!

Edited by sensalim

Share this post


Link to post
Share on other sites
Iuli

Hi,

I have the FTPOpen() to return an identifier, but I can't get the _FTPConnect() to work.

My ftp is (username).freehostia.com

(of course the (username) is something else I'm not telling).

Password and username are correct, I could connect using ftp (start > run > cmd > ftp)

So maybe freehostia doesn't work with your ftp.au3? Any alternative website?

Thanks!

Edit1:

Zedna told me to open DLL first:

$dllhandle = DLLOpen('wininet.dll')

$Open = _FTPOpen(...)

...

DLLClose($dllhandle)

I'll try that. Thanks!

The same here. _FTPPutFile returns 0.


[size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent]

Share this post


Link to post
Share on other sites
gertsolo

I probably overlooked it, but isn't there a ftpGet function?


The more you learn, the less you know.

Share this post


Link to post
Share on other sites
MetalSpongebob

I got these error using the base-script of Zedna

C:\Programs\AutoIt3\Include\ftp.au3(90,91) : ERROR: _FtpPutFile() called by a previous line with 2 arg(s). Min = 3. First previous line calling this Func is 8.
Func _FTPPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\ftpScript.au3(20,41) : ERROR: _FtpPutFile() called with wrong number of args.
$Ftpp = _FtpPutFile($Conn, 'c:\file.txt')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Programs\AutoIt3\Include\ftp.au3(90,91) : REF: definition of _FtpPutFile().
Func _FTPPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\ftpScript.au3 - 2 error(s), 0 warning(s)

Noob but ethical

Share this post


Link to post
Share on other sites
SmOke_N

I got these error using the base-script of Zedna

C:\Programs\AutoIt3\Include\ftp.au3(90,91) : ERROR: _FtpPutFile() called by a previous line with 2 arg(s). Min = 3. First previous line calling this Func is 8.
Func _FTPPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\ftpScript.au3(20,41) : ERROR: _FtpPutFile() called with wrong number of args.
$Ftpp = _FtpPutFile($Conn, 'c:\file.txt')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Programs\AutoIt3\Include\ftp.au3(90,91) : REF: definition of _FtpPutFile().
Func _FTPPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\ftpScript.au3 - 2 error(s), 0 warning(s)
It's telling you what the erros are... You're trying to call the functions without parameters. You need to fix that on your end.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
PeterJcript

Do anyone use Func _FTPGetFolderContents($s_Server, $s_UserName, $s_Password, $s_RemoteDir, $s_LocalDir, ByRef $i_Count) Authored by Walkabout (2006-10-18)?

An error always occurs when I get a large folder from FTP server, specially larger than 300MB . The problem I check is that the Func _FTPConnect($$) can not work well , Is there anything I can do ? Any feedback will be really appreciated.

Share this post


Link to post
Share on other sites
Mattraks

Do i put it in the includes folder and just include it in my script? Also, i tried it and nothing happened. I looked in the folders and couldnt find Exaple.exe

Share this post


Link to post
Share on other sites
Zedna

I'm using this script, and the _FTPConnect() function always returns 0. _FTPOpen return 13369348 so the problem is with the _FTPConnect() function.

Look here

I recommend you to read all posts in this FTP UDF topic

Edited by Zedna

Share this post


Link to post
Share on other sites
CyRius

#include <FTP.au3>

$server = 'XX.XX.XXX.XX'
$username = '*******'
$pass = '**********'

$dllhandle = DllOpen('wininet.dll')

$Open = _FTPOpen('FTP-CyRius')
$Conn = _FTPConnect($Open, $server, $username, $pass)
MsgBox(0,"",$Conn)

$Ftpp = _FtpPutFile($Conn,'file.ini')
If @error Then
    MsgBox(0, "Error", @error)
EndIf

$Ftpc = _FTPClose($Open)
DllClose($dllhandle)

_FTPOpen() returns 13369348 and _FTPConnect() returns 0. Host, username, password are correct. What's the problem?

I didn't find any resolvation about this bugs:-?? I already read 200 posts. I have Windows XP SP2.

Edited by CyRius

[font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list]

Share this post


Link to post
Share on other sites
webjocky

I've spent hours on this trying to get it to work, but when I run my compiled script - absolutely nothing happens.

Yes, I've read every single post in this thread.

I hope someone can point out an obvious ID-10-T error of some sort.

Here's my function:

#include <FTP.au3>
#include <File.au3>

Global $server = "mydomain.com"
Global $username = "myusername"
Global $pass = "mypassword"

Update()

Func Update()

    $BackupReporterExists = FileExists("BackupReporter.exe")
    $ConfigExists = FileExists("config.exe")
    $UpdateExists = FileExists("update.exe")
    $VersionLogsExists = FileExists("currentversion.log")

    If $BackupReporterExists Then
;;;;;;;;;;;; I even tried to debug using this msgbox to ensure the script was making it into this If-Then statement... it does! ;;;;;;;;;;;;;;;;;;;
                MsgBox(0, "Hey!", "Backup Reporter Exists")
;;;;;;;;;;;; I included some error handling in the first upload attempt so at least I should get a msgbox if something goes wrong, but nothing ever pops up ;;;;;;;;;;;;;;;;;;;;
        $Open = _FTPOpen ('FTP')
        If @error Then
            MsgBox(0, "", "fail_open")
            Exit
        EndIf
        $Conn = _FTPConnect ($Open, $server, $username, $pass)
        If @error Then
            MsgBox(0, "", "fail_Conn")
            Exit
        EndIf
        $Ftpp = _FtpPutFile ($Conn, 'BackupReporter.exe', 'BackupReporter.exe')
        If @error Then
            MsgBox(0, "", "fail_PutFile")
            Exit
        EndIf
        $Ftpc = _FTPClose ($Open)
        If @error Then
            MsgBox(0, "", "fail_close")
            Exit
        EndIf
    Else
        MsgBox(0, "Error", "BackupReporter.exe not found")
    EndIf

    If $ConfigExists Then
        $Open = _FTPOpen ('FTP')
        $Conn = _FTPConnect ($Open, $server, $username, $pass)
        $Ftpp = _FtpPutFile ($Conn, 'config.exe', 'config.exe')
        $Ftpc = _FTPClose ($Open)
    Else
        MsgBox(0, "Error", "config.exe not found")
    EndIf

    If $UpdateExists Then
        MsgBox(0, "File Exists", "Updater")
        $Open = _FTPOpen ('FTP')
        $Conn = _FTPConnect ($Open, $server, $username, $pass)
        $Ftpp = _FtpPutFile ($Conn, 'update.exe', 'update.exe')
        $Ftpc = _FTPClose ($Open)
    Else
        MsgBox(0, "Error", "update.exe not found")
    EndIf

    If $VersionLogsExists Then
        MsgBox(0, "File Exists", "Version Log")
        $Open = _FTPOpen ('FTP')
        $Conn = _FTPConnect ($Open, $server, $username, $pass)
        $Ftpp = _FtpPutFile ($Conn, 'currentversion.log', 'currentversion.log')
        $Ftpc = _FTPClose ($Open)
    Else
        MsgBox(0, "Error", "currentversion.log not found")
    EndIf
EndFunc   ;==>Update

ANY help would be greatly appreciated.

Edit: It just occurred to me that the path to the files to be uploaded might HAVE to be a full path, even though the files themselves are in the same directory as the script... I'm going to test and return with results.

Edit.2: File path had nothing to do with it. You have to call the dll manually before the script can take advantage of it. DOH! I got my answer from the post above, quoted below:

Look here

I recommend you to read all posts in this FTP UDF topic

Zedna rocks. Edited by webjocky

The tiniest of things can ruin your day, or brighten your afternoon. Read it once, read it again, and pay attention. Then search the forums. If all else fails, ask somebody else.

Share this post


Link to post
Share on other sites
therms

I'm a little clueless on how to use _FtpCommand to chmod a file.

I can get the file uploaded just fine, but changing it's attributes once there is beyond my reach.

Any suggestions?

$dllhandle = DllOpen('wininet.dll')

Dim Const $FtpUser="xxx"
Dim Const $FtpPass="xxx"
Dim Const $FtpServer="xxx"
Dim Const $file1='test.txt'
Dim Const $file2='test.txt'


$Open= _FTPOpen('ftpcontrol')
$Conn = _FTPConnect($Open, $FtpServer, $FtpUser, $FtpPass)
PutIt($file1, $file2)
$ftpc = _FTPClose($Open)

DllClose($dllhandle)


Func PutIt($filesrc, $filedst)
    $Ftpp = _FtpPutFile($Conn, $filesrc, $filedst)
    $Ftpcmd = _FtpCommand('ftpcontrol', 'chmod +x' & $filedst)
EndFunc

Share this post


Link to post
Share on other sites
rudolph

Hi all:

I am using UDF FTP.au3, to upload a text file from windows Xp sp2 to unix ftp server,

the scrip is running well but I found a BIG PROBLEM, maybe a BUG in FTP.au3 when the file

test.txt is uploaded, the file was changed and added a carriage return(CR) and a line feed (LF) for ,

for each line . Someone can tell me what is wrong with my script or is a FTP.au3 BUG?

Please I need a HELP on this ?

CR=carriage return LF=Line feed

For example , original file test.txt looks like this:

aaaaaaaaaaaaabbbbbbbbb123456CR

bbbbbbbbbbbbbbbbbbbbbbbbbbbbCR

ddddddddddddddddddddddddddddCR

The new uploaded file test.txt looks like this (Inserted CR and

LF for each line):

aaaaaaaaaaaaabbbbbbbbbccccccCR

CR

LFbbbbbbbbbbbbbbbbbbbbbbbbbbbbCR

CR

LFddddddddddddddddddddddddddddCR

CODE
Opt ("ExpandEnvStrings", 0)

Opt ("ExpandVarStrings", 1)

Opt ("MustDeclareVars", 1)

;;#include <GUIConstants.au3>

#include <FTP.au3>

Dim $server = "ftp.test.com"

Dim $username = "usr"

Dim $pass = "passw"

Dim $port = 21

Dim $dllhandle = DllOpen('wininet.dll')

Dim $Open = _FTPOpen('MyFTP')

if @error Then

MsgBox(0, "", "fail_open")

Exit

EndIf

Dim $Conn = _FTPConnect($Open, $server, $username, $pass, $port)

If @error Then

MsgBox(0, "", "fail_Connect")

Exit

EndIf

Dim $Ftpp = _FtpPutFile($Conn, 'C:\TEMP\test.txt', '/test.txt')

If @error Then

MsgBox(0, "", "fail_PutFile")

Exit

EndIf

Dim $Ftpc = _FTPClose($Open)

If @error Then

MsgBox(0, "", "fail_Close")

Exit

EndIf

DllClose($dllhandle)

MsgBox(0,"FTP PUT File - Status ", ""$Ftpc = " & $Ftpc" & "$Open = " & $Open & @CRLF & "$Conn = " & $Conn & @CRLF & "$Ftpp = " & $Ftpp & @CRLF & "$Ftpc = " & $Ftpc )

Exit

Share this post


Link to post
Share on other sites
isno

hello,

sory for my english ( I'am french )

I have a problem with the fonction _FTPGetFoldercontents

it get correctly the files and folders in level 1

but not the files and folders in level 2 ,3 ....

can you help me?

Share this post


Link to post
Share on other sites
djpyne

Hi all this is my first post in here so I hope I am doing this correctly.

I needed a way to pull a file from an ftps server so I added a function to the ftp.au3 file _FTPGetFile I just reversed some of the _FTPPutFile. Function I added to FTP.au3 is below.

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

    Local $ai_FTPGetFile = DllCall('wininet.dll', 'int', 'FtpGetFile', 'long', $l_FTPSession, 'str', $s_RemoteFile, 'str', $s_LocalFile, 'long', $l_Flags, 'long', $l_Context)
    If @error OR $ai_FTPGetFile[0] = 0 Then
        SetError(-1)
        Return 0
    EndIf
    
    Return $ai_FTPGetFile[0]
    
EndFunc;==> _FTPPutFile()

Then I do this call in my script that I run:

$Ftpp = _FtpGetFile($Conn, "/version.txt", "C:\version.txt")

When I run this in version 3.2.10.0 it crashes when it runs the above function. If I run it in v3.1.1.0 it works great. Anybody know why or show mw what I am doing wrong? Thanks.

Share this post


Link to post
Share on other sites
djpyne

Nevermind I found an ftp_v3.au3 and this seems to have fixed the issue.

Share this post


Link to post
Share on other sites
martin

hello,

sory for my english ( I'am french )

I have a problem with the fonction _FTPGetFoldercontents

it get correctly the files and folders in level 1

but not the files and folders in level 2 ,3 ....

can you help me?

I'm not familiar with that function, but if _FTPGetFoldercontents is using 'FtpFindFirstFile' and 'InternetFindNextFile' then data is loaded into a $WIN32_FIND_DATA structure. The first element of that structure will be 16 if the name is a folder. You would then need to list the files in that folder as well.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.