Python Forum
Send Key press for a game? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Send Key press for a game? (/thread-16881.html)



Send Key press for a game? - jmair - Mar-18-2019

I'm just trying to send simple key commands to a video game. I've tried a few different pypi options and pywin32 to send keystrokes. pynput send mouseclicks but not keystrokes. Though all of these will send to something like notepad, keystrokes aren't showing up in game.

Any ideas?


RE: Send Key press for a game? - metulburr - Mar-18-2019

what game? What is your code for each various library?


RE: Send Key press for a game? - jmair - Mar-20-2019

The game is EverQuest.
pynput for example. Again, the code works fine everywhere except on top of this game. Even when it's called to the forefront. The pynput mouse movement and clicks work great, not the keys though. I'm not sure if there is a 'lower level' key send option I need to use or what is available.
from pynput.keyboard import Key, Controller

keyboard = Controller()

# Type a lower case A; this will work even if no key on the
# physical keyboard is labelled 'A'
keyboard.press('a')
keyboard.release('a')



RE: Send Key press for a game? - nilamo - Mar-21-2019

AutoHotKey might be easier to do this with: https://www.autohotkey.com/