[python-win32] Using os.startfile() for automation
tony at tcapp.com
Fri Feb 4 01:46:00 CET 2011
Date: Thu, 3 Feb 2011 13:18:40 -0800
From: Tim Roberts <timr at probo.com>
To: Python-Win32 List <python-win32 at python.org>
Subject: Re: [python-win32] Using os.startfile() for automation
Message-ID: <4D4B1BB0.8070407 at probo.com>
Content-Type: text/plain; charset="ISO-8859-1"
>>Ah, so you're saying you CAN execute the second os.startfile, but the
>>application opens them both in the same instance?
>>However, it's still up to the application to decide whether it will
>>handle that in one instance or two.
When I use launch the app from Start -> All Program -> Program Folder ->
another instance opens. I guess I can just iterate over the list of files to
open, then launch a new instance for each file (within limits),
as opposed to using os.startfile()
>>owever, it would probably be smarter to see if the application can be
automated through COM.
I've tried using PyWin32's COM Browser but will only use COM as a last
resort. This app doesn't appear to be registered as a COM server.
I've had COM servers hang on me in the past, and since the app is written by
a 3rd party who wants $$ for support, I'll stay far away from COM.
>>That way, you're in complete control of the operation.
Only if the COM server is solid. Older versions of Excel can easily be
crashed via COM, although my app isn't Excel in this case.
>>Alternatively, you can use CreateProcess through the API to launch the
>>application. That way, you get a process handle that you can control.
This only helps me launch the app, I still need a way to manipulate the
menus, to start the File -> Save As ... step
> Once the application is open, I just want to use File Save As Text, to
> get the data into a text file.
> Python's app-automation capabilities are kinda weak and not well
> documented, so I may resort to AutoIt3.
>>That's a ridiculous complaint. Languages do not have "app automation
Scuze me. I should have said "The python automation packages" (pywinauto,
watsup, pywingui, etc) ...
One could argue whether AutoIt3 is a language or a framework, but its
existence is for automating other applications.
I'd much rather use python, but the api in pywinauto is maddening.
>>keystrokes using the API, exactly like you would if you were writing this
Well, I still wouldn't know how to do this in C, which is why I looked into
the python automation packages.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the python-win32