How to detect open windows applications

Tim Golden tim.golden at tesco.net
Thu Sep 16 15:46:07 EDT 2004


Roy wrote:
> How do I know within my python script if a specific windows
> application is currently running in Windows 2000. Specifically, I
> would like to know of MSWORD is running. I have the win32 package
> installed. Thank you for your help.

I'm sure there are other ways, but since no-one else has
replied yet, you could use wmi:

<code>
import wmi

c = wmi.WMI ()
for p in c.Win32_Process (Name="thunderbird.exe"):
   print p.ExecutablePath

</code>

The example uses my wmi-wrapper module (Google for Python 
WMI) but you can do WMI with raw pywin32 -- all the module 
does is to make life a bit easier.

TJG



More information about the Python-list mailing list