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

Gabriel Genellina gagsl-py at yahoo.com.ar
Fri Feb 16 23:56:49 EST 2007


En Fri, 16 Feb 2007 23:36:26 -0300, vithi <vithi99 at hotmail.com> escribió:

> I am trying to launch an application. When I try like that
> When I try like that Excel is opening
> import win32com.client
> object = win32com.client.Dispatch("Excel.Application")
> object.Visible = 1
>
> But when I try my application which is QeepIt.exe
> which is in the c:\ drive it is not running
> Any body tell me how to give path to open an exectable application in
> Dispatch modules
> I try like that
> object = win32com.client.Dispatch("c:\Folder\QeepIt.exe")
> It give an error.

The above code is used to launch a COM server registered under the name  
"Excel.Application" and then control it. If you don't know what a COM  
server is, surely your application can't be used this way.

For launching another program, perhaps sending it some text, and capturing  
its output, look at the subprocess module. If you are only interested in  
executing it, with no additional communication, os.system() may be enough.

-- 
Gabriel Genellina




More information about the Python-list mailing list