Bome's Midi Translator Pro is a popular MIDI application and a keystroke translator. : use it for controlling arbitrary software by way of MIDI and keystrokes.

It works by specifying mappings for different input and output types. You can combine the erent trigger types (Incoming) and action types (Outgoing) as you wish, e.g. do keystroke-to-MIDI conversion, or MIDI-to-mouse mapping.