Delta01 Posted April 13, 2008 Share Posted April 13, 2008 (edited) Well, I'm trying to download a file from my FTP server. I get the file downloaded, but then the script says "AutoIt has stopped responding" How can I fix this, my code is below... expandcollapse popup#Include <_FTP.au3> $server = 'server.host.com' $username = 'username' $pass = 'password' $dllhandle = DllOpen('wininet.dll') $Open = _FTPOpen('MyFTP Control') $Conn = _FTPConnect($Open, $server, $username, $pass) _FTPGetFile($Conn,"/hello.txt", @ScriptDir & "/hello.txt", 0, 0) $Ftpc = _FTPClose($Open) DllClose($dllhandle) ;=============================================================================== ; ; Function Name: _FTPGetFile() ; Description: Get file from a 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 _FTPGetFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0) Local $ai_FTPGetFile = DllCall('wininet.dll', 'int', 'FtpGetFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPGetFile[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPGetFile[0] EndFunc What am I doing wrong? Edited April 13, 2008 by Delta01 Link to comment Share on other sites More sharing options...
d4rk Posted April 13, 2008 Share Posted April 13, 2008 #Include <_FTP.au3> $server = 'server.host.com' $username = 'username' $pass = 'password' $dllhandle = DllOpen('wininet.dll') $Open = _FTPOpen('MyFTP Control') $Conn = _FTPConnect($Open, $server, $username, $pass) _FTPGetFile($Conn,"/hello.txt", @ScriptDir & "/hello.txt", 0, 0) $Ftpc = _FTPClose($Open) DllClose($dllhandle) [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
Delta01 Posted April 13, 2008 Author Share Posted April 13, 2008 Huh? Did you change anything? Link to comment Share on other sites More sharing options...
d4rk Posted April 13, 2008 Share Posted April 13, 2008 yes, i removed this part , which is declare in the <FTP.au3>, why do you try to put it in your code ? ;=============================================================================== ; ; Function Name: _FTPGetFile() ; Description: Get file from a 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 _FTPGetFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0) Local $ai_FTPGetFile = DllCall('wininet.dll', 'int', 'FtpGetFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPGetFile[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPGetFile[0] EndFunc [quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys Link to comment Share on other sites More sharing options...
Delta01 Posted April 13, 2008 Author Share Posted April 13, 2008 Because it has the other code I need like, FTPOPen() Link to comment Share on other sites More sharing options...
Delta01 Posted April 14, 2008 Author Share Posted April 14, 2008 Bump Link to comment Share on other sites More sharing options...
Delta01 Posted April 14, 2008 Author Share Posted April 14, 2008 Bump....... 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