<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>wsh ProcessID</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>Based on reading some MSDN docs,</FONT>
</P>

<P><FONT SIZE=2><A HREF="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wslrfprocessidproperty.asp" TARGET="_blank">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wslrfprocessidproperty.asp</A></FONT>
</P>

<P><FONT SIZE=2>I thought the program below would reveal the PID of Notepad.exe, the same one that the Task Manager reveals.  Any clues on where to look next to get the PID or how to access WSH Shell properties in general?</FONT></P>

<P><FONT SIZE=2>---------------</FONT>
<BR><FONT SIZE=2>D:\work\autodx>type t1.py</FONT>
<BR><FONT SIZE=2>import win32com.client</FONT>
</P>

<P><FONT SIZE=2>shell = win32com.client.Dispatch("WScript.Shell")</FONT>
<BR><FONT SIZE=2>shell.Run( r"C:\winnt\notepad.exe" )</FONT>
<BR><FONT SIZE=2>print shell.ProcessID()</FONT>
</P>

<P><FONT SIZE=2>D:\work\autodx>t1</FONT>
<BR><FONT SIZE=2>Traceback (most recent call last):</FONT>
<BR><FONT SIZE=2>  File "D:\work\autodx\t1.py", line 5, in ?</FONT>
<BR><FONT SIZE=2>    print shell.ProcessID()</FONT>
<BR><FONT SIZE=2>  File "C:\Python22\lib\site-packages\win32com\client\dynamic.py", line 438, in __getattr__</FONT>
<BR><FONT SIZE=2>    raise AttributeError, "%s.%s" % (self._username_, attr)</FONT>
<BR><FONT SIZE=2>AttributeError: WScript.Shell.ProcessID</FONT>
<BR><FONT SIZE=2>---------------</FONT>
</P>

<P><FONT SIZE=2>Thanks.</FONT>
</P>

<P><FONT SIZE=2>John</FONT>
</P>

</BODY>
</HTML>