G
goermezer
Hello,
I got it ! There was an example (for Office I think) in the test-directory of
Pywin32, where I have the first lines from. But this is dynamic binding. Can
anybody explain this for early binding ?
And it would be fine when the pulldown-menu in Pythonwin works to see the
exposed Methods of the Type Libraries.
-----------------------------------------------------------
import win32com.client
dispatch = win32com.client.dynamic._GetGoodDispatch("CATIA.Application")
typeinfo = dispatch.GetTypeInfo()
attr = typeinfo.GetTypeAttr()
olerepr = win32com.client.build.DispatchItem(typeinfo, attr, None, 0)
catia = win32com.client.dynamic.CDispatch(dispatch, olerepr)
dispatch = typeinfo = attr = olerepr = None
doc = catia.ActiveDocument.Product
print "------------------"
print "Number : Partname:"
print "------------------"
count = catia.ActiveDocument.Product.Products.Count
for partnum in range(count):
print "Part", partnum + 1, ":",
catia.ActiveDocument.Product.Products.Item(partnum+1).Name
I got it ! There was an example (for Office I think) in the test-directory of
Pywin32, where I have the first lines from. But this is dynamic binding. Can
anybody explain this for early binding ?
And it would be fine when the pulldown-menu in Pythonwin works to see the
exposed Methods of the Type Libraries.
-----------------------------------------------------------
import win32com.client
dispatch = win32com.client.dynamic._GetGoodDispatch("CATIA.Application")
typeinfo = dispatch.GetTypeInfo()
attr = typeinfo.GetTypeAttr()
olerepr = win32com.client.build.DispatchItem(typeinfo, attr, None, 0)
catia = win32com.client.dynamic.CDispatch(dispatch, olerepr)
dispatch = typeinfo = attr = olerepr = None
doc = catia.ActiveDocument.Product
print "------------------"
print "Number : Partname:"
print "------------------"
count = catia.ActiveDocument.Product.Products.Count
for partnum in range(count):
print "Part", partnum + 1, ":",
catia.ActiveDocument.Product.Products.Item(partnum+1).Name