I'm trying to create a python script to automate a game.
I already tried these libs:
pyautogui
pywin32
ctypes
(I imported this code and calling the functionPressKey
, https://github.com/Sentdex/pygta5/blob/master/directkeys.py)
My code is like this:
from directkeys import PressKey, ReleaseKey, W
import time
print("Script is gonna start in 5 seconds")
time.sleep(5)
PressKey(W)
time.sleep(10)
ReleaseKey(W)
print("Script finished")
I tested this script at notepad
, it's working pretty well, but it's not working in the game at all.
I thought it was because of need to be direct input, but I think ctypes
is already sending input as direct input
.
How can I automate the game using python?