473,385 Members | 1,661 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Launching multiple instances of a program with win32com.client.Dispatch?

Hi there, I am trying to launch a program called AmiBroker using the
command:

AB = win32com.client.Dispatch("Broker.Application")

However, I have a dual-core CPU and would like to launch two instances
of AmiBroker. I know it is possible to run two instances simultaneously
since it is easy to do manually by double-clicking the AmiBroker.exe
file twice. However, when I write two lines of code like this:

AB = win32com.client.Dispatch("Broker.Application")
AB2 = win32com.client.Dispatch("Broker.Application")

and proceed to address these objects, they interfere with each other
since both AB and AB2 are "grabbing" the same instance of AmiBroker. If
I try to run two separate Python scripts, each one containing a
"win32com.client.Dispatch("Broker.Application" )" comand, the same
problem happens (where even though the objects are named differently,
they do not each launch an instance of the program; the first one
launches it and the second one just "grabs" it).

Does anyone know how to force two separate program launches rather than
having both Dispatch commands access the same object? I would be
incredibly thankful to anyone who could offer some help with this.

Thank you very much,

Tyler

Jul 7 '06 #1
3 6878
win32com.client.DispatchEx should create a new instance.

Roger

<ty*************@gmail.comwrote in message news:11**********************@s26g2000cwa.googlegr oups.com...
Hi there, I am trying to launch a program called AmiBroker using the
command:

AB = win32com.client.Dispatch("Broker.Application")

However, I have a dual-core CPU and would like to launch two instances
of AmiBroker. I know it is possible to run two instances simultaneously
since it is easy to do manually by double-clicking the AmiBroker.exe
file twice. However, when I write two lines of code like this:

AB = win32com.client.Dispatch("Broker.Application")
AB2 = win32com.client.Dispatch("Broker.Application")

and proceed to address these objects, they interfere with each other
since both AB and AB2 are "grabbing" the same instance of AmiBroker. If
I try to run two separate Python scripts, each one containing a
"win32com.client.Dispatch("Broker.Application" )" comand, the same
problem happens (where even though the objects are named differently,
they do not each launch an instance of the program; the first one
launches it and the second one just "grabs" it).

Does anyone know how to force two separate program launches rather than
having both Dispatch commands access the same object? I would be
incredibly thankful to anyone who could offer some help with this.

Thank you very much,

Tyler

Jul 7 '06 #2
Hi Roger,

