Im lucky enough to have a logitech g15 keyboard that comes with a built in macro keypresser. I recommend you go download one, it will allow you to do what you ask. I set mine for about 50 ms latency and have a text buffer at the beginning of each code to make sure it all inputs right.