如何使用Python编写一个OLE组件的脚本?

时间:2022-01-21 20:23:29

I would like to use Python to script an application that advertises itself as providing an OLE component. How should I get started?

我希望使用Python来编写一个应用程序的脚本,该应用程序自称提供了一个OLE组件。我该怎么开始呢?

I don't yet know what methods I need to call on the COMponents I will be accessing. Should I use win32com to load those components, and then start pressing 'tab' in IPython?

我还不知道需要对将要访问的组件调用什么方法。我是否应该使用win32com来加载这些组件,然后开始在IPython中按“tab”?

5 个解决方案

#1


3  

You can find an example on this website. OLE and is related to COM and ActiveX so you should look out for those terms. Do you have access this book from O'Reilly - Python Programming on Win32?

你可以在这个网站上找到一个例子。OLE与COM和ActiveX相关,所以你应该留意这些术语。你能从Win32上的O'Reilly - Python编程中访问这本书吗?

There is also a Python Win32 mailing list.

还有一个Python Win32邮件列表。

#2


2  

You need the win32com package. Some examples:

你需要win32com软件包。一些例子:

from win32com.client.dynamic import Dispatch

# Excel
excel = Dispatch('Excel.Application')

# Vim
vim = Dispatch('Vim.Application')

And then call whatever you like on them.

然后给他们打电话。

#3


2  

win32com is a good package to use if you want to use the IDispatch interface to control your objects (slow). comtypes is a better, native python, package that uses the raw COM approach to talking to your controls. WxPython uses comtypes to give you an ActiveX container window from Python ... sweet.

如果您想使用IDispatch接口来控制对象(速度很慢),那么win32com是一个很好的软件包。comtype是一个更好的本地python包,它使用原始COM方法与控件进行通信。WxPython使用comtypes为您提供来自Python的ActiveX容器窗口…甜的。

#4


0  

Please take a look at the python-win32 package, and, in particular, at its win32com API.

请查看python-win32包,特别是它的win32com API。

#5


0  

PythonWin (http://sourceforge.net/projects/pywin32/), bundled with python-win32, comes with its own COM browser as part of its shell and debugging environment.

与python-win32绑定的PythonWin (http://sourceforge.net/projects/pywin32/)自带COM浏览器,作为shell和调试环境的一部分。

#1


3  

You can find an example on this website. OLE and is related to COM and ActiveX so you should look out for those terms. Do you have access this book from O'Reilly - Python Programming on Win32?

你可以在这个网站上找到一个例子。OLE与COM和ActiveX相关,所以你应该留意这些术语。你能从Win32上的O'Reilly - Python编程中访问这本书吗?

There is also a Python Win32 mailing list.

还有一个Python Win32邮件列表。

#2


2  

You need the win32com package. Some examples:

你需要win32com软件包。一些例子:

from win32com.client.dynamic import Dispatch

# Excel
excel = Dispatch('Excel.Application')

# Vim
vim = Dispatch('Vim.Application')

And then call whatever you like on them.

然后给他们打电话。

#3


2  

win32com is a good package to use if you want to use the IDispatch interface to control your objects (slow). comtypes is a better, native python, package that uses the raw COM approach to talking to your controls. WxPython uses comtypes to give you an ActiveX container window from Python ... sweet.

如果您想使用IDispatch接口来控制对象(速度很慢),那么win32com是一个很好的软件包。comtype是一个更好的本地python包,它使用原始COM方法与控件进行通信。WxPython使用comtypes为您提供来自Python的ActiveX容器窗口…甜的。

#4


0  

Please take a look at the python-win32 package, and, in particular, at its win32com API.

请查看python-win32包,特别是它的win32com API。

#5


0  

PythonWin (http://sourceforge.net/projects/pywin32/), bundled with python-win32, comes with its own COM browser as part of its shell and debugging environment.

与python-win32绑定的PythonWin (http://sourceforge.net/projects/pywin32/)自带COM浏览器,作为shell和调试环境的一部分。