You might want to try xmacro.
Documentation is sparse on it, but it's actually easy to use. Simply record your mouse and keyboard actions with
Code:
xmacrorec2 > macro.txt
(There's also xmacrorec (no number). I don't know what the difference is, but xmacrorec doesn't seem to handle mouse movements for some reason. Edit: xmacrorec appears to be for remote displays, while xmacrorec2 records the local one only.)
Then you can edit it as you wish and play it back with
Code:
cat macro.txt | xmacroplay -d 500 ":0.0"
the last number is your display number, and the -d is the number of milliseconds between commands. Set it too low and everything will fly through almost instantaneously. But setting it slower has the side-effect of making mouse double-clicking impossible. You can insert delays into the macro file itself instead if necessary.