==Python Win32 Extensions==
[[Python][COM]]
===Links===
=====Official=====
===はじめに===
*Excelを立ち上げてワークブックを追加してセルにHello.
>>> >>> import win32com.client >>> >>> o = win32com.client.Dispatch("Excel.Application") >>> >>> o.Visible = 1 >>> >>> o.Workbooks.Add() <<COMObject Add>> >>> >>> o.Cells(1,1).Value = "Hello"
==COM の仕様を確認する方法==
====Shell.Application の使用例====
*Shell.Application SetTime()を呼び出す。日付と時刻のプロパティをを表示
>>> >>> import win32com.client >>> >>> sh = win32com.client.Dispatch('Shell.Application') >>> >>> sh.SetTime()
[[File:1069_py_win32com03.jpg]]
==例==
[[WshShell]]
===WScript.Network===
====プリンタを列挙====
[[File:1065_py_win32com_wsh_net03.jpg]]
=====実行=====
>>> >>> import win32com.client >>> >>> wsh = win32com.client.Dispatch('WScript.Network') >>> >>> printers = wsh.EnumPrinterConnections() >>> >>> for i in range(0, printers.Count(), 1):
... print printers[i]
...