title: how to check that MS Word is running using VBScript
body: <p>we have an application that runs MS Word (hidden) to print documents.</p>
  
  <p>If one of the printers has a problem, then Word hangs while waiting for the spooler to return the 'queued' message. </p>
  
  <p>We have found that if we make Word visible (by using VBA in Excel with <code>GetObject</code> and <code>oWordApp.visible=true</code> for example) then the process continues printing the other documents with no problem.</p>
  
  <p>We would like to make this more automatic by having a VBScript check for Word in running processes, if it finds it, make it visible, wait for a few seconds, hide it, and quit...</p>
  
  <p>But I have a problem that the VBScript <code>GetObject</code> function instantiates Word if it's not already running.</p>
  
  <p>how should I check that word is running using VBScript without creating an instance of it?</p>
  
  <p>here is the code I have in my VBScript file:</p>
  
  <pre><code>dim oWord, WScriptShell
  
  set oWord = getobject("", "Word.Application")
  set WScriptShell = CreateObject("WScript.Shell")
  
  if isobject(oWord)  then 'and oWord.Documents.count&gt;0
      wscript.echo("Word is running")
      oWord.visible=true
      WScript.Sleep 1000
      oWord.visible=false
  else
      wscript.echo("Word not running")
  end if
  </code></pre>
  
  <p>so what should I use to check if word is running without creating an instance of it?</p>