GrungeRocker Posted January 15, 2006 Share Posted January 15, 2006 I downloaded the ftp-udf which was written by wouterIs there a way to list all files, that are stored on an ftp-serer, in an listview? [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
w0uter Posted January 15, 2006 Share Posted January 15, 2006 not yet. there is a beta version of the udf somewhere. it shows you how to do it. but it is still beta and doesnt work My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
GrungeRocker Posted January 15, 2006 Author Share Posted January 15, 2006 (edited) maybe with a com object? Edited January 15, 2006 by Analritter [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
w0uter Posted January 15, 2006 Share Posted January 15, 2006 maby with ftp.exe ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
GrungeRocker Posted January 15, 2006 Author Share Posted January 15, 2006 i can't find anything about ftp.exe.....dou you maybe have an side with all functions? [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
w0uter Posted January 15, 2006 Share Posted January 15, 2006 ftp.exe > help My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
GrungeRocker Posted January 15, 2006 Author Share Posted January 15, 2006 hm and how do i use it in autoit? [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
w0uter Posted January 15, 2006 Share Posted January 15, 2006 just pipe the output to a file ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
GrungeRocker Posted January 15, 2006 Author Share Posted January 15, 2006 is it something like this? (the following script is not working...)$foo = Run( "ftp.exe ", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) StdinWrite($foo, "help") StdinWrite($foo)(remember: i just came back to autoit... after a long linux using time [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
DaveF Posted January 16, 2006 Share Posted January 16, 2006 (edited) Example that runs FTP.EXE and collects the output in a string. ; Run the child program ; 7 in the last parameter means AutoIt connects to STDIN, STDOUT and STDERR $foo = Run(@ComSpec & " /c ftp.exe", @SystemDir, @SW_SHOW, 7) ; Write the desired commands + RETURNs to the child's STDIN StdinWrite($foo, "help" & @CRLF & "bye" & @CRLF) ; Loop until we get all the child program's output While 1 $line = StdoutRead($foo) If @error = -1 Then ExitLoop Wend MsgBox(0, "AutoIt3 Version " & @AutoItVersion & " STDOUT read (from FTP):", $line) ; Loop and collect any error messsages from the child program While 1 $line = StderrRead($foo) If @error = -1 Then ExitLoop Wend MsgBox(0, "STDERR read (from FTP):", $line) MsgBox(0, "Debug", "Exiting...") [Edit: Typo] Edited January 16, 2006 by DaveF Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
GrungeRocker Posted January 16, 2006 Author Share Posted January 16, 2006 Thanks! [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] Link to comment Share on other sites More sharing options...
wolkenloser Posted January 16, 2006 Share Posted January 16, 2006 (edited) Hi Take a look at this :-) I've added this Code to the FTP.AU3 from WOUTER expandcollapse popup;=============================================================================== ; ; 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 were not using callbacks well pass 0. ; Requirement(s): DllCall, wininet.dll ; Return Value(s): On Success - 1 ; On Failure - 0 ; Author(s): Dick Bronsdijk ; ;=============================================================================== #cs 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; typedef struct _FILETIME { DWORD dwLowDateTime; DWORD dwHighDateTime; } FILETIME; #ce Func _FTPFileFindFirst($l_FTPSession, $s_RemoteFile, ByRef $h_Handle, ByRef $l_DllStruct, $l_Flags = 0, $l_Context = 0) Local $str = "int;uint[2];uint[2];uint[2];int;int;int;int;char[256];char[14]" $l_DllStruct = DllStructCreate($str) if @error Then SetError(-2) Return "" endif Dim $a_FTPFileList[1] $a_FTPFileList[0] = 0 Local $ai_FTPPutFile = DllCall('wininet.dll', 'int', 'FtpFindFirstFile', 'long', $l_FTPSession, 'str', $s_RemoteFile, 'ptr', DllStructGetPtr($l_DllStruct), 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPPutFile[0] = 0 Then SetError(-1) Return $a_FTPFileList EndIf $h_Handle = $ai_FTPPutFile[0] $FileName = DllStructGetData($l_DllStruct, 9) Dim $a_FTPFileList[12] $a_FTPFileList[0] = 12 $a_FTPFileList[1] = DllStructGetData($l_DllStruct, 1) ; File Attributes $a_FTPFileList[2] = DllStructGetData($l_DllStruct, 2, 1) ; Creation Time Low $a_FTPFileList[3] = DllStructGetData($l_DllStruct, 2, 2) ; Creation Time High $a_FTPFileList[4] = DllStructGetData($l_DllStruct, 3, 1) ; Access Time Low $a_FTPFileList[5] = DllStructGetData($l_DllStruct, 3, 2) ; Access Time High $a_FTPFileList[6] = DllStructGetData($l_DllStruct, 4, 1) ; Last Write Low $a_FTPFileList[7] = DllStructGetData($l_DllStruct, 4, 2) ; Last Write High $a_FTPFileList[8] = DllStructGetData($l_DllStruct, 5) ; File Size High $a_FTPFileList[9] = DllStructGetData($l_DllStruct, 6) ; File Size Low $a_FTPFileList[10] = DllStructGetData($l_DllStruct, 9); File Name $a_FTPFileList[11] = DllStructGetData($l_DllStruct, 10) ; Altername Return $a_FTPFileList EndFunc;==> _FTPFileFindFirst() ;=============================================================================== ; ; Function Name: _FTPFileFindNext() ; Description: Find Next File on 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): Dick Bronsdijk ; ;=============================================================================== Func _FTPFileFindNext($h_Handle, $l_DllStruct) Dim $a_FTPFileList[1] $a_FTPFileList[0] = 0 Local $ai_FTPPutFile = DllCall('wininet.dll', 'int', 'InternetFindNextFile', 'long', $h_Handle, 'ptr', DllStructGetPtr($l_DllStruct)) If @error OR $ai_FTPPutFile[0] = 0 Then SetError(-1) Return $a_FTPFileList EndIf Dim $a_FTPFileList[12] $a_FTPFileList[0] = 12 $a_FTPFileList[1] = DllStructGetData($l_DllStruct, 1) ; File Attributes $a_FTPFileList[2] = DllStructGetData($l_DllStruct, 2, 1) ; Creation Time Low $a_FTPFileList[3] = DllStructGetData($l_DllStruct, 2, 2) ; Creation Time High $a_FTPFileList[4] = DllStructGetData($l_DllStruct, 3, 1) ; Access Time Low $a_FTPFileList[5] = DllStructGetData($l_DllStruct, 3, 2) ; Access Time High $a_FTPFileList[6] = DllStructGetData($l_DllStruct, 4, 1) ; Last Write Low $a_FTPFileList[7] = DllStructGetData($l_DllStruct, 4, 2) ; Last Write High $a_FTPFileList[8] = DllStructGetData($l_DllStruct, 5) ; File Size High $a_FTPFileList[9] = DllStructGetData($l_DllStruct, 6) ; File Size Low $a_FTPFileList[10] = DllStructGetData($l_DllStruct, 9); File Name $a_FTPFileList[11] = DllStructGetData($l_DllStruct, 10) ; Altername Return $a_FTPFileList EndFunc;==> _FTPFileFindNext() ;=============================================================================== ; ; Function Name: _FTPFileFindClose() ; Description: Delete FindFile Structure. ; Parameter(s): ; Requirement(s): DllCall, wininet.dll ; Return Value(s): On Success - 1 ; On Failure - 0 ; Author(s): Dick Bronsdijk ; ;=============================================================================== Func _FTPFileFindClose($h_Handle, $l_DllStruct) DllStructDelete($l_DllStruct) Local $ai_FTPPutFile = DllCall('wininet.dll', 'int', 'InternetCloseHandle', 'long', $h_Handle) If @error OR $ai_FTPPutFile[0] = 0 Then SetError(-1) Return "" EndIf Return $ai_FTPPutFile[0] EndFunc;==> _FTPFileFindClose() ;=============================================================================== ; ; Function Name: _FTPGetFile() - db Test ; Description: Gets an file from an FTP server. ; Parameter(s): $l_FTPSession - The Long from _FTPConnect() ; $s_RemoteFile - The remote Location for the file. ; $s_LocalFile - The local 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_Fail - Allow local file to be overwritten if it exists ; - -1 Don't allow overwrite (default) ; - 0 Allow overwrite ; $l_Attributes - Attributes for local file ; $l_Context - lContext is used to identify the application context when using callbacks. Since were not using callbacks well pass 0. ; Requirement(s): DllCall, wininet.dll ; Return Value(s): On Success - 1 ; On Failure - 0 ; Author(s): Dick Bronsdijk ; ;=============================================================================== Func _FTPGetFile($l_FTPSession, $s_RemoteFile, $s_LocalFile, $l_Flags = 2, $l_Fail = -1, $l_Attributes = 0, $l_Context = 0) Local $ai_FTPGetFile = DllCall('wininet.dll', 'int', 'FtpGetFile', 'long', $l_FTPSession, 'str', $s_RemoteFile, 'str', $s_LocalFile, 'long', $l_Fail, 'long', $l_Attributes, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPGetFile[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPGetFile[0] EndFunc;==> _FTPGetFile() And here a exampel to use this. (Download from the last Symantec_Virusdefinitions to c:\) expandcollapse popup#include <ftp.au3> dim $dl_file $server = 'ftp.symantec.com' $username = 'anonymous' $pass = 'anonymous@test.de' $Open = _FTPOpen('MyFTP Control') If @error Then Failed("Open") $Conn = _FTPConnect($Open, $server, $username, $pass) If @error Then Failed("Connect") Dim $Handle Dim $DllRect $FileInfo = _FtpFileFindFirst($Conn, '/public/english_us_canada/antivirus_definitions/norton_antivirus/*i32.exe*', $Handle, $DllRect) If $FileInfo[0] Then Do ;~ MsgBox(0, "Find", $FileInfo[1] & @CR & $FileInfo[2] & @CR & $FileInfo[3] & @CR & $FileInfo[4] & @CR & $FileInfo[5] & @CR & $FileInfo[6] & @CR & $FileInfo[7] & @CR & $FileInfo[8] & @CR & $FileInfo[9] & @CR & $FileInfo[10]) $dl_file = $FileInfo[10] $FileInfo = _FtpFileFindNext($Handle, $DllRect) Until Not $FileInfo[0] EndIf _FtpFileFindClose($Handle, $DllRect) MsgBox(0,"FTP File", "für DL vorgesehen:" & $dl_file) $Ftpg = _FTPGetFile($Conn, "/public/english_us_canada/antivirus_definitions/norton_antivirus/" & $dl_file,"c:\" & $dl_file) $Ftpc = _FTPClose($Open) If @error Then Failed("Close") Exit Func Failed($F) MsgBox(0, "FTP", "Failed on: " & $F) Exit 1 EndFunc Greetings Wolke Edited January 16, 2006 by wolkenloser Link to comment Share on other sites More sharing options...
GrungeRocker Posted January 17, 2006 Author Share Posted January 17, 2006 mm thx =) [font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font] 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