Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

interacting with gui-based programs

0 views
Skip to first unread message

Jeff

unread,
Feb 18, 2003, 4:52:03 PM2/18/03
to
I'd like to use Python to automate my interactions with graphical user
interfaces, such as those of Mozilla and Kazaa (running with Wine). Is
this possible? Are there libraries that can help with this kind of
thing?

Thanks much.

-Jeff

Dave Brueck

unread,
Feb 18, 2003, 6:28:26 PM2/18/03
to

Google for AutoIt. It's not Python, but it does have an Active/X
interface, which I'm using via Mark Hammond's win32com package. Not sure
how well any of that stuff works under Wine though.

Actually, if you go to Google groups you can search for AutoIt on c.l.py -
somebody mentioned it several months back and IIRC posted a snippet of
code on how to use it.

-Dave

Jeff

unread,
Feb 18, 2003, 11:45:17 PM2/18/03
to


Thanks for the reply. I must say, I'm surprised that the only way to
interact with the GUI of Mozilla and Kazaa running on Linux is using a
closed-source program (AutoIt). Do langauges other than Python have
modules that could be compiled and used with Python to interact with
these GUIs? What language could AutoIt be written in that is more
capable than Python?

Thanks.

-Jeff

Simon Brunning

unread,
Feb 19, 2003, 5:14:38 AM2/19/03
to
> From: bronze...@hotmail.com [SMTP:bronze...@hotmail.com]

> Thanks for the reply. I must say, I'm surprised that the only way to
> interact with the GUI of Mozilla and Kazaa running on Linux is using a
> closed-source program (AutoIt). Do langauges other than Python have
> modules that could be compiled and used with Python to interact with
> these GUIs? What language could AutoIt be written in that is more
> capable than Python?

On Windows, I am moving away from using AutoIt, in increasing driving GUIs
directly using Mark Hammond's win32gui module. It's pretty easy once you
have the hang of it. I can't work out how to get the text out of an edit
control, though...

Cheers,
Simon Brunning
TriSystems Ltd.
sbru...@trisystems.co.uk

-----------------------------------------------------------------------
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution, or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. TriSystems Ltd. cannot
accept liability for statements made which are clearly the senders own.

larrydalooza

unread,
Feb 19, 2003, 8:12:28 AM2/19/03
to
bronze...@hotmail.com (Jeff) wrote in message news:<ee9f3724.03021...@posting.google.com>...

AutoIt is written in C++ and is just sort of a wrapper for Windows API
functions. EnumWindows... EnumChildWindows... keyb_event...
SetWindowPos... and so forth. There is a DLL version also... What are
the Python capabilities of accessing Windows API? or DLLS?

Larry

Nicholas Wieland

unread,
Feb 19, 2003, 8:05:30 PM2/19/03
to
On Tue, 18 Feb 2003 20:45:17 -0800, Jeff wrote:

> Thanks for the reply. I must say, I'm surprised that the only way to
> interact with the GUI of Mozilla and Kazaa running on Linux is using a
> closed-source program (AutoIt). Do langauges other than Python have
> modules that could be compiled and used with Python to interact with
> these GUIs? What language could AutoIt be written in that is more
> capable than Python?

I remember someone recently posted on a mailing list (probably anygui.org)
a link to a sourceforge project, a GUI toolkit for using Python and XUL...
can't remember the URL, sorry, do a quick search through anygui.org ML of
February.

HTH,
Nicholas

Dave

unread,
Feb 20, 2003, 7:45:00 AM2/20/03
to
Simon Brunning <SBru...@trisystems.co.uk> wrote in message news:<mailman.1045649995...@python.org>...

> > From: bronze...@hotmail.com [SMTP:bronze...@hotmail.com]
> > Thanks for the reply. I must say, I'm surprised that the only way to
> > interact with the GUI of Mozilla and Kazaa running on Linux is using a
> > closed-source program (AutoIt). Do langauges other than Python have
> > modules that could be compiled and used with Python to interact with
> > these GUIs? What language could AutoIt be written in that is more
> > capable than Python?

I've had some success using Expect (which is based on TCL). It redirects
the tty of a shell session, both in and out, so that keystrokes from the
user may be scripted, and output parsed and analysed. In other words, to
script an interactive session.

If the GUI app is well equipped with shortcut keystrokes to menu items,
maybe this would in these cases too?. The advantage of going through the user
interface of the app is that it would work across platforms.

The good news is that there are a couple of Python implementations of
Expect. One (the one I happen to prefer) is pure Python, and the other
is a wrapper around the original. Do a Google for pyExpect or expectpy.
I can't remember which is which off the top of my head.

Hope this helps,

Dave.

Mike Meyer

