You are not using the WMI efficiently. You iterate over every process to test if only one is there, when you can use WMI like so:<div><br></div><div><div>&gt;&gt;&gt; import wmi</div><div>&gt;&gt;&gt; x = wmi.WMI()</div><div>

&gt;&gt;&gt; x.query(&quot;SELECT * FROM Win32_Process WHERE Name = &#39;xchat.exe&#39;&quot;)</div><div>[&lt;_wmi_object: \\TOM-PC\root\cimv2:Win32_Process.Handle=&quot;7052&quot;&gt;]</div><div>&gt;&gt;&gt; def test():</div>

<div><span class="Apple-tab-span" style="white-space:pre">        </span>t1 = time.time()</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>x.query(&quot;SELECT * FROM Win32_Process WHERE Name = &#39;xchat.exe&#39;&quot;)</div>

<div><span class="Apple-tab-span" style="white-space:pre">        </span>print time.time()-t1</div><div><br></div><div>&gt;&gt;&gt; import time</div><div>&gt;&gt;&gt; test()</div><div>0.0829999446869</div><div>&gt;&gt;&gt; </div>

<div><br></div><div>You can further reduce load times by requesting less data from WMI, i.e stuff you are going to use:</div><div><div>&gt;&gt;&gt; def test():</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>t1 = time.time()</div>

<div><span class="Apple-tab-span" style="white-space:pre">        </span>x.query(&quot;SELECT Handle FROM Win32_Process WHERE Name = &#39;xchat.exe&#39;&quot;)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>print time.time()-t1</div>

</div><div><div>&gt;&gt;&gt; test()</div><div>0.0599999427795</div></div><div><br><div class="gmail_quote">On Fri, Aug 6, 2010 at 2:27 PM, Stef Mientki <span dir="ltr">&lt;<a href="mailto:stef.mientki@gmail.com">stef.mientki@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> thanks Tim,<br>
<div class="im"><br>
On 06-08-2010 13:44, Tim Golden wrote:<br>
&gt; On 06/08/2010 12:27, Stef Mientki wrote:<br>
</div>&gt; &lt;snip<br>
<div class="im"><br>
&gt; Try psutil (which uses the toolhelp DLL):<br>
&gt;<br>
&gt; <a href="http://code.google.com/p/psutil/" target="_blank">http://code.google.com/p/psutil/</a><br>
&gt;<br>
&gt; &lt;code&gt;<br>
&gt; import psutil<br>
&gt;<br>
&gt; for p in psutil.process_iter ():<br>
&gt;   if <a href="http://p.name" target="_blank">p.name</a> == &quot;blah&quot;:<br>
&gt;     print p<br>
&gt;     break<br>
&gt; else:<br>
&gt;   print &quot;Not found&quot;<br>
&gt;<br>
&gt; &lt;/code&gt;<br>
&gt;<br>
</div>yes that works quit well, just a little bit slower than AutoIt:<br>
AutoIt: 0 .. 15 msec<br>
psutils: 40 ..50 msec<br>
<br>
thanks,<br>
<font color="#888888">Stef Mientki<br>
</font><div><div></div><div class="h5">&gt; TJG<br>
&gt; _______________________________________________<br>
&gt; python-win32 mailing list<br>
&gt; <a href="mailto:python-win32@python.org">python-win32@python.org</a><br>
&gt; <a href="http://mail.python.org/mailman/listinfo/python-win32" target="_blank">http://mail.python.org/mailman/listinfo/python-win32</a><br>
<br>
_______________________________________________<br>
python-win32 mailing list<br>
<a href="mailto:python-win32@python.org">python-win32@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-win32" target="_blank">http://mail.python.org/mailman/listinfo/python-win32</a><br>
</div></div></blockquote></div><br></div></div>