How to download a "web" page by Lotus Script automatically?

I would like to automatically download some files (not a HTML page really) from any http web specifying its URL. E.g.:

http://www.acme.com/files/file50.zip

http://www.acme.com/files/file51.zip

The file may arive either into a predefined file directory or into some predefined notes document in the .NSF database or somewhere similar - the local destination does not matter too much. I am also fine with both the Domino server or Notes client usage.

So far I located only notesUIWorkspace.URLOpen method but this does seem to display the page, not to save it somewhere.

Thx. for tips.

Subject: How to download a “web” page by Lotus Script automatically?

Declare Function URLDownloadToFile Lib “urlmon” Alias “URLDownloadToFileA” (Byval pCaller As Long, Byval szURL As String, Byval szFileName As String, Byval dwReserved As Long, Byval lpfnCB As Long) As LongDeclare Function DeleteUrlCacheEntry Lib “wininet” Alias “DeleteUrlCacheEntryA” (Byval lpszUrlName As String) As Long

Sub Click(Source As Button)

Dim urlstr As String

urlstr=“http://www.acme.com/files/file50.zip

returnValue = URLDownloadToFile(0, urlstr, “c:\file50.zip”, 0, 0)

Call DeleteUrlCacheEntry(urlstr)

End Sub


DeleteUrlCacheEntry(urlstr) is used to delete the file from temp folder where Windows caches the downloaded files.

You can also use other Win API for downloading, but this one is the easiest to implement. If you want more control over the download process, use Java classes or find some WinSock code on Internet or here in forum.

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q244757

Subject: RE: How to download a “web” page by Lotus Script automatically?

Thank you very much. It works nicely and saved me a lot time searching how to do it.

In fact it worked copy&past, I just had to add this line:

Dim returnValue As Variant

According to

this function should return the values:

E_OUTOFMEMORY

S_OK

I still have to test what it means in Notes environment, especially when the possibility that the file on the given URL is not available. It should be easily testable.