A clever use of Keyboard Maestro by Ben Brooks.