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).
TODO: - Better keyboard (keycode/keysym) and character translation. - Make xmacrorecord not to grab all the events, so we would see the effect of our events.
Download: available at the usual SF project page... (also snapshots)
Delay [sec] - delays the program with [sec] secundums 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...)