Re: embedded Python calling app via COM

2006-06-23 Thread Jim
> Pythoncom.GetActiveObject will retrieve the running instance of the app.

Thanks Roger, that does seem to do the trick.  I haven't tested to see
what happens if there are two instances of the app running, I'm hoping
it will return the frontmost visible one.

  -- Jim

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: embedded Python calling app via COM

2006-06-22 Thread Roger Upole

"Jim" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
>I have a C++ app which fires up a Python script using C API calls.
> That script operates the app via Automation calls, like this:
>
> from win32com.client import *
> from mywrapper import *
>
> myapp = Application()
> myapp.Visible = True
> mydoc = myapp.Documents.Open(...)
>
> My problem is to make sure the instance of myapp is the same one I am
> calling from.  The above code starts up a new instance of the app,
> which is not what I want.  In other words I need something like a
> GetObject instead of a CreateObject, and I need some way to identify
> the calling app so I can tell GetObject about it.
>
> Before I go and do something hack, I thought I'd see if anyone else is
> in this situation and knows a good way to do the job.
>
>  -- Jim

Pythoncom.GetActiveObject will retrieve the running instance of the app.
(assuming that it registers itself in the Running Object Table)

Roger





== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet 
News==
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 
Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
-- 
http://mail.python.org/mailman/listinfo/python-list


embedded Python calling app via COM

2006-06-21 Thread Jim
I have a C++ app which fires up a Python script using C API calls.
That script operates the app via Automation calls, like this:

from win32com.client import *
from mywrapper import *

myapp = Application()
myapp.Visible = True
mydoc = myapp.Documents.Open(...)

My problem is to make sure the instance of myapp is the same one I am
calling from.  The above code starts up a new instance of the app,
which is not what I want.  In other words I need something like a
GetObject instead of a CreateObject, and I need some way to identify
the calling app so I can tell GetObject about it.

Before I go and do something hack, I thought I'd see if anyone else is
in this situation and knows a good way to do the job.

  -- Jim

-- 
http://mail.python.org/mailman/listinfo/python-list