unread,
Feb 20, 2003, 10:56:13 AM2/20/03
to
bronze...@hotmail.com (Jeff) writes:

This is one of the places where Windows beats Unix hands down. Windows
uses an interprocess communications mechanism to provide scripting,
which means you can control applications from any language that can do
IP, and can control multiple applications from one script. Unix tends
to provide scripting by embedding an interpreter in the application,
which means you can only use that language (ignoring GUILE for now),
and only control one application at a time.

Unix has the technology to do things the better way - for instnace, I
used CORBA - but until application vendors pick up on it, it won't do
you much good. You can read my white paper on the subject, including
examination of a CORBA-scriptable window manager, at <URL:
http://www.mired.org/home/mwm/scripting/ >.

<mike
--
Mike Meyer <m...@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

Cameron Laird

unread,
Feb 20, 2003, 12:45:17 PM2/20/03
to
In article <33b7435c.0302...@posting.google.com>,

Neither Kazaa nor Mozilla exposes a scripting interface?
I thought I knew differently, but I'm quite ignorant about
those two.

In any case, if you're truly reduced to record-and-playback,
study Android <URL: http://wiki.tcl.tk/android >.

I *am* expert with Expect and its descendants, but I don't
get the connection to Mozilla. That must reflect how little
I know about Mozilla.
--

Cameron Laird <Cam...@Lairds.com>
Business: http://www.Phaseit.net
Personal: http://phaseit.net/claird/home.html

Kirk Strauser

unread,
Feb 20, 2003, 7:00:05 PM2/20/03
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

At 2003-02-20T15:56:13Z, Mike Meyer <m...@mired.org> writes:

> This is one of the places where Windows beats Unix hands down.

