Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


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