Gabriel Genellina wrote:
Start the application in a separate console (using `start "" bat_file` might be the easiest way) and then, within your Python script, wait until the new process is ready. The wmi module by Tim Golden can help <http://tgolden.sc.sabren.com/python/wmi.html>
e.g. wait until Microsoft Word opens:

import wmi
c = wmi.WMI()
while not len(c.Win32_Process(name="winword.exe")):
    sleep(500)

Just for information's sake, you can do this
a little more neatly in WMI:

<code>
import wmi

c = wmi.WMI ()
word_watcher = c.Win32_Process.watch_for (name="winword.exe")
winword = word_watcher ()

</code>

Actually, now I look it's not that much neater; it basically
pushes the polling into WMI itself. Still, it is at least an
alternative :)

TJG
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to