Jump to content

FTP.au3


w0uter
 Share

Recommended Posts

FTP Extended (ProgAndy) : FTP_Ex.au3

Functions :

CODE

_FTPOpen

_FTPConnect

_FTPPutFile

_FTPDelFile

_FTPRenameFile

_FTPMakeDir

_FTPDelDir

_FTPClose

_FTPGetCurrentDir

_FtpSetCurrentDir

_FTPGetFile

_FTPGetFileSize

_FTPFilesListTo2DArray

_FTPFilesListToArray

_FTPFilesListToArrayEx

__FileListToArrayEx_HasAttribute

_FTPCommand

_FTPPutFolderContents

_FTP_UploadProgress

_FTP_DownloadProgress

_FTPOpenFile

_FTPReadFile

_FTPCloseFile

_FTPFileFindFirst

_FTPFileFindNext

_FTPFileTimeLoHiToStr

_FTPFileSizeLoHi

_FTPFileFindClose

Cheers, FireFox

Edited by FireFox
Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 283
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hey w0uter is this source open to change? Can we change it maybe add an enhanced GUI or something like that

There is general conclusion here: Everything what is posted publicly on this forum is free for any use/modifications

but you should credit original author.

Edited by Zedna
Link to comment
Share on other sites

  • 4 weeks later...

If @error OR $ai_InternetOpen[0] = 0 Then

SetError(-1)

Return 0

EndIf

sets the @error macro to -1 at failure, so to check if a function has failed do something like this:

_FtpOpen()

If @error <> -1 then

msgbox(0, '', 'failed')

exit

endIf

msgbox(0, '', 'sucess')

Hey guys,

This may be a more basic question than belongs here, but....

I'm trying to use ftp.au3 for the first time, but the script fails to connect. I have the following code in place:

#include <FTP.au3>

$server = 'servername'
$username = 'username'
$pass = 'password'

$Open = _FTPOpen('MyFTP Control')
If @error Then
    MsgBox(262160, "ERROR", "Unable to open")
EndIf

$Conn = _FTPConnect($Open, $server, $username, $pass)
If @error Then
    MsgBox(262160, "ERROR", "Could not connect")
EndIf

Does the actual DLLcall return an error description that I can access? The @error only returns -1, which isn't very helpful in determining why it won't connect :) I've tried a couple of FTP servers, and nothing is working.

Link to comment
Share on other sites

Hey guys,

This may be a more basic question than belongs here, but....

I'm trying to use ftp.au3 for the first time, but the script fails to connect. I have the following code in place:

#include <FTP.au3>

$server = 'servername'
$username = 'username'
$pass = 'password'

$Open = _FTPOpen('MyFTP Control')
If @error Then
    MsgBox(262160, "ERROR", "Unable to open")
EndIf

$Conn = _FTPConnect($Open, $server, $username, $pass)
If @error Then
    MsgBox(262160, "ERROR", "Could not connect")
EndIf

Does the actual DLLcall return an error description that I can access? The @error only returns -1, which isn't very helpful in determining why it won't connect :) I've tried a couple of FTP servers, and nothing is working.

Look at DllOpen('wininet.dll') - it's described in many posts.

Or use latest FTP_Ex where is this problem solved inside UDF.

Link to comment
Share on other sites

Look at DllOpen('wininet.dll') - it's described in many posts.

Got it working, muchos gracias :)

Or use latest FTP_Ex where is this problem solved inside UDF.

I actually tried using this one, as it has more functions than the original. However, the file contains the following include statement:

#include <StructureConstants.au3>

This file is not anywhere on my hard drive, so Autoit complains about not being able to find it. What is this file and where do I get it?

EDIT: n/m, I see that my copy of AutoIt is out of date!

Edited by WorknMan
Link to comment
Share on other sites

  • 2 weeks later...

I am using "FTP_Ex.au3".

The function "_FTP_UploadProgress" adds random characters to the

end of uploaded files less than or equal to 7499 bytes. This happens weather I

use an internal or external progress bar function.

The function "_FtpPutFile" does not have this problem.

Can anyone confirm/test this?

It could be my PC. and not the function.

Thanks

I've been on the net so long, I remember when I could only e-mail myself!

Link to comment
Share on other sites

FTP Extended (ProgAndy) : FTP_Ex.au3

Functions :

CODE

_FTPOpen

_FTPConnect

_FTPPutFile

_FTPDelFile

_FTPRenameFile

_FTPMakeDir

_FTPDelDir

_FTPClose

