drive a desktop app from python?

T

Tim Arnold

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?

thanks,
--Tim Arnold
 
J

James Stroud

Tim said:
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


--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com
 
A

Ant

Is there any lib or recipe(s) for doing something like this via python?

Look into the PyWin32 extension module. It gives access to Windows
internals including the COM interface. You'll need to do some research
into how to automate the GUI you're using from other sources (there
are often VBA examples on the web that can be modified).

http://pywin32.sourceforge.net/

I've successfully used this in the past for automating MS Excel.
 
R

Ricardo Aráoz

James said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,808
Messages
2,569,685
Members
45,450
Latest member
EileenShol

Latest Threads

Top