from time import sleep, time
import win32api
import win32gui, win32ui, win32con
VK_KEY_W = 0x57
VK_KEY_A = 0x41
VK_KEY_S = 0x53
VK_KEY_D = 0x44
VK_KEY_P = 0x50
VK_SHIFT = 0xA0
VK_F1 = 0x70
def main():
window_name = "Aeldra"
hwnd = win32gui.FindWindow(None, window_name)
win32gui.SetForegroundWindow(hwnd)
press_key(hwnd, VK_F1, 0.4)
list_window_names()
def press_key(hwnd, key, sec):
win32api.SendMessage(hwnd, win32con.WM_KEYDOWN, key, 0)
sleep(sec)
win32api.SendMessage(hwnd, win32con.WM_KEYUP, key, 0)
def list_window_names():
def winEnumHandler(hwnd, ctx):
if win32gui.IsWindowVisible(hwnd):
print(hex(hwnd), win32gui.GetWindowText(hwnd))
win32gui.EnumWindows(winEnumHandler, None)
main()
Hello i want to make a bot like clicking objects in a games but the code is not working at the game the inputs i send is not working in game but when i send inputs to another thing its working.