XMacro

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)

xmacrorec:

Grabs all the control over your local display and send the mouse and keyboard events to the remote display. In the meantime it emits KeyStrPress, KeyStrRelease, ButtonPress and ButtonRelease lines to the standard output. It emits MotionNotify lines only if the event struct of the above four events contains different coordinates than the previous event or a mouse button is pressed during the movement. Note: As xmacrorec doesn't save the timestamp of the event, you may need to insert Delay statements into the recorded file!

xmacroplay:

Reads lines from the standard input. It can understand the following lines:
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...)

run:

The 'run' script is provided as an example to use the xmacrorec and xmacroplay utilities in a virtual frame buffer X server. You may need to modify the script...


This project is hosted by:
SourceForge Logo