A program for pressing certain keys?

Yes, and it should record how long i hold each key for. For this, Even if i don’t run it in the background the hotkeys don’t work, making it impossible to loop.