[python-win32] fast test if (unknown) process is running ? Why not use Autoit ?

Stef Mientki stef.mientki at gmail.com
Fri Aug 6 13:27:31 CEST 2010


 hello,

I wonder if there's a fast way to test if a process is running.

these are my experiences till so far:

1. win32pdh, not usefull, because it shows ths status of some ancient history

2. wmi, VERY SLOW: 1500 .. 2000 msec
   import wmi
    w = wmi.WMI()
    processes = w.instances('Win32_Process')
    instances = []
    for process in processes :
      if process.Name.lower() == name :
        return process.ProcessId

3. Autoit, very fast: 10..20 msec
    autoit = win32com.client.Dispatch ( "AutoItX3.Control" )
    print autoit.ProcessExists ( process )

Are the better (faster) ways, without the use of AutoIt ?

Now this raises another question (please forgive my ignorance):
Why not use AutoIt always, instead of all the win32 libraries ?
AFAIK, the advantages of AutoIt:
- seems to be very fast
- is very well documented
- can be tested in a AutoIt friendly editor (Scite)
AFAIK the disadvantages:
- when distributing, you must add an extra file

thanks,
Stef Mientki



More information about the python-win32 mailing list