_FTPGetCurrentDir

_FtpSetCurrentDir

_FTPGetFile

_FTPGetFileSize

_FTPFilesListTo2DArray

_FTPFilesListToArray

_FTPFilesListToArrayEx

__FileListToArrayEx_HasAttribute

_FTPCommand

_FTPPutFolderContents

_FTP_UploadProgress

_FTP_DownloadProgress

_FTPOpenFile

_FTPReadFile

_FTPCloseFile

_FTPFileFindFirst

_FTPFileFindNext

_FTPFileTimeLoHiToStr

_FTPFileSizeLoHi

_FTPFileFindClose

Cheers, FireFox
Hey this UDF is great! Ive been trying to figure out how to make a upload progress for a while now. Good Job. My one suggestion for you is to add

DllCall($GLOBAL_FTP_WININETHANDLE, "int", "InternetCloseHandle", "long", $callFindFirst[0])

to both _FTPFilesListToArray and _FTPFilesListToArrayEx before the Return. Both of these function will only work once as of right now. If you try to change directorys and then call ethier function again, the array is returned empty.

Link to comment
Share on other sites

OK, found the error in the progress-functions. The Size of the buffer was not calculated correctly.

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Hi,

I uploaded 'FTP_Ex.au3' on 2/24/2009.

On 'syntaxcheck', I recieved the following error:

=================================

C:\process control\FTP_Ex.au3(647,31) : ERROR: StringRight() [built-in] called with wrong number of args.

If StringRight($s_LocalFolder)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\process control\FTP_Ex.au3 - 1 error(s), 0 warning(s)

=================================

I Changed:

If StringRight($s_LocalFolder) == "\" Then $s_LocalFolder = StringTrimRight($s_LocalFolder,1)

To:

If StringRight($s_LocalFolder, 1) == "\" Then $s_LocalFolder = StringTrimRight($s_LocalFolder, 1)

Seems to work.

Also, for my own personal programming convenance,

Added the following after Global variables, for ease of use:

$h_Handle = '' ;******** Added by atwolf359

$l_DllStruct = '' ;******** Added by atwolf359

Thanks for a geat utility!

I've been on the net so long, I remember when I could only e-mail myself!

Link to comment
Share on other sites

Oh, right, i should change it...

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

  • 3 weeks later...

Lets start off with things that I admit are true.

I am a new here.

I am new to scripting.

I have searched for my solution using the built in search and google.

I have tried thinking outside the box

I know it's and easy solution to a simple "new guy" mistake

If I knew what I did not know it would be easy to search and find the answer.

_FTPput('ftp.site.com', 'c:\temp 2\03102009.Log', 'user', 'password','test', '0','')

Does not work, as in does not up load the file

_FTPput('ftp.site.com', 'c:\temp2\03102009.Log', 'user', 'password','test', '0','')

Remove the 'space' in the temp2 title and it works

_FTPput('ftp.site.com', 'c:\temp2\*.Log', 'user', 'password','test', '0','')

Can't get wild card to work either

I tried adding extra ' to escape the * and the space in the file name.

I tried adding " to escape the * and the space in the file name.

Yes please teach me to fish so I don't have to beg for help in the forums.

But, right now, I can't even find the ocean to fish so any / all help is welcome!

Thanks in advance.

Link to comment
Share on other sites

  • 3 weeks later...

I have coded an ftp script which will download all the files from a specified remote directory.

But i'm supposed to write a script which will download all the modified files.

here the problem is i cannot get the last accessed time can anybody help me on this???

in the script,

_ArrayDisplay($temp) sholuld display all the attributes of the file.but some of them are nothing but zero .

i have attached the script files.

pls do help me.!!!

thank you.

edit:

NVM i work around it in some other way..thnk u for the help.

FTP_Final.au3

FTP_Ex.au3

Edited by obscurant1st
Link to comment
Share on other sites

  • 3 weeks later...

Ok I am really new at this, how do I add your FTP upload commands to AutoIt on my computer? When I click on the download attached file link it opens up a new window with the text of the commands but doesn't tell me how to add them. Can anyone please tell me how?

Thanks ^_^

Link to comment
Share on other sites

  • 2 weeks later...

Hi The4thMonkey,

_FTPput('ftp.site.com', 'c:\temp 2\03102009.Log', 'user', 'password','test', '0','')

Does not work, as in does not up load the file

The first parameter is not the server name, but rather the connection that you previously open. Take a look at the FTP example the original author posted (on the first post). Hope that helps.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...