@sneakybeaky18 instead of having the program simulate or press a key, it will call the function. Do you have experience programming? A keypress is for a user, not for your program to try and press the key, entirely unnecessary.

If however there was a situation where you needed the program to do the equivalent of pressing a key, you could use sendkeys with c#.