Input Functions¶
- class autocv.core.input.Input(hwnd: int = -1)[source]¶
Bases:
VisionSimulate mouse and keyboard input for a target window handle.
The class extends
Visionwith helpers that post and send Win32 messages for mouse movement, clicks, and keystrokes.- get_last_moved_point() tuple[int, int][source]¶
Return the last client-area point targeted by
move_mouse().- Returns:
The most recent
(x, y)point in client coordinates.
- move_mouse(x: int, y: int, *, human_like: bool = True, ghost_mouse: bool = True) None[source]¶
Move the mouse cursor to
(x, y)in client coordinates.- Parameters:
x – Target X coordinate inside the window client area.
y – Target Y coordinate inside the window client area.
human_like – When
True, simulate human-like mouse motion.ghost_mouse – When
True, simulate motion using Win32 messages; whenFalse, move the OS cursor.
- click_mouse(button: int = 1, *, send_message: bool = False) None[source]¶
Click a mouse button at the last moved position.
- Parameters:
button – Mouse button identifier (1=left, 2=right, 3=middle).
send_message – When
True, useSendMessageinstead ofPostMessagefor the click.
- press_vk_key(vk_code: int) None[source]¶
Press a virtual key using Win32 keyboard messages.
- Parameters:
vk_code – Virtual-key code (
VK_*) to press.
Notes
This method sends
WM_CHARwithchr(vk_code)to preserve historical behaviour.
- release_vk_key(vk_code: int) None[source]¶
Release a virtual key using Win32 keyboard messages.
- Parameters:
vk_code – Virtual-key code (
VK_*) to release.
- send_vk_key(vk_code: int) None[source]¶
Send a virtual key by pressing and releasing it.
- Parameters:
vk_code – Virtual-key code (
VK_*) to send.