windows COMオブジェクトを操作する

win32allモジュールの中のwin32com.clientは、windowsのCOM(Component Object Model)オブジェクトを操作する拡張モジュール。
Python Win32 Extensions(win32all)
http://starship.python.net/crew/mhammond/win32/Downloads.html
コレを使うことでWSHのように、オートメーション機能を持ったCOMオブジェクトをPythonスクリプトから制御することができる。
IEExcelの作業を自動化するスクリプトなんかを書くときに便利。
(当然のことながらwin32comはwindows依存。)

>>> import win32com.client
>>> com = win32com.client.Dispatch("WScript.Shell")
>>> com.Run("notepad.exe")	#ノートパッド(メモ帳)の起動
0
    
参考:第5回 WshShellオブジェクトの詳細(1) http://www.atmarkit.co.jp/fwin2k/operation/wsh05/wsh05_01.html