This question was asked 3 years ago and the guy ended up with unsatisfying results.
Also posted on this site (w/ less discussion): Use Python to send keystrokes to games in Windows?
My issue is the exact same as his was: My scripts can send keystrokes to everything (web browser, text doc, shell, etc.) except to a game window. Specifically it's a Gameboy Color Emulator named bgb
that I'm using to play Pokemon Blue. I just want my code to be able to play the game.
I have tried the shell.SendKeys
, api.keybd_event
, and ctypes
methods shown in the code in the links above. I've also tried pyautogui
. All of these work to interact with most programs, just not the Emulator.
I even had the silly idea to use Windows On-Screen Keyboard and send mouse clicks to the coordinates of relevant buttons. While the mouse clicks worked on other applications, it would not actually click the On-Screen Keyboard.
Does anyone have any insight on this issue?