Get all attributes of a com object

Tim Golden tim.golden at viacom-outdoor.co.uk
Fri Apr 28 06:45:00 EDT 2006


[bruno at modulix]

| Duncan Booth wrote:

| > That will show him the attributes of the Python wrapper 
| around the COM 
| > object, it won't show him the attributes of the underlying 
| COM object 
| > itself.
| 
| I stand corrected - and shouldn't answer questions about MS technos :(

In fact, if a static wrapper has been built for the object
in question, the usual help (), inspect () stuff will
work, eg:

<code>
import win32com.client

#
# Make sure a proxy module is built behind-the-scenes
#
word = win32com.client.gencache.EnsureDispatch ("Word.Application")

help (word.__class__)

</code>

class _Application(win32com.client.DispatchBaseClass)
 |  Methods defined here:
 |
 |  Activate(self)
 |
 |  AddAddress(self, TagID=<PyOleEmpty object>, Value=<PyOleEmpty
object>)
 |
 |  AutomaticChange(self)
 |
 |  BuildKeyCode(self, Arg1=<PyOleEmpty object>, Arg2=<PyOleEmpty
object>, Arg3=<PyOleEmpty object>, Arg4=<PyOleEmpty object>)
 |
 |  CentimetersToPoints(self, Centimeters=<PyOleEmpty object>)
 |
 |  ChangeFileOpenDirectory(self, Path=<PyOleEmpty object>)
 |
 |  CheckGrammar(self, String=<PyOleEmpty object>)

[snip]

The only thing is that you can't always build a proxy
module. I'm never quite sure why or why not. 

TJG	

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list