From bb8b6f789d03a7d48b45f6f67cffaa845be38f6e Mon Sep 17 00:00:00 2001 From: Pavel Date: Wed, 9 Oct 2019 18:12:47 +0200 Subject: [PATCH] scale coordinates with window size --- fx92-programmer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fx92-programmer.py b/fx92-programmer.py index 3ebeb6b..aab9f07 100644 --- a/fx92-programmer.py +++ b/fx92-programmer.py @@ -176,8 +176,11 @@ def callback(hwnd, windows): def process(hwnd, sequence): for element in sequence: + p = win32gui.GetWindowRect(hwnd) + w = p[2] - p[0] + h = p[3] - p[1] p = coordinates[element] - tmp = win32api.MAKELONG(p[0], p[1]) + tmp = win32api.MAKELONG(p[0] * w // 330, p[1] * h // 701) win32api.SendMessage(hwnd, win32con.WM_LBUTTONDOWN, win32con.MK_LBUTTON, tmp) win32api.SendMessage(hwnd, win32con.WM_LBUTTONUP, win32con.MK_LBUTTON, tmp) win32api.Sleep(100)