How to detect open windows applications

Roy GoogleGroups at garringer.net
Fri Sep 17 11:59:33 EDT 2004


Michel Claveau - abstraction méta-galactique non trivial	e en fuite perpétuelle. <unseulmcmcmcmc at msupprimerlepoint.claveauPOINTcom> wrote in message news:<cicqq6$kra$1 at news-reader4.wanadoo.fr>...
> Hi ! 
> 
> Search the process.
> 
> @-salutations

I found it! (I think)
Is the following code reasonable?
.....
import win32pdh

processes = win32pdh.EnumObjectItems(None, None, "Process", -1)
processList = list(processes[1])

app = 'WINWORD'
try:
    index = processList.index(app)
    print "Application %s is running." % app
except ValueError:
    print "Application %s is not running." % app
.....
I don't care about index, which indicates where it is in the process list.

Thank you for your help!



More information about the Python-list mailing list