Quote Originally Posted by junx
You can use the various SetBinding() functions in a script to set keys to macros or commands.

It has three versions SetBinding, SetBindingSpell and SetBindingMacro with each variation taking two arguments: the keyboard or mouse button you want to bind to and the action, spell or macro you want bound.
Nice! I stand corrected ops: