Global Key Listening

Hi,

What I am trying to do is to create a program that allows a person to use a specific key, like cmd A, and a script would activate. I want this to work anywhere though, not just within the app. In other words, no matter what application they are in, the script can be activated with the specific keys. I know it can be done, because I use Dragthing, and you can set it up to do this, but I need to know how to do this for an application that I am creating. Any advice would be greatly appreciated.