Use autohotkey, imo. The example script in the dual-boxing auto hotkey wiki can get you started just fine.