Thanks for the response, but DispatchEx seems to do the exact same
thing as Dispatch in my case; there is still only one processID and one
instance of my program (I forgot to mention that I also need two unique
processID's to keep track of them).

I have also tried:

###

AB1 =
pythoncom.CoCreateInstance("Broker.Application",No ne,pythoncom.CLSCTX_SERVER,pythoncom.IID_IDispatch )

AB2 =
pythoncom.CoCreateInstance("Broker.Application",No ne,pythoncom.CLSCTX_SERVER,pythoncom.IID_IDispatch )

win32com.client.Dispatch(AB1)
win32com.client.Dispatch(AB2)

###

That also seems to do the exact same thing.

Any other ideas of things I might try?

Roger Upole wrote:
win32com.client.DispatchEx should create a new instance.

Roger

<ty*************@gmail.comwrote in message news:11**********************@s26g2000cwa.googlegr oups.com...
Hi there, I am trying to launch a program called AmiBroker using the
command:

AB = win32com.client.Dispatch("Broker.Application")

However, I have a dual-core CPU and would like to launch two instances
of AmiBroker. I know it is possible to run two instances simultaneously
since it is easy to do manually by double-clicking the AmiBroker.exe
file twice. However, when I write two lines of code like this:

AB = win32com.client.Dispatch("Broker.Application")
AB2 = win32com.client.Dispatch("Broker.Application")

and proceed to address these objects, they interfere with each other
since both AB and AB2 are "grabbing" the same instance of AmiBroker. If
I try to run two separate Python scripts, each one containing a
"win32com.client.Dispatch("Broker.Application" )" comand, the same
problem happens (where even though the objects are named differently,
they do not each launch an instance of the program; the first one
launches it and the second one just "grabs" it).

Does anyone know how to force two separate program launches rather than
having both Dispatch commands access the same object? I would be
incredibly thankful to anyone who could offer some help with this.

Thank you very much,

Tyler
Jul 7 '06 #3
Bump...not sure if it's bad etiquette here, I apologize if it is.
ty*************@gmail.com wrote:
Hi Roger,

Thanks for the response, but DispatchEx seems to do the exact same
thing as Dispatch in my case; there is still only one processID and one
instance of my program (I forgot to mention that I also need two unique
processID's to keep track of them).

I have also tried:

###

AB1 =
pythoncom.CoCreateInstance("Broker.Application",No ne,pythoncom.CLSCTX_SERVER,pythoncom.IID_IDispatch )

AB2 =
pythoncom.CoCreateInstance("Broker.Application",No ne,pythoncom.CLSCTX_SERVER,pythoncom.IID_IDispatch )

win32com.client.Dispatch(AB1)
win32com.client.Dispatch(AB2)

###

That also seems to do the exact same thing.

Any other ideas of things I might try?

Roger Upole wrote:
win32com.client.DispatchEx should create a new instance.

Roger

<ty*************@gmail.comwrote in message news:11**********************@s26g2000cwa.googlegr oups.com...
Hi there, I am trying to launch a program called AmiBroker using the
command:
>
AB = win32com.client.Dispatch("Broker.Application")
>
However, I have a dual-core CPU and would like to launch two instances
of AmiBroker. I know it is possible to run two instances simultaneously
since it is easy to do manually by double-clicking the AmiBroker.exe
file twice. However, when I write two lines of code like this:
>
AB = win32com.client.Dispatch("Broker.Application")
AB2 = win32com.client.Dispatch("Broker.Application")
>
and proceed to address these objects, they interfere with each other
since both AB and AB2 are "grabbing" the same instance of AmiBroker. If
I try to run two separate Python scripts, each one containing a
"win32com.client.Dispatch("Broker.Application" )" comand, the same
problem happens (where even though the objects are named differently,
they do not each launch an instance of the program; the first one
launches it and the second one just "grabs" it).
>
Does anyone know how to force two separate program launches rather than
having both Dispatch commands access the same object? I would be
incredibly thankful to anyone who could offer some help with this.
>
Thank you very much,
>
Tyler
>
Jul 8 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: gcash | last post by:
Most folks know you can start up an instance of Internet Explorer by saying "x=win32com.client.Dispatch('InternetExplorer.Application.1')" and you get a WIN32 object with a "Document" object that...
0
by: Hung Jung Lu | last post by:
Hi, I try win32com.client.Dispatch('InternetExplorer.Application'), and it returns an instance of the running IE object. If there are multiple instances of IE running, how can I make sure I get...
3
by: RJ | last post by:
Hi, I've been going over the Quick Start to Client side COM and Python and many other sources, but cannot find an example that will get my com/ActiveX .ocx USB device driver imported. The Excel...
0
by: Paul McGuire | last post by:
Software versions: Python - 2.3.3 win32all extensions - build 163 OS- Win2000 SP4 I am having trouble in accessing a customer's proprietary COM type library. After running makepy against the...
1
by: Patrick | last post by:
I am investigating a web-based app wherein I wanted to provide html form frontends to an Excel spreadsheet sitting on a MS Windows server; with each authenticated HTTP user having thier own...
12
by: Chris Curvey | last post by:
I need to create a set of IE instances that have different sets of session cookies. I thought that using the win32com.DispatchEx function would do this, but it doesn't seem to. In other words ...
4
by: mirandacascade | last post by:
O/S : Win2K vsn of Python: 2.4 Hoping to find information that provide information about error messages being encountered. Pythonwin session: Traceback (most recent call last): File...
2
by: Ray | last post by:
Hi, I need to use cell's background color. when I record a macro from excel, it shows: Rows("7:7").Select With Selection.Interior .ColorIndex = 8 .Pattern = xlSolid
4
by: sterling | last post by:
I'm curious as to why the difference between IDLE and pythonWin when using win32com. opening an excel file, i've attempted to grab the chart information out of the file. commands like co =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.