Is there a way to do this?
I would like to automate a daily procedure for downloading and saving a
couple of dozen pdf from several websites. Currently I have saved bookmarks
in a browser and manually open and save each one.
Some of the files have direct addresses, for example:
https://www.somewebsite.com/resources/documents/daily_price_sheet.pdf
Some are dynamically generated, for example:
https://www.somewebsite.com/resources/documents/daily_price_sheets.jsp&account=012345&state=MA&type=wsl
(this returns a pdf file to the browser)
I can get the directly addressed documents with some simple scripting of an
FTP client. It's the dynamically generated files that I'm having a hard time
figuring out. The only way I've been able to get the dymamically generated
files seems to be to request the url through a browser.
(Windows XP pro, ie 6.0, Acrobat Reader 7.0.0, VB.NET 2003)
Dim ieApp As SHDocVw.InternetExplorer = New SHDocVw.InternetExplorer
Dim sURL as String = "URL of file I want"
ieApp.Navigate(sURL)
This seems to work fine. Launches a browser, navigates to the URL, browser
invokes Acrobat, pdf document is displayed.
The two problems I don't know how to solve are:
1) Determining when the pdf document has finished downloading.
2) Saving it.
Thanks.
Mike
'WebClient.DownloadFile'.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Here is some of my C# code that I use. Should be very easy to translate
into VB.NET. Give it a try and let me know how it goes.
WebClient webClient = new WebClient();
try
{
webClient.Credentials = CredentialCache.DefaultCredentials;
webClient.DownloadFile(url, fileName);
}
catch (System.Exception e)
{
// Do something with exception
}
finally
{
webClient.Dispose();
}
Jason Newell
Thanks again,
Mike
"Jason Newell" <nos...@nospam.com> wrote in message
news:%23zqoXC7...@TK2MSFTNGP14.phx.gbl...