Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Run("ftp.exe", "") TimeDelay("1") SendKeysTo("~ftp", "open 30.30.3.45") SendKey("{ENTER}") SendKey("UserID") TimeDelay("2") SendKey("Password") TimeDelay("1") SendKey("{ENTER}") TimeDelay("2") SendKeysTo("~ftp", "get file_name")What function can I use to determine that the download has completed/finished so that I can then delete the file and start over?
Sample:
AddExtender("WWINT34i.DLL") tophandle=iBegin(0,"","") conhandle=iHostConnect(tophandle,"ftp.myserver.com",@FTP, "jane", "tarzan") if conhandle==0 message("ERROR","Unable to connect to host") exit endif prog=0 cancelbutton=1 var1=iFtpDialog(2,"Ftp session","Please wait while processing..",prog,cancelbutton) Currdir=iFtpDirGet(conhandle) getfile=iFtpGet(conhandle,"%Currdir%\myfile.zip","c:\windows\desktop\myfile.zip",0,@BINARY) if getfile==0 then message("Oopps!",strcat("iFtpGet Failed check:",@CRLF," -Remote file path",@CRLF," -Overwrite Param(does local file already exist?)")) iClose(conhandle) iClose(tophandle) Message("All","Done") ;Delete file here.... exitOr if using the WinInet extender is not a possiblity and if FTP has to be conducted through a DOS window. You could accomplish the task with the use of the -s switch and creating a text file to read the FTP commands from. In other words create a file called 'ftp.txt' and specify what appears below.
Note: Replace 'username', 'password', 'directory' and 'filename.xxx' as appropriate for your needs. The BIN statement is only required if the file being retrieved is binary (an *.exe, *.dll, etc.). If an ASCII (text) file is being retrieved, you may omit the BIN statement.
OPEN 192.168.1.100 username password CD directory BIN GET filename.xxx QUITTo use the 'ftp.txt' in conjunction with the FTP command in DOS. All you need to do is type ftp -s:ftp.txt and press enter.
Now to quickly stuff the above into WinBatch.
coms=Environment("COMSPEC") ftptxt=FileOpen("ftp.txt", "WRITE") FileWrite(ftptxt, "OPEN 192.168.1.100") FileWrite(ftptxt, "username") ;replace as needed FileWrite(ftptxt, "password") ;replace as needed FileWrite(ftptxt, "CD directory") ;replace as needed FileWrite(ftptxt, "BIN") ;only needed if file is binary FileWrite(ftptxt, "GET filename.xxx") ;replace as needed FileWrite(ftptxt, "QUIT") FileClose(ftptxt) RunHideWait(coms, "/c ftp.exe -s:ftp.txt") FileDelete('ftp.txt') ;delete the script Exit
Article ID: W16467
File Created: 2005:02:18:12:20:52
Last Updated: 2005:02:18:12:20:52