JohnMC Posted August 15, 2008 Share Posted August 15, 2008 (edited) The FTP UDF Sticky thread had been mostly dead and consists of outdated code, i hope this can be useful to someone.(Update) My focus with updates to come for this UDF will be around simplicity, because with the WinINet UDF complex and more reliable functions are possible but are just that: "Complex"Here is a list of available functions:_FTPOpen_FTPConnect_FTPPutFile_FTPPutFolderContents_FTPGetFile_FTPGetFoldercontents (Known to cause errors when ran uncompiled or without admin privs?)_FTPDelFile_FTPRenameFile_FTPMakeDir (Returns 0 / error if directory already exists)_FTPDelDir_FTPGetFileSize_FTPGetCurrentDir_FTPSetCurrentDir_FTPFindFileFirst_FTPFindFileNext_FTPFindFileClose_FTPCloseThe largest differences from this UDF and the Original FTP UDF:-You no longer need to use DLLOpen() - Its called from _FTPOpen-All Functions now use the handle from _FTPOpen, and NOT _FTPConnect.20090110*Added: In _FTPConnect() Setting $l_Flags to 1 will enable Passive Mode*Added: In _FTPGetFile() Setting $l_Flags will change transfer type 1=BIN 2=ASC*Fixed: _FTPGetFileSize()*Fixed: _FTPGetCurrentDir()*Fixed: Code improvements *Documentation: Example file updated20080910 *Fixed: Code improvements *Added: _FTPGetFoldercontents, it doesnt use true recursion but it will download subdirectories and has a switch to specify not to 20080818 *Fixed: Minor code improvements and and removed some depreciated code*Documentation: Added _FTPFileFindClose to the example along with some comments20080816*Changed: _FTPOpen returns an array containing all handles, if a function that uses handles like _FTPFileFindFirst is called, it adds to the array instead of returning the handlehttp://teammc.cc/aut_ftp/ Edited January 11, 2009 by JohnMC https://johnscs.com Link to comment Share on other sites More sharing options...
Zedna Posted August 15, 2008 Share Posted August 15, 2008 Looks nice.You can add also _FTPFileFindFirst, _FTPFileFindNext functions introduced herehttp://www.autoitscript.com/forum/index.ph...6403&hl=FTPAlso add some simple example. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
ChrisJakarta Posted August 16, 2008 Share Posted August 16, 2008 Thanks - I was beginning to think this UDF was dying by degrees. Seems that the variable $handles on line 322 should read $s_handles, no? With that changed (corrected?) this version seem to work fine for me, although only with a subset of the functions. Chris Link to comment Share on other sites More sharing options...
JohnMC Posted August 16, 2008 Author Share Posted August 16, 2008 (edited) Thanks - I was beginning to think this UDF was dying by degrees.Seems that the variable $handles on line 322 should read $s_handles, no?With that changed (corrected?) this version seem to work fine for me, although only with a subset of the functions.Chrisyes your right, i was a bit to excited just to post this i guess, ill update tonight when im done adding these additional functions. Edited August 16, 2008 by JohnMC https://johnscs.com Link to comment Share on other sites More sharing options...
-Ultima- Posted August 16, 2008 Share Posted August 16, 2008 (edited) I don't mean to hijack the thread, but since the topic of "revitalizing" the FTP.au3 UDFs has come up... FWIW, I was hoping we could take the FTP UDFs in a slightly different, more generalized direction by wrapping most of the WinINet functions in AutoIt, of which the FTP functions are actually a subset (so the current functionality for FTP is present, but in addition to functions for HTTP and GOPHER+). It makes for a much more powerful base from which users can build FTP/HTTP-enabled scripts, as it'd have a wider scope and while maintaining a relatively coherent/consistent API across the protocols.You'll find the functions here. Unfortunately, there's been very little feedback in that thread after almost 2 weeks :\ Edited August 16, 2008 by -Ultima- [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ] Link to comment Share on other sites More sharing options...
JohnMC Posted August 16, 2008 Author Share Posted August 16, 2008 I don't mean to hijack the thread, but since the topic of "revitalizing" the FTP.au3 UDFs has come up... FWIW, I was hoping we could take the FTP UDFs in a slightly different, more generalized direction by wrapping most of the WinINet functions in AutoIt, of which the FTP functions are actually a subset (so the current functionality for FTP is present, but in addition to functions for HTTP and GOPHER+). It makes for a much more powerful base from which users can build FTP/HTTP-enabled scripts, as it'd have a wider scope and while maintaining a relatively coherent/consistent API across the protocols.You'll find the functions here. Unfortunately, there's been very little feedback in that thread after almost 2 weeks :\sounds great, but i dont feel i would be able to do that anytime soon, its kinda beyond me, i spent alot of time on msdn looking at those very commands and your right to say they should be wraped, but with ftp logins and everything i would have to really sit down and think... in the meantime i updated the FTP UDF it kinda strays away from the original method of the handles so i hope that its still usefull for whatever people might need, but i feel it really makes the the entire thing alot easier... https://johnscs.com Link to comment Share on other sites More sharing options...
radeonorama Posted August 16, 2008 Share Posted August 16, 2008 Hello! very new to this forum! First post! I really need a function to download the folder contents on an ftp server. I came across a function which apparently does so called _ftpgetfoldercontents but it doesn't seem to work. could anyone point me in the direction of one that does work please? I would be ultimately great full!!! Thanks in advance!!! Link to comment Share on other sites More sharing options...
Developers Jos Posted August 16, 2008 Developers Share Posted August 16, 2008 Hello! very new to this forum! First post! I really need a function to download the folder contents on an ftp server. I came across a function which apparently does so called _ftpgetfoldercontents but it doesn't seem to work. could anyone point me in the direction of one that does work please?I would be ultimately great full!!!Thanks in advance!!!This is not the right place for your question.Create a new thread in the supportforum with your issue and post the code you use.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
JohnMC Posted August 16, 2008 Author Share Posted August 16, 2008 Hello! very new to this forum! First post! I really need a function to download the folder contents on an ftp server. I came across a function which apparently does so called _ftpgetfoldercontents but it doesn't seem to work. could anyone point me in the direction of one that does work please?I would be ultimately great full!!!Thanks in advance!!!post a link to the code you found, ill review it and see if it would be a good addition to this UDF https://johnscs.com Link to comment Share on other sites More sharing options...
ChrisJakarta Posted August 17, 2008 Share Posted August 17, 2008 Seems like you made the changes in a rush again I think the parameter in Func _FTPFileFindClose($h_Handle) (line 464) should be $l_FTPSession, no? With that change, my code compiles OK. I think you've also got a couple of other references to $h_Handle in the comments (see lines 369 and 456) which probably need to change. Chris Link to comment Share on other sites More sharing options...
ChrisJakarta Posted August 17, 2008 Share Posted August 17, 2008 (edited) Earlier posted an apparent problem. Turns out the problem was with my code - sorry. However, I think the parameter problem remains Chris Edited August 17, 2008 by ChrisJakarta Link to comment Share on other sites More sharing options...
BrettF Posted August 17, 2008 Share Posted August 17, 2008 Nice job! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
radeonorama Posted August 17, 2008 Share Posted August 17, 2008 post a link to the code you found, ill review it and see if it would be a good addition to this UDFThanks for the response. Here is the link to the _FTPGetFoldercontents function i found._FTPGetFoldercontents LinkThanks again. Link to comment Share on other sites More sharing options...
JohnMC Posted September 10, 2008 Author Share Posted September 10, 2008 Thanks for the response. Here is the link to the _FTPGetFoldercontents function i found._FTPGetFoldercontents LinkThanks again.Added, see first postI see that the wraper for wininet is on its way... very exciting https://johnscs.com Link to comment Share on other sites More sharing options...
ChrisJakarta Posted September 21, 2008 Share Posted September 21, 2008 I occasionally have problems connecting to the server. Is there any way to add a time-out to the _FTPConnect() function, to stop the program going into never-never land? Grateful for any ideas... Chris Link to comment Share on other sites More sharing options...
-Ultima- Posted September 21, 2008 Share Posted September 21, 2008 (edited) Setting the timeout is possible for WinInet InternetConnect handles by using wininet.dll's InternetSetOption in conjunction with... INTERNET_OPTION_CONNECT_TIMEOUT - for connection requests INTERNET_OPTION_RECEIVE_TIMEOUT - for receiving request responses INTERNET_OPTION_SEND_TIMEOUT - for sending requests and passing a DWORD struct containing the number of milliseconds as the buffer. Edited September 21, 2008 by -Ultima- [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ] Link to comment Share on other sites More sharing options...
ChrisJakarta Posted September 23, 2008 Share Posted September 23, 2008 Setting the timeout is possible for WinInet InternetConnect handles by using wininet.dll's InternetSetOption in conjunction with...INTERNET_OPTION_CONNECT_TIMEOUT - for connection requestsINTERNET_OPTION_RECEIVE_TIMEOUT - for receiving request responsesINTERNET_OPTION_SEND_TIMEOUT - for sending requestsand passing a DWORD struct containing the number of milliseconds as the buffer.Sorry, I tried several times to make this work, but without success. I'd be really grateful for a brief example...ThanksChris Link to comment Share on other sites More sharing options...
JohnMC Posted September 28, 2008 Author Share Posted September 28, 2008 (edited) Sorry, I tried several times to make this work, but without success. I'd be really grateful for a brief example...ThanksChrisive been trying and i havnt got it yet anyone know?i would recomend that if you need this that you should migrate to useing the wininet wrapper udf i havnt tried it but i know that a function to use internetsetoption is included.however i did some googling and i found some people saying that the timeout options have documented bugs, and whatever it was they were using them for it wouldnt have any effect. Edited September 29, 2008 by JohnMC https://johnscs.com Link to comment Share on other sites More sharing options...
FireNET Posted September 29, 2008 Share Posted September 29, 2008 getsize cause autoit error. $server = '128.232.104.10' $username = 'anonymous' $pass = '' $Hand = _FTPOpen('Doesnt Matter') $Ftpc = _FTPConnect($Hand, $server, $username, $pass) if @error then msgbox(0,"Error","Connect Error") Exit EndIf $Ftpg = _FTPGetFileSize($Hand, '/index.htm') $Ftpc = _FTPClose($Hand);Close ftp session get autoit.exe error AppName: autoit3.exe AppVer: 3.2.12.1 ModName: unknown ModVer: 0.0.0.0 Offset: 0000000e Link to comment Share on other sites More sharing options...
GotX Posted September 29, 2008 Share Posted September 29, 2008 (edited) Hey I'm having some trouble with these functions and cant seem to get them to work in my script for some reason. I'm a bit of a noob as u can tell by my my post count, so I might just be doing something stupid. Also I've tried other variations of these functions none seem to work for me. Any help would be great. Here's the code pertaining to the ftp: #include <FTP.au3> ; yes this is the correct one just renamed it... $file = 'C:\folderpath\' & @ComputerName & '_' & @MON & '_' & @MDAY & '.html' ; this already exists $ftpfile = '/Files/' & @ComputerName & '_' & @MON & '_' & @MDAY & '.html' $server = 'ftp.drivehq.com' $username = 'MyUsername' $pass = 'MyPass' $handle = _FTPOpen('myftp') If @error Then MsgBox(0,'FTPOpen Error', @error) EndIf $ftpc = _FTPConnect($handle, $server, $username, $pass) If @error Then MsgBox(0,'FTPConnect Error', @error) EndIf ;the code works up till this point $ftpp = _FtpPutFile($handle, $file, $ftpfile) If @error Then MsgBox(0,'FTPPut Error', @error) ;this is where i get an error message EndIf _FTPClose($handle) Also if it makes any difference im using AutoIt v3.2.12.1 atm Edited September 29, 2008 by GotX Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now