title: How to wait for an application to start in VBScript?
body: <p>I'm a new VB Script programmer trying to use VB Script to open a pdf file via the default program (Adobe Reader X in this case) and save it as a text file.</p>
  
  <p>The current script I have opens the PDF, waits 1 second, then saves it as text.  However, for slower computers, it might take more than 1 second for the PDF to load up.  Does anyone know how to do a sleep loop until the file is opened or the status is ready?</p>
  
  <pre><code>Set WshShell = WScript.CreateObject("WScript.Shell") 
  WshShell.Run """C:\Temp\Gasprices.pdf"""
  Set objShell = CreateObject("WScript.Shell") 
  wscript.sleep 1000
  objShell.SendKeys "%FAX%S"
  </code></pre>