The XMacro package contains two simple, C programs (xmacrorec and xmacroplay) for recording and replaying keyboard and mouse events on an X server. This functionality is achieved through the XTest extension. (BTW it would be better to use the XTrap extension but it's not widespread in precompiled X servers…) The programs are heavily based on the xremote utility of Jan Ekholm (chakie at infa.abo.fi).

The program is modified by Qball Cow <Qball@Sarine.nl> for use in an automated regression test. So it has some specialised functionality f.e. the Screenshot command.

Download

You can get the latest version here. Download Here

XMacroRec2

Records key and mouse events from a X session.

XMacroPlay

Playback a macro file.

Commands

The following commands are supported by xmacroplay. Commands with a * can be recorded from xmacrorec2.

Delay [sec] *

Delays the program with [sec] miliseconds.

ButtonPress [n] *

Sends a ButtonPress event with button [n], this emulates the pressing of the mouse button [n].

ButtonRelease [n] *

sends a ButtonRelease event with button [n], this emulates the releaseing of the mouse button [n].

MotionNotify [x] [y] *

Sends a MotionNotify event, this emulates the movment of the mouse

KeyCodePress [kc] *

sends a KeyPress event with the keycode [kc] in this case you must know the keycodes of the remote server.

KeyCodeRelease [kc] *

sends a KeyRelease event with the keycode [kc] in this case you must know the keycodes of the remote server.

KeySymPress [ks] *

sends a KeyPress event with the keysym [ks] converted to the appropriate keycode on the remote server.

KeySymRelease [ks] *

sends a KeyRelease event with the keysym [ks] converted to the appropriate keycode on the remote server.

KeySym [ks]

send both KeyPress and KeyRelease events with the keysym [ks] converted to the appropriate keycode on the remote server.

KeyStrPress [ksname] *

sends a KeyPress event with the keysym name [ksname] converted to the appropriate keycode on the remote server; standard KeySym names are obtained from [X11/keysymdef.h] by removing the XK_ prefix from each name.

KeyStrRelease [ksname] *

sends a KeyRelease event with the keysym name [ksname] converted to the appropriate keycode on the remote server; standard KeySym names are obtained from [X11/keysymdef.h] by removing the XK_ prefix from each name.

KeyStr [ksname]

sends both KeyPress and KeyRelease events with the keysym name [ksname] converted to the appropriate keycode on the remote server; standard KeySym names are obtained from [X11/keysymdef.h] by removing the XK_ prefix from each name.

String [max. 1024 long string]

Sends the string as single characters converted to KeyPress and KeyRelease events based on a character table in chartbl.h (currently only Latin1 is used.)

Screenshot *

Takes a screenshot. By default it uses imagemagick's import. This can be changed in the configuration file. Depending on configuration, taking a screenshot is blocking.

ExecBlock [command]

Executes the [command], and wait until it finished.

ExecNonBlock [command]

Executes the [command], but continues withouth waiting until it finished.