Legacy GM problems with keyboard_key_press and release



I like to use game maker to make personal helpful programs besides games. Me and a friend wanted to make a solution for playing local coop games online using networking and forced key presses. I understand this may not be the original intent for these functions, but after making some progress I have come to a halt.

The networking has been tested extensively and works as intended. However I have had some issues getting the key presses to execute while some games act as the active window.
I started using keyboard_key_press and keyboard_key_release, which worked for a lot of games, but not all. I then tried making an array, and encoding the status of 20 buttons into the x and y coordinates of the mouse. Game maker could somehow control the mouse in all cases, but not the keyboard. I then used other software capable of taking full control of the keyboard to decode the x and y coordinates of the mouse back to the initial button presses. This method works as I had imagined, but I missed one key piece of information: the game we are playing also centers the mouse for camera controls, invalidating my solution.

I'm wondering if there is a good way to emulate key presses when the active window has higher priority than keyboard_key_press and release, but lower priority than some other programs.
I am using GameMaker: Studio v1.4.1804
We are both using windows 8.1