WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

URLs - Web - Browser Topics

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Download a Document

Keywords: download HTTPRecvFile ObjectOpen DllCall

Question:

Is there anyway to recognize when Netscape is done downloading a document. I would like to write a script to download a series of documents every day and save them but the Web is too inconsistent in the time it takes to download. Wouldn't it be nice to be able to identify when a document is done downloading?

Answer:

  1. If you use our WinSock extender (available from the WinBatch Add-Ons download area of our web site), it can download the file directly (HTTPRecvFile).
  2. If you use the ObjectOpen function you can control Netscape and tell when it is done. See the example for ObjectOpen in the WIL help file - NOT THE PRINTED MANUAL

Additional options:

This also can be done via a series of ugly dllCall()s. The following code is good for Netscape 2 on Win3.1.
Elsewhere you may need to check the menu IDs before using those integers.
:checkbusy
  m=DLLCall(huser, word:"GetMenu", word:netscape)
  Go=DLLCall(huser, word:"GetSubMenu", word:m, word:3)
  Stop=DLLCall(huser, word:"GetMenuItemID", word:go, word:3)
  IntControl(23,netscape,279,go,0) 
  f=DLLCall(huser, word:"GetMenuState", word:go, word:3, word:1024)
  ready = (f mod 256 > 0)
  drop(m,go,stop,f)
  return

Article ID:   W13347
Filename:   Downloading a Document.txt
File Created: 1999:04:15:16:53:24
Last Updated: 1999:04:15:16:53:24