views:

11

answers:

0

The following is the CScript script I use for the programmatic printing of a Word document.

var err = 0;
var app = WScript.CreateObject("Word.Application");
try {
  var filename = WScript.Arguments(0);
  var enc = (filename.toLowerCase().indexOf(".txt") >= 0) || (filename.toLowerCase().indexOf(".htm")) ? 65001 : 1252;
  var objDoc = app.Documents.Open(filename, false, true, false, " ", " ", false, " ", " ", 0, enc, true, false, 0, true);
  objDoc.PrintOut(false, false, 0, "", "", "", 0);
} catch (e) {
  err = 1;
} finally {
  app.Quit(0);
}
WScript.Quit(err);

How can I modify it to prevent the spooling dialog box from being displayed? (Is this even possible?) A screen capture of what I mean by "spooling dialog box" is at http://imgur.com/qqtib.png.