xsendkey is a simple tool for generating keypresses in X. Simply specify the window ID (e.g. from xwininfo), keysym name (see <X11/keysymdef.h> for the complete list), and shift modifiers, and it will dispatch the key.
e.g. xsendkey -window 0x3800026 Control+Shift+A
Originally, the reason I used this was so that I could assign X keycodes to the additional rubber buttons on my HP Kayak, on which I ran NT with an X server. HP supply a Windows program that binds commands to the keys, but they don't generate proper keycodes. So, the command I ran was xsendkey.
Please note that for security reasons, xterm will not respond by default to synthetic events, (i.e. those originating from XSendEvent()) so you need to set the .allowSendEvents resource or select it from the menu. You can do this from the command line with: xterm -xrm 'xterm*allowSendEvents: True', but beware that this is a bit of a security hole.
Download the source. Thanks to T. Sato, on whose xvkbd this code was in part based, and to Derek Martin (derek_martin at agilent dot com) who added the -count and the XGetInputFocus default window. Thanks also to Hanno Hecker (email@example.com) for contributing the symbolic keysym lookup, which I'd wanted for years but never got around to writing.