[python-win32] Calling (D)COM Server from another PC
Tim Golden
tim.golden at viacom-outdoor.co.uk
Mon Jun 21 03:18:32 EDT 2004
| Hello together,
| this question might be foolish, but after quite some search I
| could not find
| how to make use of DCOM with the current win32com package.
| I tested out the DispatchEx which takes as its second
| parameter a 'machine',
| probably either the hostname or the IP. I tried to invoke
| methods of the
| Internet Explorer on other PCs in the network, and actually
| it worked (no
| exception thrown), but on the target machine no changes could be seen
| (IE.Visible=1 would make a IE Window visible but it didn't do
| anything on
| the other pc).
| So does someone of you know how to make use of DCOM, ie
| calling COM or OLE
| objects on other PCs.
Certainly DispatchEx works ok for automating via
DCOM. However, I don't know what's defined for how
visible the thing is on the other machine's desktop.
For example, the following code will correctly create
a new Excel Workbook, put 5 in its top-left cell and
save it on the other machine's disk:
<code>
import win32com.client
xl = win32com.client.DispatchEx ("Excel.Application", "VOGBP200")
#
# Otherwise it may popup an "Are you sure?"
# dialog box -- which you won't see and
# can't respond to!
#
xl.DisplayAlerts = 0
ws = xl.Workbooks.Add ().ActiveSheet
ws.Cells (1, 1).Value = 5
xl.ActiveWorkbook.SaveAs ("temp.xls")
xl.Quit ()
</code>
Now, I tried putting a "Visible = 1" in and nothing
happened, so I'm guessing that -- since DCOM's not
really intended to be a LanDesk / NetOp sort of
thing -- that you can't make remote apps Visible.
But I'm guessing.
TJG
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
More information about the Python-win32
mailing list