Sign in to follow this  
Followers 0
joepaulp

Simple Ftp Question.

5 posts in this topic

Hi everyone!

Thanks for all the postings which is a lot of great information. This is my first post and I am learning the new world of AutoIt. So pardon my ignorance. I tried to read through the help file and through the forum to get an idea of how to do this.

What I need is to open an FTP server and download some files. I am in the process of trying to Automate it using AutoIt.

I have copied the contents of the FTP.au3 file from the first page

http://www.autoitscript.com/forum/index.php?showtopic=12473 (which is provided by w0uter (thanks w0uter, for the this wonderful code)

created a new .au3 file and saved it in the D:\Joe\Utilities\AutoIt3\Include directory with the name FTP.au3.

(I am thinking this is the way to save user defined function you can get from this forum)

CODE
#Include <FTP.au3>

$dllhandle = DllOpen('C:\WINDOWS\system32\wininet.dll')

; There is a wininet.dll file in my windows\system32 directory so I am thinking I should use this code than the

; $dllhandle = DllOpen('wininet.dll') ; I am wondering if I just call this way how will it find the wininet.dll without knowing where it is located

$Open = _FTPOpen('MyFTP')

; I don't know what is "MyFTP" here is. There is nothing in my computer called MyFTP I am just calling it this way because that is what is in the

; example I saw here in this forum should I change it to something specific.?

If @error <> -1 then

msgbox(0, '', 'open failed')

exit

endIf

msgbox(0, '', 'success')

;DllClose($dllhandle)

I am always getting the message "open failed". I can go to MSDOS and type in FTP and it will connect to the FTP server and all. So I really don't know what I am doing wrong here. Will someone be kind enough to give some insights into this.? Please. I really appreciate your time and help on this.

Thanks a lot

Share this post


Link to post
Share on other sites



I wonder if you had a look inside Ftp.au3 file ...

This is the structure of _FtpOpen function:

Func _FTPOpen($s_Agent, $l_AccessType = 1, $s_ProxyName = '', $s_ProxyBypass = '', $l_Flags = 0)
    
    Local $ai_InternetOpen = DllCall('wininet.dll', '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
        
    Return $ai_InternetOpen[0]
    
EndFunc ;==> _FTPOpen()oÝ÷ ØZè«{*.q©ìyëaj׫®â²Ç­¶péŶ©zwÚ[,¢'Ŷ©z|(®K

will fire that messagebox whenever @error is NOT -1 .... rings a bell?

I'll leave the pleasure of discovery how to make your code work ... to you :)


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Thanks Enaiman. That worked. How stupid of me. Thanks for your time and help.

Thanks

Share this post


Link to post
Share on other sites

But now it's possible to upload file to ftp well? Some mounth ago i had try various script but at the end I've find a tool " dropupload.exe" that work well, with autoit I wasn't able to upload file.

Share this post


Link to post
Share on other sites

There is a _FTPPutFile() function in FTP.au3

muttley


Broken link? PM me and I'll send you the file!

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  
Followers 0