It's also one of the very few things I miss about AmigaOS. Almost every
non-trivial Amiga program had an AREXX (Amiga's REXX variant) IPC port. I
once wrote a little AREXX script that pulled status information from a GUI
FTP client, and use that to tell a graphics program how far across the
screen to render a fractal lighting bolt. As the transfer neared
completion, the lightning bolt neared the ground. When the transfer was
finished, a sound player played a thunderclap. I think the whole program
was less than 40-50 lines.
- --
Kirk Strauser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+VWob5sRg+Y0CpvERAjWkAJ9Xqyf/O+EjkSMXpTPV1+ebxZvXNwCeJusV
jTdYDbr+RLbESDzlD5dkr8w=
=ntdV
-----END PGP SIGNATURE-----

Mike Meyer

unread,
Feb 21, 2003, 11:02:25 AM2/21/03
to
Dennis Lee Bieber <wlf...@ix.netcom.com> writes:
> Mike Meyer fed this fish to the penguins on Thursday 20 February 2003
> 07:56 am:

> > This is one of the places where Windows beats Unix hands down. Windows
> > uses an interprocess communications mechanism to provide scripting,
> > which means you can control applications from any language that can do
> > IP, and can control multiple applications from one script. Unix tends
> > to provide scripting by embedding an interpreter in the application,
> > which means you can only use that language (ignoring GUILE for now),
> > and only control one application at a time.
> And, IMHO, the Amiga beat them all -- since ARexx built its command
> address system on top of the OS IPC message ports.

We're way off topic here. Building on top of the OS IPC mechanism is
only half the story. I'm not familiar enough with COM/DOM/etc. to know
whether or not it's built on a similar OS mechanism, or if that's what
makes the ARexx better than it. However, CORBA is built on top of
TCP/IP on Unix systems. What makes the ARexx better than CORBA is that
ARexx was bundled with the OS, which helped drive applications vendors
to support it.

> > Unix has the technology to do things the better way - for instnace, I
> > used CORBA - but until application vendors pick up on it, it won't do
> > you much good. You can read my white paper on the subject, including

> Unfortunately, that also applies to IBM's Linux version of ORexx --
> while the language handles multiple command addresses with no problem,
> the other applications would have to be written to register the
> address/port with the ORexx system:

I don't have much hope for anything ever showing up in the Unix
community. Before you'll get any significant support from application
vendors, you have to have system vendors agreeing on a single
mechanism - whether it's CORBA, ORexx messages, or something else.
That just doesn't seem likely, as we already have three radically
different high-level IP mechanisms competing.

Alex Martelli

unread,
Feb 21, 2003, 5:08:32 PM2/21/03
to
Mike Meyer wrote:
...

> We're way off topic here. Building on top of the OS IPC mechanism is
> only half the story. I'm not familiar enough with COM/DOM/etc. to know
> whether or not it's built on a similar OS mechanism, or if that's what
> makes the ARexx better than it. However, CORBA is built on top of
> TCP/IP on Unix systems. What makes the ARexx better than CORBA is that
> ARexx was bundled with the OS, which helped drive applications vendors
> to support it.

Same for COM: the best thing about it is that just everybody more
or less HAS to support it. Alas, you're right that anything of
the kind is very unlikely to emerge within Unix/Linux/BSD/etc: too
much fragmentation will reduce usefulness of any such technology.


Alex

Mike Meyer

unread,
Feb 22, 2003, 7:34:13 PM2/22/03
to
Dennis Lee Bieber <wlf...@ix.netcom.com> writes:

> Mike Meyer fed this fish to the penguins on Friday 21 February 2003
> 08:02 am:
> Well, I think my intended point (the mind goes after a few
> days) was that REXX itself had that concept built into the language,
> and AREXX was able to use it with practically no change.

CORBA (and COM) are distributed objects. Python has objects built
right in, so you can script applications that are CORBA (or COM)
enabled with no change to the language. If you set it up right, you
just import a module, then start controlling the application with the
objects that came with the module.

> <heh> If memory serves, Irmen actually had an ARexx port added to
> AmigaPython <G>

Yup. You could control ARexx-controllable applications (meaning almost
all of them) from Python. I put one in my Scheme->C port as well. None
of those were as lightweight as ARexx, though.

Irmen de Jong

unread,
Feb 22, 2003, 8:22:21 PM2/22/03
to
Mike Meyer wrote:

>> <heh> If memory serves, Irmen actually had an ARexx port added to
>>AmigaPython <G>
>
>
> Yup. You could control ARexx-controllable applications (meaning almost
> all of them) from Python.

Even more interesting, AmigaPython can run as an Arexx Host, meaning
that every Arexx capable application can also control AmigaPython
trough an Arexx port. This way you could do *very* powerful things
from Arexx scripts, because stuff like network access could be
done by AmigaPython and you call it from your Arexx script.


Irmen de Jong


Mike Meyer

unread,
Feb 23, 2003, 11:55:36 AM2/23/03
to

Scheme->C did that as well. Well, not the network access. What I loved
was adding Rexx scripts to mg to ship functions to a running Scheme->C
interpreter. Hmm. I wonder what it would take to get emacs python-mode
to send a function to the python interpreter buffer?

crib...@mail.inet.com.br

unread,
Feb 23, 2003, 11:31:35 AM2/23/03
to
> Mike Meyer fed this fish to the penguins on Saturday 22 February 2003
> 04:34 pm:
> Ah well, I don't mean to sound like ARexx is the be-all/end-all
> of
> languages... Just a case of reminiscing; for something available in
> 1990, on a machine that most folks ignored as a toy, it was a very
> powerful system. Sorry to drag this out...

But the Amiga was positioned as a toy since the beginning. There was a
belief at the time that personal computers were going to be the next big
thing at *home*. But the office market exploded first, and IBM was better
positioned at that. BTW, that's all a question of perception, not reality,
because in theory the Amiga could have been positioned differently... but
I doubt that the professional market would buy a machine that supported
multimedia at *that* time. Managers would then worry about what would
employees do - play games, listen to music... that was before the 'Net
btw... now they have different stuff to worry about.


Carlos Ribeiro
crib...@mail.inet.com.br

Noah

unread,
Feb 25, 2003, 2:41:31 AM2/25/03
to
google...@thuswise.com (Dave) wrote in message news:<33b7435c.0302...@posting.google.com>...

>
> I've had some success using Expect (which is based on TCL). It redirects
> the tty of a shell session, both in and out, so that keystrokes from the
> user may be scripted, and output parsed and analysed. In other words, to
> script an interactive session.
> ...

> The good news is that there are a couple of Python implementations of
> Expect. One (the one I happen to prefer) is pure Python, and the other
> is a wrapper around the original. Do a Google for pyExpect or expectpy.
> I can't remember which is which off the top of my head.

Yeah, Google for PEXPECT -- I know because I wrote it :-)
(with lots of good input and bug fixes from many users)

Go here to find it:
http://pexpect.sourceforge.net/

I totally respect Don Libes' Expect, but I'm
sooo glad that I don't have to mess with TCL anymore.

This sort of thing always struck me as 1980's technology, but
I'm always amazed how it comes in handy.

Yours,
Noah

Justin Sheehy

unread,
Mar 10, 2003, 10:00:59 AM3/10/03
to
Mike Meyer <m...@mired.org> writes:

> I wonder what it would take to get emacs python-mode
> to send a function to the python interpreter buffer?

It would take about two or three keystrokes.

Use M-C-x, C-c |, or C-c C-c depending on how much you want to send.

Use C-h m to see the mode documentation.

-Justin


0 new messages