autoxkit 2.3.0__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {autoxkit-2.3.0 → autoxkit-2.4.0}/PKG-INFO +1 -1
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/constants.py +2 -1
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/hook/event.py +10 -5
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/hook/hook_listener.py +25 -2
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/mousekey/mouse.py +3 -3
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/window/window_action.py +5 -5
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit.egg-info/PKG-INFO +1 -1
- {autoxkit-2.3.0 → autoxkit-2.4.0}/pyproject.toml +1 -1
- {autoxkit-2.3.0 → autoxkit-2.4.0}/LICENSE.txt +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/README.md +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/__init__.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/android/__init__.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/android/adb.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/android/binary.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/android/client.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/android/control.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/android/control_backup.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/android/models.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/android/streams.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/hook/__init__.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/hook/hotkey_listener.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/match/__init__.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/match/match.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/mousekey/__init__.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/mousekey/input.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/mousekey/keyboard.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/utils.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/window/__init__.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/window/window.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit/window/window_match.py +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit.egg-info/SOURCES.txt +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit.egg-info/dependency_links.txt +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit.egg-info/requires.txt +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/autoxkit.egg-info/top_level.txt +0 -0
- {autoxkit-2.3.0 → autoxkit-2.4.0}/setup.cfg +0 -0
|
@@ -45,9 +45,10 @@ Hex_Hook_Code = {
|
|
|
45
45
|
"Key_LL": 0x000D,
|
|
46
46
|
"KeyDown": 0x0100, "KeyUp": 0x0101, "SysKeyDown": 0x0104, "SysKeyUp": 0x0105,
|
|
47
47
|
"Mouse_LL": 0x000E,
|
|
48
|
+
"MWheel": 0x020A,
|
|
48
49
|
"MLeftDown": 0x0201, "MLeftUp": 0x0202,
|
|
49
50
|
"MRightDown": 0x0204, "MRightUp": 0x0205,
|
|
50
51
|
"MiddleDown": 0x0207, "MiddleUp": 0x0208,
|
|
51
52
|
"XDown": 0x020B, "XUp": 0x020C, "MSide1": 0x0001, "MSide2": 0x0002,
|
|
52
53
|
"PM_REMOVE": 0x0001,
|
|
53
|
-
}
|
|
54
|
+
}
|
|
@@ -9,7 +9,7 @@ class KeyEvent:
|
|
|
9
9
|
Attributes:
|
|
10
10
|
action (str): 事件类型,"keydown"或"keyup"
|
|
11
11
|
key_code : 按键的16进制虚拟键码
|
|
12
|
-
key_name (str): 按键名称,例如
|
|
12
|
+
key_name (str): 按键名称,例如"Ctrl"、"A" 等
|
|
13
13
|
"""
|
|
14
14
|
def __init__(self, action, vk_code):
|
|
15
15
|
self.action = action
|
|
@@ -22,15 +22,20 @@ class MouseEvent:
|
|
|
22
22
|
鼠标事件
|
|
23
23
|
Args:
|
|
24
24
|
action (str): 事件类型,"MouseDown"、"MouseUp"或"MouseMove"
|
|
25
|
-
button (str):
|
|
25
|
+
button (str): 鼠标按键,"MLeft"、"MRight"、"Middle"、"MSide1"、"MSide2"、
|
|
26
|
+
"MUWheel"或"MDWheel",MouseMove时为None
|
|
26
27
|
x (int): 鼠标x坐标
|
|
27
28
|
y (int): 鼠标y坐标
|
|
29
|
+
distance (int): 滚轮滚动距离,正值为向上滚动,负值为向下滚动。非滚轮事件时为0
|
|
28
30
|
Attributes:
|
|
29
31
|
action (str): 事件类型,"MouseDown"、"MouseUp"或"MouseMove"
|
|
30
|
-
button (str):
|
|
32
|
+
button (str): 鼠标按键,"MLeft"、"MRight"、"Middle"、"MSide1"、"MSide2"、
|
|
33
|
+
"MUWheel"或"MDWheel",MouseMove时为None
|
|
31
34
|
position (tuple): 鼠标位置,(x, y)格式
|
|
35
|
+
distance (int): 滚轮滚动距离,正值为向上滚动,负值为向下滚动。非滚轮事件时为0
|
|
32
36
|
"""
|
|
33
|
-
def __init__(self, action, button, x, y):
|
|
37
|
+
def __init__(self, action, button, x, y, distance=0):
|
|
34
38
|
self.action = action
|
|
35
39
|
self.button = button
|
|
36
|
-
self.position = (x, y)
|
|
40
|
+
self.position = (x, y)
|
|
41
|
+
self.distance = distance
|
|
@@ -227,12 +227,35 @@ class HookListener:
|
|
|
227
227
|
if result is True:
|
|
228
228
|
return 1 # 截断事件传播
|
|
229
229
|
except Exception as e:
|
|
230
|
-
print(f"[hook_listener] Exception in mouseup callback: {e}", file=__import__(
|
|
230
|
+
print(f"[hook_listener] Exception in mouseup callback: {e}", file=__import__("sys").stderr)
|
|
231
|
+
|
|
232
|
+
elif wParam == HHC["MWheel"]:
|
|
233
|
+
delta = ctypes.c_short(ms.mouseData >> 16).value
|
|
234
|
+
if delta > 0:
|
|
235
|
+
event = MouseEvent("MouseUp", "MUWheel", x, y, distance=delta)
|
|
236
|
+
for cb in self._on_mouseup:
|
|
237
|
+
try:
|
|
238
|
+
result = cb(event)
|
|
239
|
+
if result is True:
|
|
240
|
+
return 1
|
|
241
|
+
except Exception as e:
|
|
242
|
+
print(f"[hook_listener] Exception in mouseup callback: {e}", file=__import__("sys").stderr)
|
|
243
|
+
elif delta < 0:
|
|
244
|
+
event = MouseEvent("MouseDown", "MDWheel", x, y, distance=delta)
|
|
245
|
+
for cb in self._on_mousedown:
|
|
246
|
+
try:
|
|
247
|
+
result = cb(event)
|
|
248
|
+
if result is True:
|
|
249
|
+
return 1
|
|
250
|
+
except Exception as e:
|
|
251
|
+
print(f"[hook_listener] Exception in mousedown callback: {e}", file=__import__("sys").stderr)
|
|
252
|
+
|
|
231
253
|
except Exception as e:
|
|
232
|
-
print(f"[hook_listener] Exception in _mouse_proc: {e}", file=__import__(
|
|
254
|
+
print(f"[hook_listener] Exception in _mouse_proc: {e}", file=__import__("sys").stderr)
|
|
233
255
|
|
|
234
256
|
return user32.CallNextHookEx(self.mouse_hook, nCode, wParam, lParam)
|
|
235
257
|
|
|
258
|
+
|
|
236
259
|
# 辅助函数:获取鼠标按键名称
|
|
237
260
|
def _get_mouse_button(self, wParam, mouseData):
|
|
238
261
|
if wParam in (HHC["MLeftDown"], HHC["MLeftUp"]):
|
|
@@ -114,18 +114,18 @@ class Mouse:
|
|
|
114
114
|
|
|
115
115
|
time.sleep(step_interval)
|
|
116
116
|
|
|
117
|
-
def
|
|
117
|
+
def mouse_wheel(self, distance: int, x: int=None, y: int=None):
|
|
118
118
|
"""
|
|
119
119
|
垂直滚轮滚动
|
|
120
120
|
Args:
|
|
121
121
|
x (int): 目标X坐标
|
|
122
122
|
y (int): 目标Y坐标
|
|
123
|
-
|
|
123
|
+
distance (int): 滚动距离(正值向上,负值向下)
|
|
124
124
|
"""
|
|
125
125
|
x, y = self._verify_mouse_point(x, y)
|
|
126
126
|
if x is not None and y is not None:
|
|
127
127
|
self.mouse_move(x, y, steps=1)
|
|
128
|
-
self._mouse_action(HMC["Wheel"], data=
|
|
128
|
+
self._mouse_action(HMC["Wheel"], data=distance * 120)
|
|
129
129
|
|
|
130
130
|
def get_mouse_position(self):
|
|
131
131
|
"""
|
|
@@ -331,11 +331,11 @@ class WindowAction:
|
|
|
331
331
|
# 等待一段时间
|
|
332
332
|
time.sleep(step_interval)
|
|
333
333
|
|
|
334
|
-
def send_mouse_wheel(self,
|
|
334
|
+
def send_mouse_wheel(self, distance: int, x: int=None, y: int=None, mode='send'):
|
|
335
335
|
"""
|
|
336
336
|
发送鼠标滚轮消息
|
|
337
337
|
Args:
|
|
338
|
-
|
|
338
|
+
distance (int): 滚动距离(正值向上,负值向下)
|
|
339
339
|
mode (str): 发送模式,'send', 'post', 'global'。默认 'send'
|
|
340
340
|
"""
|
|
341
341
|
if not self.hwnd:
|
|
@@ -343,9 +343,9 @@ class WindowAction:
|
|
|
343
343
|
|
|
344
344
|
if mode == 'global':
|
|
345
345
|
if x is None or y is None:
|
|
346
|
-
self.mouse.mouse_wheel(
|
|
346
|
+
self.mouse.mouse_wheel(distance=distance)
|
|
347
347
|
else:
|
|
348
|
-
self.mouse.mouse_wheel(self.client_point.x + x, self.client_point.y + y,
|
|
348
|
+
self.mouse.mouse_wheel(self.client_point.x + x, self.client_point.y + y, distance)
|
|
349
349
|
return
|
|
350
350
|
|
|
351
351
|
# 获取当前鼠标位置(使用记录的位置,如果没有则使用窗口中心)
|
|
@@ -365,7 +365,7 @@ class WindowAction:
|
|
|
365
365
|
# 确保使用屏幕坐标
|
|
366
366
|
lparam = MAKELPARAM(x, y)
|
|
367
367
|
# 高16位是滚轮滚动量,低16位是鼠标状态
|
|
368
|
-
wparam = (
|
|
368
|
+
wparam = ((distance * 120) << 16) | (self.mouse_state & 0xFFFF)
|
|
369
369
|
|
|
370
370
|
if mode == 'post':
|
|
371
371
|
PostMessage(self.hwnd, WM_MOUSEWHEEL, wparam, lparam)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "autoxkit"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.4.0"
|
|
8
8
|
description = "Python library for Windows automation and Android device screen casting and control"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|