win32com: how to connect to a specific instance of a running object?
ago
xivulon at gmail.com
Fri Jun 2 10:57:33 EDT 2006
The other approach I tried (as suggested by Tim, thanks) involves
browsing the ROT.
import pythoncom
SPREADSHEET_NAME = r'\MySpreadsheet.xls'
lenstr = len(SPREADSHEET_NAME)
obj = None
rot = pythoncom.GetRunningObjectTable()
rotenum = rot.EnumRunning()
while True:
monikers = rotenum.Next()
if not monikers: break
ctx = pythoncom.CreateBindCtx(0)
name = monikers[0].GetDisplayName(ctx, None);
if name[-lenstr:] == SPREADSHEET_NAME:
obj = rot.GetObject(monikers[0])
break
The obj I get is a PyIUnknown... How do I use it?
More information about the Python-list
mailing list