Run Programme When Key Switch Enabled

First things first

Please follow the advice given in the link below when posting code . Use code tags when posting code here to make it easier to read and copy for examination

As to your question, it is not clear to me what exactly you want to do. What key do you want to use to activate the code ? Is it one of the keys on the keyboard or perhaps an external key switch ?