Replies: 1 comment
-
In AutoHotkey, the behavior of So, if your program is the active window, there is nothing else you need to do except just call In the wrapper, there is two ways to change this behavior:
As noted in the documentation linked above, you may choose for coord mode to be relative to the If you want the get the mouse coordinates relative to a window that is not active, you can get the mouse position according to the screen, and get the position of the window and then calculate the relative position: def get_mouse_position_relative_to(win) -> tuple[int, int]:
win_pos = win.get_position()
mouse_x, mouse_y = ahk.get_mouse_position(coord_mode='Screen')
relative_position = (mouse_x - win_pos.x, mouse_y - win_pos.y)
return relative_position |
Beta Was this translation helpful? Give feedback.
-
How do I get the coordinates of the mouse relative to the program?
Beta Was this translation helpful? Give feedback.
All reactions