drive a desktop app from python?

Ricardo Aráoz ricaraoz at gmail.com
Fri Jan 9 15:45:14 CET 2009


James Stroud wrote:
> Tim Arnold wrote:
>> Hi, I don't even know what to google for on this one. I need to drive
>> a commercial desktop app (on windows xp) since the app doesn't have a
>> batch interface.  It's intended to analyze one file at a time and
>> display a report.
>>
>> I can get the thing to write out the report an html browser, but I
>> have thousands of files I need it to analyze every night.
>>
>> Is there any lib or recipe(s) for doing something like this via python?
>
> You are a little thin on details here. My only advice at this point is
> to check out os.system, which is the simplest option. From there you
> can move to the popen2 module for greater control, but if you are
> talking about a gui app, you may run into hang-ups.
>
> A quick recipe would be the following pretend application that
> recursively descends from the current directory calling the utility
> named "dosapp" on every file it finds that ends with "jpg" (what
> "dosapp" does is left to your imagination):
>
>
>
> import os
>
> def doit(suffix, adir, filenames):
>   for afile in filenames:
>     if afile.endswith(suffix):
>       pathname = os.path.join(adir, afile)
>       os.system('dosapp %s' % pathname)
>
>
> top = '.'
> suffix = '.jpg'
>
> os.path.walk(top, doit, suffix)
>
>
> Read the docs on os.path.walk, of course.
>
> James
>
>
>From a search in my mail's lists :

http://www.openqa.org/pywinauto/
or
http://pywinauto.openqa.org/

http://wwwsearch.sourceforge.net/mechanize/

http://www.autoitscript.com/autoit3/
(see the COM server)

http://people.redhat.com/zcerza/dogtail/

HTH






More information about the Python-list mailing list