473,396 Members | 1,789 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,396 software developers and data experts.

using an already running COM object with Dispatch

Greetings.

with the following code,

olApp = Dispatch("Outlook.Application")

I am capable of getting a new instance of Outlook running. I would
like to be able to use the instance that is already running, if exists,
otherwise open a new one.

Has anyone being able to do this?

Aug 4 '06 #1
2 2973
"jiccab" <ji****@gmail.comwrote in message news:11**********************@75g2000cwc.googlegro ups.com...
Greetings.

with the following code,

olApp = Dispatch("Outlook.Application")

I am capable of getting a new instance of Outlook running. I would
like to be able to use the instance that is already running, if exists,
otherwise open a new one.

Has anyone being able to do this?
You should be able to use
win32com.client.GetActiveObject('outlook.applicati on')
and fall back to a normal Dispatch if it fails.

Roger
Aug 6 '06 #2

Roger Upole wrote:
"jiccab" <ji****@gmail.comwrote in message news:11**********************@75g2000cwc.googlegro ups.com...
Greetings.

with the following code,

olApp = Dispatch("Outlook.Application")

I am capable of getting a new instance of Outlook running. I would
like to be able to use the instance that is already running, if exists,
otherwise open a new one.

Has anyone being able to do this?

You should be able to use
win32com.client.GetActiveObject('outlook.applicati on')
and fall back to a normal Dispatch if it fails.

Roger
Yes indeed. Thanks. here is the code:

from win32com.client.dynamic import Dispatch
from win32com.client import GetActiveObject

def OutlookPointer():
try:
olApp = GetActiveObject("Outlook.Application")
except:
olApp = Dispatch("Outlook.Application")
return olApp

op = OutlookPointer()

Aug 11 '06 #3

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

Similar topics

0
by: mb3242 | last post by:
Hello, I'm trying to use win32com to call a method in a COM object. I'm having a problem with Python choosing the wrong type when wrapping up lists into VARIANTs. The function I'm trying to call...
6
by: zeroWePutTheSpamIntoTheBintype | last post by:
I'm having trouble using Braid (my user-defined type) objects returned from functions. I've got: Braid descend_n(int n, int no_strings) This function needs to use void left_multiply(Braid&b)....
1
by: virajajgaonkar | last post by:
Hello All, My aim is to have a MFC application which takes two word file names as input. Then it opens these two word files in ms word apllication windows for comparing side by side with...
1
by: MAF | last post by:
Is there anyway that I can find out what object called another object? ObjectABase ObjectA inherits from ObjectABase objectA calls objectB I want to invoke a method in ObjectABase?
8
by: mike2036 | last post by:
I have an application (that has unmanaged code) and when I launch it without 'FullTrust' permissions (LocalIntranet_Zone), it crashes. When I set 'FullTrust' permissions, it launches fine. Is...
5
by: eicwo01 | last post by:
Without to know the names, is it possible to dump all attributes of a com object? from win32com.adsi import * objDom = ADsOpenObject("LDAP:/ ... print ???"all attributes"??? of objDom Thanks...
3
by: Tigera | last post by:
Greetings, I too have succumbed to the perhaps foolish urge to write a video game, and I have been struggling with the implementation of multiple dispatch. I read through "More Effective C++"...
6
by: asincero | last post by:
Which is better: using an if/else construct to simulate a C switch or use a dictionary? Example: def foo(): if c == 1: doCase1() elif c == 2: doCase2() elif c == 3: doCase3()
1
by: learning | last post by:
Hi how can I instaltiate a class and call its method. the class has non default constructor. all examples i see only with class of defatul constructor. I am trying to pull the unit test out from...
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: 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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.