K
K
ks_ks2010-10-10 09:36:15
Component Object Model
ks_ks, 2010-10-10 09:36:15

Python and COM objects?

1
Run in PythonWin -\u003e Tools -\u003e COM Browser -\u003e
look at the name of the library of interest to us in "Registered Type Libraries" - \u003e
run python.exe -\u003e

&gt;&gt;&gt; import win32com.client.makepy as makepy<br/>
&gt;&gt;&gt; makepy.ShowInfo('название интересующей нас библиотеки, которое мы нашли в Registered Type Libraries')

--> hooray! it will generate a module for us, which will place in a special folder <module 'win32com.gen_py.module-name-from-a-large-number-of-letters-and-numbers' from 'C:\Python26\lib\site-packages\win32com\gen_py\ module-name-from-large-letters-and-numbers'>
And this module, with a huge, non-importable name, will actually appear in that folder - .../gen_py
And the question is this. What can be done with this module next? And, accordingly, how?
2
Using win32com.client.Dispatch('name-of-something') we can access the interfaces that are specified in the specifications. And do with them what is indicated there.
However, if we do not know the “name-of-this-something” - how to find and use what a running and operating COM object server allows us to do?
Interested specifically - how to access the interfaces?
In fact, both questions are about the same thing - I’ve been trying to do something for two days, but I haven’t got the idea yet.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tzlom, 2010-10-10
@tzlom

can just read what is written in the module with an unreadable name?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question