I am trying to automate a weekly FTP download. The site is setup to access the ftp files from a web page. You put in the filename in a form and the site will kickoff the ftp download. I have tried using the ftp.exe from command prompt and always get a connect error. The site is locked down to prevent browsing of files on the ftp server. You must know the filename you need.
The command kicked off by the web page is of this format:
ftp://user
wd@host:21/file.zip
The only way I have been able to script this is by using InternetExplorer.Application and sendkeys.
This does not work if the PC is locked because sendkeys cannot issue the replies to the download prompts from IE.
Can anyone help me get this working? Are there other options to supress the download prompts? (I could rename the downloaded file later.)
Or could someone point me in a different direction that does not use IE?
The command kicked off by the web page is of this format:
ftp://user
The only way I have been able to script this is by using InternetExplorer.Application and sendkeys.
Code:
Set objExplorer = WScript.CreateObject("InternetExplorer.Application")
Set objShell = CreateObject("WScript.Shell")
objExplorer.Navigate "ftp://user:pwd@host:21/file.ZIP"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 1000
objExplorer.Height = 500
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1
WScript.sleep 3000
objShell.AppActivate "File Download"
WScript.sleep 300
objShell.SendKeys "{enter}"
wscript.sleep 1000
objShell.SendKeys "new file name and path.zip"
objShell.SendKeys "{enter}"
objShell.SendKeys "{enter}"
This does not work if the PC is locked because sendkeys cannot issue the replies to the download prompts from IE.
Can anyone help me get this working? Are there other options to supress the download prompts? (I could rename the downloaded file later.)
Or could someone point me in a different direction that does not use IE?