wsh ProcessID

John Schmitt jschmitt at ati.com
Tue Aug 13 01:27:37 CEST 2002


Based on reading some MSDN docs,

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/ht
ml/wslrfprocessidproperty.asp

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?

---------------
D:\work\autodx>type t1.py
import win32com.client

shell = win32com.client.Dispatch("WScript.Shell")
shell.Run( r"C:\winnt\notepad.exe" )
print shell.ProcessID()

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

Thanks.

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20020812/f411d1a1/attachment.html>


More information about the Python-list mailing list