how to use Dispatch to open an application in win32com.client

Tim Golden mail at timgolden.me.uk
Thu May 3 04:56:47 EDT 2007


Peter Fischer wrote:
> Thank you for your answer. I just tried, but it didn't work. The reason seems to
> be that Google Earth prevents a second instance to run on the same machine.
> Maybe for licensing reasons (do you know whether it is legal to bypass this
> and how to do this?). 

Don't know, but common sense tells me it's not a good idea!

> However, now I will try to run the two instances on separate machines 
 > and to synchronize them via network. Do you know how to 
start a second
instance  on a second machine over the network in python/COM 
(DCOM)?
Is this possible directly with the win32com
> package in python or do I have to install an additional package?

Well, funnily enough, you use exactly the same call, but
with a machine name on the end:

<code>
import win32com.client

xl = win32com.client.DispatchEx (
   "Excel.Application",
   "other_machine"
)

</code>

The trouble now is that, to use COM/DCOM effectively,
you really need to know what to do, not just be a
dabbler like me. On a recent thread, Alex Martelli
recommended Don Box's "Essential COM" which I've
noted down but haven't read:

http://groups.google.com/group/comp.lang.python/msg/f95a2d51b6e84091?hl=en&

That said, this is Python so even without using DCOM
directly, you have a whole slew of across-the-network
possibilities for interacting between apps on two
machines. Just ask this list and sit back and wait
for the variety of replies!

TJG



More information about the Python-list mailing list