Perhaps an array, or type structure, that records the position of the mouse every time you do a mouseclick (or similar) - then you save this data, and when you load it back in, the computer replays it all as quickly as it can manage it, reconstructing what you did the first time, only really quickly...