Hot keys

How can you set up a hot key to do something in a non window active
application ?

TIA,
John.