Make macros with the macro maker.
Basically a bunch of mouse and keyboard nonsense with Java, followed by path simplification using Ramer Douglas Peucker algorithm.
Key presses / mouse clicks are checkpointed along the path to try and ensure consistency in macro recordings.