As we discussed previously, automation objects are COM objects that
expose methods and properties using the IDispatch interface. So how do
we use these objects from Python? The win32com.client package contains
a number of modules to provide access to automation objects. This
package supports both late and early bindings, as we will discuss.
To use an IDispatch-based COM object, use the method
win32com.client.Dispatch(). This method takes as its first parameter
the ProgID or CLSID of the object you wish to create. If you read the
documentation for Microsoft Excel, you'll find the ProgID for Excel is
Excel.Application, so to create an object that interfaces to Excel,
use the following code:
The WSript.Shell object provides functions to read system information
and environment variables, work with the registry and manage
shortcuts.
(from: 12)
一些引用:
(来自this)
相关问题 更多 >
编程相关推荐