Jump to content

FTP.au3


w0uter
 Share

Recommended Posts

Hello!

uhm, does it works with 3.2.4.0 rc1? i think not, cause i cant conect to servers.

e.g. this doesnt work:

#include <GuiConstants.au3>
#include "..\Include\OFTP.au3"

Dim $Handle, $DllRect

$server = 'ftp.mozilla.org'
$username = 'anonymous'
$pass = 'anonymous'

$dllhandle = DllOpen('wininet.dll')
$Open = _FTPOpen('MyFTP Control',0)
If @error Then Failed("Open")
$Conn = _FTPConnect($Open, $server, $username, $pass, 1)
If @error Then Failed("Connect")

$Ftpp = _FtpGetFile($Conn, "/pub/mozilla.org/firefox/releases/2.0.0.3/win32/en-US/Firefox Setup 2.0.0.3.exe", @ScriptDir&"\FirefoxSetup2003.exe", $INTERNET_FLAG_PASSIVE, 0)
If $Ftpp = 0 Then Failed("Could not get")
$Ftpc = _FTPClose($Open)

_FTPClose ($Open)
DllClose($dllhandle)

Func Failed($error)
    MsgBox(48, 'Error', $error)
    Exit
EndFunc

does anybody know why?

@w0uter: sry, but i must it say again: very nice UDF ;-)

Mfg / best Regards Spider

www.AutoIt.de - Moderator of the German AutoIt Forum

 

Link to comment
Share on other sites

  • Replies 283
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 5 weeks later...

<snip>

$dllhandle = DllOpen('wininet.dll')

$Open = _FTPOpen('MyFTP Control',0)

</snip>

Would some kind soul please explain to this dumb newbie what goes in place of 'MyFTP Control' in the above code? Is this an IP address or what?

I'd really appreciate the help. --- dWade

Link to comment
Share on other sites

Would some kind soul please explain to this dumb newbie what goes in place of 'MyFTP Control' in the above code? Is this an IP address or what?

I'd really appreciate the help. --- dWade

It's probably FTP session name. You can place there whatever text which will be unique among another FTP sessions (probably in your script) if any other exists.

I'm not 100% sure about this but it will be very close to right statement.

Link to comment
Share on other sites

It's probably FTP session name. You can place there whatever text which will be unique among another FTP sessions (probably in your script) if any other exists.

I'm not 100% sure about this but it will be very close to right statement.

Thanks Zedna; I'm still confused, but then that seems to be a perpetual state with me. I do appreciate your helpful response. --- dWade.

Link to comment
Share on other sites

  • 3 weeks later...

Hi people,

can anyone help please. This is my first attempt at using FTP.au3 and I just can't get it to go.

Using the sample code as a starting point I have tried substituting my info without success.

I normally use Filezilla for FTP which works fine - see attached image of site settings it is using.

Have tried using port 0 and 21 and assorted guesses as to what some of the other parameters might be.

I get a value back from _FTPOpen but then the connect fails,

I am hoping this is something silly I have done / not done.

Please see attached code.

Bob

Posted Image

CODE
; first attempt 17/07/2007

Opt ("ExpandEnvStrings", 0)

Opt ("ExpandVarStrings", 1)

Opt ("MustDeclareVars", 1)

#include <GUIConstants.au3>

#include <FTP.au3>

; -----------------------------------------------------

Dim $server = 'upload.ntlworld.com'

Dim $username = 'robert.frew'

Dim $pass = 'mypasswd' ; not the real one

Dim $port = 21;

Dim $Open = _FTPOpen('MyFTP')

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

; $Ftpp = _FtpPutFile($Conn, 'C:\WINDOWS\Notepad.exe', '/somedir/Example.exe')

Dim $Ftpp = _FtpPutFile($Conn, 'C:\xmltv\web\listings.htm', '/tvguide.htm')

Dim $Ftpc = _FTPClose($Open)

MsgBox(0,"Trial FTP of HTM File", "$Open = " & $Open & @CRLF & "$Conn = " & $Conn & @CRLF & "$Ftpp = "

& $Ftpp & @CRLF & "$Ftpc = " & $Ftpc)

Exit

AutoIt is great - leave me alone and I'll play for hours

Link to comment
Share on other sites

Hi people,

can anyone help please. This is my first attempt at using FTP.au3 and I just can't get it to go.

Using the sample code as a starting point I have tried substituting my info without success.

I normally use Filezilla for FTP which works fine - see attached image of site settings it is using.

Have tried using port 0 and 21 and assorted guesses as to what some of the other parameters might be.

I get a value back from _FTPOpen but then the connect fails,

I am hoping this is something silly I have done / not done.

Please see attached code.

Bob

It was said before:

There was internal change in Autoit's DllCall() so you must use some workaround, for example this one with explicit DllOpen/DllClose:

...
$dllhandle = DllOpen('wininet.dll')
$Open = _FTPOpen ('MyFTP Control')
...
_FTPClose ($Open)
DllClose($dllhandle)
Edited by Zedna
Link to comment
Share on other sites

Greate UDFs!!

It would be even more greate if someone will make function for getting all files in certain dir :whistle: - something like _FtpGetFiles() - and it returns array/string with all files in some folder on Ftp.

Thanks.

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Im trying to use FTP.au3 to _FtpPutFile and cannot seem to get it to work. Is anyone working on fixing wouter's FTP.au3, so everyone who uses FTP will be happy?

#include <Ftp.au3>
Const $FTP_TRANSFER_TYPE_ASCII = 0x01
Const $FTP_TRANSFER_TYPE_BINARY = 0x02
Const $INTERNET_FLAG_NO_CACHE_WRITE = 0x4000000
$ftp_flags = $FTP_TRANSFER_TYPE_BINARY + $INTERNET_FLAG_NO_CACHE_WRITE
$dllhandle = DllOpen('wininet.dll') 
$server = 'ftp.site.com'
$username = 'username'
$pass = 'password'
$Open = _FTPOpen('ftp')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, @ScriptDir & 'testfile.txt', '/somedir/testfile.txt',$ftp_flags)
$Ftpc = _FTPClose($Open)
DllClose($dllhandle)

Thanks in Advance :whistle:

Edited by inov8iv
Link to comment
Share on other sites

It was said before:

There was internal change in Autoit's DllCall() so you must use some workaround, for example this one with explicit DllOpen/DllClose:

...
$dllhandle = DllOpen('wininet.dll')
$Open = _FTPOpen ('MyFTP Control')
...
_FTPClose ($Open)
DllClose($dllhandle)
Hi Zedna

many thanks for that. I have it working now. I have NOW read your relevant post. sorry I missed it on my zoom through the pages.

If including these DllOpen/Close lines can't be included in the _FTPOpen/Close functions then maybe the example.au3 could be amended to include them.

Posted Image

Cheers Bob

AutoIt is great - leave me alone and I'll play for hours

Link to comment
Share on other sites

  • 1 month later...

hey guys!

i did everything u sayd in all pages and i get the following error if i start ftp_progress.au3:

"Line 422 (File "C:/......")

$l_DllStruct = DllstructCreate($str)

$l_DllStruct = ^ ERROR

Error:Unknown function name.

Thank you in advance,

lordlol

Link to comment
Share on other sites

hey guys!

i did everything u sayd in all pages and i get the following error if i start ftp_progress.au3:

"Line 422 (File "C:/......")

$l_DllStruct = DllstructCreate($str)

$l_DllStruct = ^ ERROR

Error:Unknown function name.

Thank you in advance,

lordlol

You are probably using VERY old AutoIt.

Download and instal latest one.

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...