MrCreatoR Posted January 1, 2008 Share Posted January 1, 2008 Hi,Is there a way to get header (if there is one) from FTP? generaly i need to get Last-Modified: property, and Content-Lenght: (wich i can get via InetGetSize() in most cases).If it possible using TCP functiuons, it would ne the best way, but i open to any (except external applications) other solutions Thanks. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 1, 2008 Share Posted January 1, 2008 Hi, Is there a way to get header (if there is one) from FTP? generaly i need to get Last-Modified: property, and Content-Lenght: (wich i can get via InetGetSize() in most cases). If it possible using TCP functiuons, it would ne the best way, but i open to any (except external applications) other solutions Thanks. The FTP command for last modified date/time is MDTM, and the command for size is SIZE. Both are listed in RFC3659 - Extensions to FTP. But these are not available from Microsoft's broken FTP console. The FTP.au3 UDF by w0uter uses wininet.dll calls for FTP, but doesn't have all of them implemented (yet). When you enumerate file using the .dll, there is a process just like AutoIt's FileFindFirstFile/FileFindNextFile, and one of the data structures returned for each file found is WIN32_FIND_DATA: WIN32_FIND_DATA Structure Contains information about the file that is found by the FindFirstFile, FindFirstFileEx, or FindNextFile function. typedef struct _WIN32_FIND_DATA { DWORD dwFileAttributes; FILETIME ftCreationTime; FILETIME ftLastAccessTime; FILETIME ftLastWriteTime; DWORD nFileSizeHigh; DWORD nFileSizeLow; DWORD dwReserved0; DWORD dwReserved1; TCHAR cFileName[MAX_PATH]; TCHAR cAlternateFileName[14]; } WIN32_FIND_DATA, *PWIN32_FIND_DATA, *LPWIN32_FIND_DATA;My DLL-fu is too weak for this right now, but that information is available via the wininet.dll interface, it seems. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 1, 2008 Author Share Posted January 1, 2008 Wow, so many information, thanks! I get only one(?) problem right now - i can not use _FtpConnect because i have no user name/password, i need access to different servers, they provide files (in FTP client or in the Browser) free, i do not need to enter any password/username... so how can i connect to FTP server without this data? when i try with empty strings... $Ftp_Open = _FTPOpen("Some Ftp") $Ret = _FTPConnect($Ftp_Open, "ftp.someserver.com", "", "") I always get 0 I think i can handle the convertion from MSDN to AutoIt DllCall syntax, but i stuck with the FtpConnect issue... Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Kiesp Posted January 1, 2008 Share Posted January 1, 2008 (edited) i havent tried working with ftp and autoit.. but cant u just use the default / -1 ? edit: forgot a / Edited January 1, 2008 by Kiesp http://www.autoitscript.com/forum/index.php?showtopic=69911 <-- Best hacker ever :D Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 2, 2008 Author Share Posted January 2, 2008 i havent tried working with ftp and autoit.. but cant u just use the default / -1 ?No, FTP isn't a native AutoIt functions, it's a UDFs library, and username/password is not an optional parameters.. but even when i set them mnualy, it's wont work. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 2, 2008 Share Posted January 2, 2008 No, FTP isn't a native AutoIt functions, it's a UDFs library, and username/password is not an optional parameters.. but even when i set them mnualy, it's wont work.If the server accepts anonymous connections, the usual input is "anonymous" and the email of the user, so you could try username = "anonymous" and password = "NoSpam@No.Spam.com" . Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 2, 2008 Share Posted January 2, 2008 On the process for getting the file property data from FTP, it looks like someone else solved it already. User slemke posted this version of FTP.au3. And that has some new functions, including these by Dick Bronsdijk: _FTPFileFindFirst and _FTPFileFindNext. Here is that version of FTP.au3:[autoit];===============================================================================;; Function Name: _FTPOpen(); Description: Opens an FTP session.; Parameter(s): $s_Agent - Random name. ( like "myftp" ); $l_AccessType - I dont got a clue what this does.; $s_ProxyName - ProxyName.; $s_ProxyBypass - ProxyByPasses's.; $l_Flags - Special flags.; Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - Returns an indentifier.; On Failure - 0 and sets @ERROR; Author(s): Wouter van Kesteren.;;===============================================================================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();===============================================================================;; Function Name: _FTPConnect(); Description: Connects to an FTP server.; Parameter(s): $l_InternetSession - The Long from _FTPOpen(); $s_ServerName - Server name/ip.; $s_Username - Username.; $s_Password - Password.; $i_ServerPort - Server port ( 0 is default (21) ); $l_Service - I dont got a clue what this does.; $l_Flags - Special flags.; $l_Context - I dont got a clue what this does.; Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - Returns an indentifier.; On Failure - 0 and sets @ERROR; Author(s): Wouter van Kesteren;;===============================================================================Func _FTPConnect($l_InternetSession, $s_ServerName, $s_Username, $s_Password, $i_ServerPort = 0, $l_Service = 1, $l_Flags = 0, $l_Context = 0) Local $ai_InternetConnect = DllCall('wininet.dll', 'long', 'InternetConnect', 'long', $l_InternetSession, 'str', $s_ServerName, 'int', $i_ServerPort, 'str', $s_Username, 'str', $s_Password, 'long', $l_Service, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_InternetConnect[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_InternetConnect[0] EndFunc ;==> _FTPConnect();===============================================================================;; Function Name: _FTPPutFile(); Description: Puts an file on an FTP server.; Parameter(s): $l_FTPSession - The Long from _FTPConnect(); $s_LocalFile - The local file.; $s_RemoteFile - The remote Location for the file.; $l_Flags - Special flags.; $l_Context - I dont got a clue what this does.; Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - 1; On Failure - 0; Author(s): Wouter van Kesteren;;===============================================================================Func _FTPPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0) Local $ai_FTPPutFile = DllCall('wininet.dll', 'int', 'FtpPutFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPPutFile[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPPutFile[0] EndFunc ;==> _FTPPutFile();===============================================================================;; Function Name: _FTPDelFile(); Description: Delete an file from an FTP server.; Parameter(s): $l_FTPSession - The Long from _FTPConnect(); $s_RemoteFile - The remote Location for the file.; Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - 1; On Failure - 0; Author(s): Wouter van Kesteren;;===============================================================================Func _FTPDelFile($l_FTPSession, $s_RemoteFile) Local $ai_FTPPutFile = DllCall('wininet.dll', 'int', 'FtpDeleteFile', 'long', $l_FTPSession, 'str', $s_RemoteFile) If @error OR $ai_FTPPutFile[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPPutFile[0] EndFunc ;==> _FTPDelFile();===============================================================================;; Function Name: _FTPRenameFile(); Description: Renames an file on an FTP server.; Parameter(s): $l_FTPSession - The Long from _FTPConnect(); $s_Existing - The old file name.; $s_New - The new file name.; Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - 1; On Failure - 0; Author(s): Wouter van Kesteren;;===============================================================================Func _FTPRenameFile($l_FTPSession, $s_Existing, $s_New) Local $ai_FTPRenameFile = DllCall('wininet.dll', 'int', 'FtpRenameFile', 'long', $l_FTPSession, 'str', $s_Existing, 'str', $s_New) If @error OR $ai_FTPRenameFile[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPRenameFile[0] EndFunc ;==> _FTPRenameFile();===============================================================================;; Function Name: _FTPMakeDir(); Description: Makes an Directory on an FTP server.; Parameter(s): $l_FTPSession - The Long from _FTPConnect(); $s_Remote - The file name to be deleted.; Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - 1; On Failure - 0; Author(s): Wouter van Kesteren;;===============================================================================Func _FTPMakeDir($l_FTPSession, $s_Remote) Local $ai_FTPMakeDir = DllCall('wininet.dll', 'int', 'FtpCreateDirectory', 'long', $l_FTPSession, 'str', $s_Remote) If @error OR $ai_FTPMakeDir[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPMakeDir[0] EndFunc ;==> _FTPMakeDir();===============================================================================;; Function Name: _FTPDelDir(); Description: Delete's an Directory on an FTP server.; Parameter(s): $l_FTPSession - The Long from _FTPConnect(); $s_Remote - The Directory to be deleted.; Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - 1; On Failure - 0; Author(s): Wouter van Kesteren;;===============================================================================Func _FTPDelDir($l_FTPSession, $s_Remote) Local $ai_FTPDelDir = DllCall('wininet.dll', 'int', 'FtpRemoveDirectory', 'long', $l_FTPSession, 'str', $s_Remote) If @error OR $ai_FTPDelDir[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPDelDir[0] EndFunc ;==> _FTPDelDir();===============================================================================;; Function Name: _FTPClose(); Description: Closes the _FTPOpen session.; Parameter(s): $l_InternetSession - The Long from _FTPOpen(); Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - 1; On Failure - 0; Author(s): Wouter van Kesteren;;===============================================================================Func _FTPClose($l_InternetSession) Local $ai_InternetCloseHandle = DllCall('wininet.dll', 'int', 'InternetCloseHandle', 'long', $l_InternetSession) If @error OR $ai_InternetCloseHandle[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_InternetCloseHandle[0] EndFunc ;==> _FTPClose();===================================================================================================;; Function Name: _FTPPutFolderContents(); Description: Puts an folder on an FTP server. Recursivley if selected; Parameter(s): $l_InternetSession - The Long from _FTPConnect(); $s_LocalFolder - The local folder i.e. "c:\temp".; $s_RemoteFolder - The remote folder i.e. '/website/home'.; $b_RecursivePut - Recurse through sub-dirs. 0=Non recursive, 1=Recursive; Requirement(s): DllCall, wininet.dll; Author(s): Stumpii;;===================================================================================================Func _FTPPutFolderContents($l_InternetSession, $s_LocalFolder, $s_RemoteFolder, $b_RecursivePut) ; Shows the filenames of all files in the current directory. $search = FileFindFirstFile($s_LocalFolder & "\*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If StringInStr(FileGetAttrib($s_LocalFolder & "\" & $file), "D") Then _FTPMakeDir($l_InternetSession, $s_RemoteFolder & "/" & $file) If $b_RecursivePut Then _FTPPutFolderContents($l_InternetSession, $s_LocalFolder & "\" & $file, $s_RemoteFolder & "/" & $file, $b_RecursivePut) EndIf Else _FTPPutFile($l_InternetSession, $s_LocalFolder & "\" & $file, $s_RemoteFolder & "/" & $file, 0, 0) EndIfWEnd; Close the search handleFileClose($search)EndFunc ;==>_FTPPutFolderContents; define some constants - can be used with _FTPPutFile and _FTPGetFile and ftp open flagsConst $INTERNET_FLAG_PASSIVE = 0x08000000Const $INTERNET_FLAG_TRANSFER_ASCII = 0x00000001Const $INTERNET_FLAG_TRANSFER_BINARY = 0x00000002Const $INTERNET_DEFAULT_FTP_PORT = 21Const $INTERNET_SERVICE_FTP = 1;===============================================================================;; Function Name: _FTPCommand(); Description: Sends a command to an FTP server.; Parameter(s): $l_FTPSession - The Long from _FTPOpen(); $s_FTPCommand - Commad string to send to FTP Server; $l_ExpectResponse - Data socket for response in Async mode; $s_Context - A pointer to a variable that contains an application-defined ; value used to identify the application context in callback operations; $s_Handle - A pointer to a handle that is created if a valid data socket is opened. ; The $s_ExpectResponse parameter must be set to TRUE for phFtpCommand to be filled. ;; Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - Returns an indentifier.; On Failure - 0 and sets @ERROR; Author(s): Bill Mezian;; Command Examples: depends on server syntax. The following is for ; Binary transfer, ASCII transfer, Passive transfer mode (used with firewalls); 'type I' 'type A' 'pasv';;===============================================================================Func _FTPCommand($l_FTPSession, $s_FTPCommand, $l_Flags = 0x00000001, $l_ExpectResponse = 0, $l_Context = 0, $s_Handle = '')Local $ai_FTPCommand = DllCall('wininet.dll', 'int', 'FtpCommand', 'long', $l_FTPSession, 'long', $l_ExpectResponse, 'long', $l_Flags, 'str', $s_FTPCommand, 'long', $l_Context, 'str', $s_Handle) If @error OR $ai_FTPCommand[0] = 0 Then SetError(-1) Return 0 EndIf;Return $s_return Return $ai_FTPCommand[0] EndFunc;==> _FTPCommand();===============================================================================;; Function Name: _FTPGetCurrentDir(); Description: Get Current Directory on an FTP server.; Parameter(s): $l_FTPSession - The Long from _FTPConnect(); Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - Directory Name; On Failure - 0; Author(s): Beast;;===============================================================================Func _FTPGetCurrentDir($l_FTPSession) Local $ai_FTPGetCurrentDir = DllCall('wininet.dll', 'int', 'FtpGetCurrentDirectory', 'long', $l_FTPSession, 'str', "", 'long_ptr', 260) If @error OR $ai_FTPGetCurrentDir[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPGetCurrentDir[2]EndFunc;==> _FTPGetCurrentDir();===============================================================================;; Function Name: _FtpSetCurrentDir(); Description: Set Current Directory on an FTP server.; Parameter(s): $l_FTPSession - The Long from _FTPConnect(); $s_Remote - The Directory to be set.; Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - 1; On Failure - 0; Author(s): Beast;;===============================================================================Func _FtpSetCurrentDir($l_FTPSession, $s_Remote) Local $ai_FTPSetCurrentDir = DllCall('wininet.dll', 'int', 'FtpSetCurrentDirectory', 'long', $l_FTPSession, 'str', $s_Remote) If @error OR $ai_FTPSetCurrentDir[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPSetCurrentDir[0] EndFunc;==> _FtpSetCurrentDir();===============================================================================;; Function Name: _FTPGetFileSize(); Description: Gets filesize of a file on the FTP server.; Parameter(s): $l_FTPSession - The Long from _FTPConnect(); $s_FileName - The file name.; Requirement(s): DllCall, wininet.dll; Return Value(s): On Success - 1; On Failure - 0; Author(s): J.o.a.c.h.i.m. d.e. K.o.n.i.n.g.;;===============================================================================Func _FTPGetFileSize($l_FTPSession, $s_FileName) Local $ai_FTPGetSizeHandle = DllCall('wininet.dll', 'int', 'FtpOpenFile', 'long', $l_FTPSession, 'str', $s_FileName, 'long', 0x80000000, 'long', 0x04000002, 'long', 0) Local $ai_FTPGetFileSize = DllCall('wininet.dll', 'int', 'FtpGetFileSize', 'long', $ai_FTPGetSizeHandle[0]) If @error OR $ai_FTPGetFileSize[0] = 0 Then SetError(-1) Return 0 EndIf DllCall('wininet.dll', 'int', 'InternetCloseHandle', 'str', $l_FTPSession) Return $ai_FTPGetFileSize[0] EndFunc ;==> _FTPGetFileSize();===============================================================================;; Function Name: _FTPFileFindFirst(); Description: Find First File on an FTP server.; Parameter(s): $l_FTPSession - The Long from _FTPConnect(); $s_RemoteFile - The remote Location for the file.; $l_Flags - use the dwFlags parameter to specify 1 for transferring the file in ASCII (Type A transfer method) or 2 for transferring the file in Binary (Type I transfer method).; $l_Context - lContext is used to identify the application context when using callbacks. Since we Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 2, 2008 Author Share Posted January 2, 2008 If the server accepts anonymous connections, the usual input is "anonymous" and the email of the user, so you could try username = "anonymous" and password = "NoSpam@No.Spam.com" .Thanks, but it's not work again i get 0 always... i tried even set my own email.On the process for getting the file property data from FTP, it looks like someone else solved it alreadyThanks, i definitly going to use this some day But for now i need to get info from file(s) on public FTP services... Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 2, 2008 Share Posted January 2, 2008 Thanks, but it's not work again i get 0 always... i tried even set my own email.Thanks, i definitly going to use this some day But for now i need to get info from file(s) on public FTP services...Can you provide an example of an FTP site and file (preferable read-only!) that could be used for a reproducer/demo script? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
MrCreatoR Posted January 2, 2008 Author Share Posted January 2, 2008 Can you provide an example of an FTP site and file (preferable read-only!) that could be used for a reproducer/demo script?Sure: #include <FTP.au3> ;I need to get info for this file (for example) - ftp://ftp.dpidb.genebee.msu.ru/pdb/474d.pdb2.gz $Server = 'ftp.dpidb.genebee.msu.ru/pdb' ;i tried without the /pdb too. $Username = 'anonymous' $Pass = 'NoSpam@No.Spam.com' $Open = _FTPOpen('MyFTP Control') $FTPSession = _FTPConnect($Open, $Server, $Username, $Pass) If @error Then MsgBox(48, '', 'Oops, not working :( ' & @LF & '(Return = ' & $FTPSession & ')') Exit EndIf $Size = _FTPGetFileSize($FTPSession, '474d.pdb2.gz') ConsoleWrite($Size) $Ftpc = _FTPClose($Open) But i am not sure what you mean by "preferable read-only!"... Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: 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 ProgramUDFs: 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 Examples: 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 ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team 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