How to use python to automate installation of non-python programs?

David Bolen db3l at fitlinxx.com
Wed Aug 1 20:13:30 EDT 2001


bevans at wested.org (Bela Evans) writes:

> What I'm thinking would be needed is a kind of keyboard and mouse
> entry macro recorder.  For example, on 1st screen of install program,
> press enter, 2nd screen, click on customize button, etc.  The python
> script would need to focus attention on the install program window and
> send keystrokes and mouse clicks to it.  Anyone have experience with
> this?  Any pointers to which modules I should look at?  Or is there a
> better way to run through install programs?

You should be able to automate your way with FindWindow/SendMessage
and a few other Win32 API functions that are wrapped by the win32all
package, but to be honest, it's probably easier to just use an
existing macro utility.

There are some commercial ones, but there is also Scriptit (Microsoft,
not sure of URL) and AutoIt (http://www.hiddensoft.com/AutoIt), the
latter of which we use.  It's a separate executable, but we have
Python scripts that dynamically write the AutoIt scripts and then run
AutoIt on them via popen().  Works just fine for those cases where
there's no other convenient API.

Any GUI automation is a little risky in case something goes wrong or
the GUI becomes ambiguous, so you have to look at specific cases that
you need to automate.  And some things are annoyingly un-automatable,
such as when you find VB apps that have no window text that you can
search for or key off of.

I had communicated with the AutoIt author a while back offering to
write a Python wrapper if he'd expose source but he declined.  He was
in theory going to provide a DLL (which could be wrapped without
source) with his new C++ rewrite version but I haven't seen that
released yet.  AutoIt does have an ActiveX control, so if you don't
mind ensuring it's registered, you should be able to automate it
through win32com.

But even as a standalone it works just fine for what we needed.

--
-- David
-- 
/-----------------------------------------------------------------------\
 \               David Bolen            \   E-mail: db3l at fitlinxx.com  /
  |             FitLinxx, Inc.            \  Phone: (203) 708-5192    |
 /  860 Canal Street, Stamford, CT  06902   \  Fax: (203) 316-5150     \
\-----------------------------------------------------------------------/



More information about the Python-list mailing list