ascript 1.3.27__py3-none-win_amd64.whl

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.
Files changed (177) hide show
  1. ascript/__init__.py +8 -0
  2. ascript/hooks/__init__.py +0 -0
  3. ascript/hooks/hook-ascript.py +2 -0
  4. ascript/windows/__init__.py +29 -0
  5. ascript/windows/daos/__init__.py +0 -0
  6. ascript/windows/daos/screen.py +143 -0
  7. ascript/windows/hardware/__init__.py +5 -0
  8. ascript/windows/hardware/keyboard.py +279 -0
  9. ascript/windows/hardware/logitech_driver.py +179 -0
  10. ascript/windows/hardware/mouse.py +308 -0
  11. ascript/windows/license/__init__.py +16 -0
  12. ascript/windows/license/achttp.cp310-win_amd64.pyd +0 -0
  13. ascript/windows/license/achttp.cp311-win_amd64.pyd +0 -0
  14. ascript/windows/license/achttp.cp312-win_amd64.pyd +0 -0
  15. ascript/windows/license/achttp.cp313-win_amd64.pyd +0 -0
  16. ascript/windows/license/achttp.cp314-win_amd64.pyd +0 -0
  17. ascript/windows/license/achttp.cp38-win_amd64.pyd +0 -0
  18. ascript/windows/license/achttp.cp39-win_amd64.pyd +0 -0
  19. ascript/windows/media/__init__.py +0 -0
  20. ascript/windows/resources/__init__.py +0 -0
  21. ascript/windows/resources/libs/logitech/x64/LogitechGkeyEnginesWrapper.dll +0 -0
  22. ascript/windows/resources/libs/logitech/x86/LogitechGkeyEnginesWrapper.dll +0 -0
  23. ascript/windows/resources/templates/__init__.py +0 -0
  24. ascript/windows/resources/templates/__init__py.win.template +51 -0
  25. ascript/windows/resources/templates/build.as.win.template +14 -0
  26. ascript/windows/resources/templates/build.py +71 -0
  27. ascript/windows/resources/templates/logo_windows.ico +0 -0
  28. ascript/windows/resources/templates/windows/main.py +50 -0
  29. ascript/windows/resources/templates/windows/pyproject.toml +44 -0
  30. ascript/windows/resources/templates/windows/res/img/logo.ico +0 -0
  31. ascript/windows/screen/__init__.py +13 -0
  32. ascript/windows/screen/as_cv.py +382 -0
  33. ascript/windows/screen/canny.py +128 -0
  34. ascript/windows/screen/code_scanner.py +72 -0
  35. ascript/windows/screen/color_algorithms.py +277 -0
  36. ascript/windows/screen/find_colors.py +251 -0
  37. ascript/windows/screen/find_images.py +217 -0
  38. ascript/windows/screen/ocr/__init__.py +4 -0
  39. ascript/windows/screen/ocr/ocr.py +223 -0
  40. ascript/windows/screen/ocr/rapidocr_hook.py +301 -0
  41. ascript/windows/screen/ocrx.py +169 -0
  42. ascript/windows/screen/screen_core.py +139 -0
  43. ascript/windows/store/__init__.py +21 -0
  44. ascript/windows/system/__init__.py +8 -0
  45. ascript/windows/system/device.py +355 -0
  46. ascript/windows/system/easy_print.py +115 -0
  47. ascript/windows/system/env.py +492 -0
  48. ascript/windows/system/exception/__init__.py +1 -0
  49. ascript/windows/system/key_value.py +145 -0
  50. ascript/windows/system/pip.py +175 -0
  51. ascript/windows/system/r.py +165 -0
  52. ascript/windows/system/runtime.py +62 -0
  53. ascript/windows/tools/__init__.py +27 -0
  54. ascript/windows/tools/__main__.py +21 -0
  55. ascript/windows/tools/action.json +33 -0
  56. ascript/windows/tools/action.py +168 -0
  57. ascript/windows/tools/colors_tool.py +391 -0
  58. ascript/windows/tools/config.py +26 -0
  59. ascript/windows/tools/dumptool.py +18 -0
  60. ascript/windows/tools/eel_api.py +495 -0
  61. ascript/windows/tools/gpplug/__init__.py +0 -0
  62. ascript/windows/tools/gpplug/plug.py +70 -0
  63. ascript/windows/tools/mouse_catch.py +168 -0
  64. ascript/windows/tools/plug_manager.py +38 -0
  65. ascript/windows/tools/tool_api.py +906 -0
  66. ascript/windows/tools/tool_window.py +56 -0
  67. ascript/windows/tools/uia_worker.py +365 -0
  68. ascript/windows/tools/web/app_store_window.html +481 -0
  69. ascript/windows/tools/web/colors.html +532 -0
  70. ascript/windows/tools/web/css/screen.css +1342 -0
  71. ascript/windows/tools/web/css/viewtree.css +357 -0
  72. ascript/windows/tools/web/flot_control.html +195 -0
  73. ascript/windows/tools/web/img/ico/favicon.png +0 -0
  74. ascript/windows/tools/web/img/ico/paintpalette.png +0 -0
  75. ascript/windows/tools/web/img/svg/find_colors.svg +1 -0
  76. ascript/windows/tools/web/img/svg/find_images.svg +1 -0
  77. ascript/windows/tools/web/img/svg/illustration-6.svg +89 -0
  78. ascript/windows/tools/web/img/svg/img_default.svg +1 -0
  79. ascript/windows/tools/web/img/svg/ocr.svg +1 -0
  80. ascript/windows/tools/web/js/screen/colors.js +466 -0
  81. ascript/windows/tools/web/js/screen/gp_plug.js +108 -0
  82. ascript/windows/tools/web/js/screen/image_mouse.js +464 -0
  83. ascript/windows/tools/web/js/screen/img_view.js +558 -0
  84. ascript/windows/tools/web/js/screen/plug.js +246 -0
  85. ascript/windows/tools/web/js/screen/screen.js +690 -0
  86. ascript/windows/tools/web/js/screen/screen_api.js +778 -0
  87. ascript/windows/tools/web/js/screen/screen_maker.js +10 -0
  88. ascript/windows/tools/web/js/utils/map.js +73 -0
  89. ascript/windows/tools/web/js/utils/upload.js +157 -0
  90. ascript/windows/tools/web/js/viewtree/niv_js.js +27 -0
  91. ascript/windows/tools/web/js/viewtree/vtree.js +1510 -0
  92. ascript/windows/tools/web/libs/bootstrap/css/bootstrap.min.css +6 -0
  93. ascript/windows/tools/web/libs/bootstrap/js/bootstrap.bundle.min.js +7 -0
  94. ascript/windows/tools/web/libs/bootstrap-icons/0-circle.svg +4 -0
  95. ascript/windows/tools/web/libs/bootstrap-icons/0-square.svg +4 -0
  96. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.css +2078 -0
  97. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.json +2052 -0
  98. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.min.css +5 -0
  99. ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.scss +2090 -0
  100. ascript/windows/tools/web/libs/bootstrap-icons/font/fonts/bootstrap-icons.woff +0 -0
  101. ascript/windows/tools/web/libs/bootstrap-icons/font/fonts/bootstrap-icons.woff2 +0 -0
  102. ascript/windows/tools/web/libs/feather-icons/dist/feather.min.js +13 -0
  103. ascript/windows/tools/web/libs/feather-icons/dist/icons.json +1 -0
  104. ascript/windows/tools/web/libs/jquery/core.js +399 -0
  105. ascript/windows/tools/web/libs/jquery/jquery.js +10598 -0
  106. ascript/windows/tools/web/libs/jquery/jquery.min.js +4 -0
  107. ascript/windows/tools/web/libs/jquery/jquery.min.js.zip +0 -0
  108. ascript/windows/tools/web/libs/jquery/jquery.slim.js +8495 -0
  109. ascript/windows/tools/web/libs/jquery/jquery.slim.min.js +2 -0
  110. ascript/windows/tools/web/libs/jquery-menu/jquery.contextMenu.js +2134 -0
  111. ascript/windows/tools/web/libs/jquery-menu/jquery.contextMenu.min.css +16 -0
  112. ascript/windows/tools/web/libs/jquery-zTree/css/zTreeStyle.css +97 -0
  113. ascript/windows/tools/web/libs/jquery-zTree/img/diy/1_close.png +0 -0
  114. ascript/windows/tools/web/libs/jquery-zTree/img/diy/1_open.png +0 -0
  115. ascript/windows/tools/web/libs/jquery-zTree/img/diy/2.png +0 -0
  116. ascript/windows/tools/web/libs/jquery-zTree/img/diy/3.png +0 -0
  117. ascript/windows/tools/web/libs/jquery-zTree/img/diy/4.png +0 -0
  118. ascript/windows/tools/web/libs/jquery-zTree/img/diy/5.png +0 -0
  119. ascript/windows/tools/web/libs/jquery-zTree/img/diy/6.png +0 -0
  120. ascript/windows/tools/web/libs/jquery-zTree/img/diy/7.png +0 -0
  121. ascript/windows/tools/web/libs/jquery-zTree/img/diy/8.png +0 -0
  122. ascript/windows/tools/web/libs/jquery-zTree/img/diy/9.png +0 -0
  123. ascript/windows/tools/web/libs/jquery-zTree/img/line_conn.gif +0 -0
  124. ascript/windows/tools/web/libs/jquery-zTree/img/loading.gif +0 -0
  125. ascript/windows/tools/web/libs/jquery-zTree/img/tree-node-btn.png +0 -0
  126. ascript/windows/tools/web/libs/jquery-zTree/img/zTreeStandard.gif +0 -0
  127. ascript/windows/tools/web/libs/jquery-zTree/img/zTreeStandard.png +0 -0
  128. ascript/windows/tools/web/libs/jquery-zTree/js/jquery.ztree.all.min.js +3 -0
  129. ascript/windows/tools/web/libs/treeview/css/jquery.treeview.css +79 -0
  130. ascript/windows/tools/web/libs/treeview/img/file.png +0 -0
  131. ascript/windows/tools/web/libs/treeview/img/ico_loading.png +0 -0
  132. ascript/windows/tools/web/libs/treeview/img/icon4.png +0 -0
  133. ascript/windows/tools/web/libs/treeview/img/icon5.png +0 -0
  134. ascript/windows/tools/web/libs/treeview/img/icon6.png +0 -0
  135. ascript/windows/tools/web/libs/treeview/img/py.png +0 -0
  136. ascript/windows/tools/web/libs/treeview/img/treeview-black-line.gif +0 -0
  137. ascript/windows/tools/web/libs/treeview/img/treeview-black.gif +0 -0
  138. ascript/windows/tools/web/libs/treeview/img/treeview-default-line.gif +0 -0
  139. ascript/windows/tools/web/libs/treeview/img/treeview-default.gif +0 -0
  140. ascript/windows/tools/web/libs/treeview/img/treeview-famfamfam-line.gif +0 -0
  141. ascript/windows/tools/web/libs/treeview/img/treeview-famfamfam.gif +0 -0
  142. ascript/windows/tools/web/libs/treeview/img/treeview-gray-line.gif +0 -0
  143. ascript/windows/tools/web/libs/treeview/img/treeview-gray.gif +0 -0
  144. ascript/windows/tools/web/libs/treeview/img/treeview-red-line.gif +0 -0
  145. ascript/windows/tools/web/libs/treeview/img/treeview-red.gif +0 -0
  146. ascript/windows/tools/web/libs/treeview/js/jquery.treeview.edit.js +37 -0
  147. ascript/windows/tools/web/libs/treeview/js/jquery.treeview.js +250 -0
  148. ascript/windows/tools/web/license_window.html +255 -0
  149. ascript/windows/tools/web/plugs/a.html +653 -0
  150. ascript/windows/tools/web/plugs/demo.html +52 -0
  151. ascript/windows/tools/web/plugs/find_colors.html +629 -0
  152. ascript/windows/tools/web/plugs/find_images.html +699 -0
  153. ascript/windows/tools/web/plugs/rapidocr.html +954 -0
  154. ascript/windows/tools/web/vtree.html +496 -0
  155. ascript/windows/tools/webview/assets/index-HymBPl-I.css +1 -0
  156. ascript/windows/tools/webview/assets/index-PqA_m8tL.js +17 -0
  157. ascript/windows/tools/webview/index.html +13 -0
  158. ascript/windows/ui/__init__.py +6 -0
  159. ascript/windows/ui/app_store_window.py +272 -0
  160. ascript/windows/ui/draw_window.py +231 -0
  161. ascript/windows/ui/flot_test.py +297 -0
  162. ascript/windows/ui/flot_window.py +488 -0
  163. ascript/windows/ui/license_window.py +111 -0
  164. ascript/windows/ui/web_window.py +466 -0
  165. ascript/windows/utils/__init__.py +0 -0
  166. ascript/windows/utils/node_utils.py +20 -0
  167. ascript/windows/utils/screen_utils.py +280 -0
  168. ascript/windows/window/Selector.py +1015 -0
  169. ascript/windows/window/Window.py +747 -0
  170. ascript/windows/window/__init__.py +5 -0
  171. ascript/windows/window/launcher.py +213 -0
  172. ascript/windows/window/uia_runtime.py +26 -0
  173. ascript-1.3.27.dist-info/METADATA +41 -0
  174. ascript-1.3.27.dist-info/RECORD +177 -0
  175. ascript-1.3.27.dist-info/WHEEL +5 -0
  176. ascript-1.3.27.dist-info/entry_points.txt +2 -0
  177. ascript-1.3.27.dist-info/top_level.txt +1 -0
@@ -0,0 +1,168 @@
1
+ import webview
2
+ import os
3
+ import threading
4
+ import ctypes
5
+ import time
6
+ import sys
7
+ import win32gui
8
+ import win32con
9
+ import win32clipboard
10
+ from ctypes import windll, byref, sizeof
11
+ from ctypes.wintypes import RECT, MSG
12
+
13
+ # 设置 AppID 以便在任务栏独立显示(虽然在 .py 环境下图标可能仍是 Python)
14
+ try:
15
+ ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(u'ascript.coordinate.picker.v6')
16
+ except:
17
+ pass
18
+
19
+ # DPI 高清适配
20
+ try:
21
+ windll.shcore.SetProcessDpiAwareness(1)
22
+ except:
23
+ windll.user32.SetProcessDPIAware()
24
+
25
+ HTML_CODE = """
26
+ <!DOCTYPE html>
27
+ <html>
28
+ <head>
29
+ <style>
30
+ body { margin: 0; padding: 12px; font-family: 'Segoe UI', sans-serif; background: #000; color: #eee; overflow: hidden; user-select: none; }
31
+ .box { border: 1px solid #333; border-radius: 8px; background: #111; padding: 12px; margin-top: 5px; }
32
+ .row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
33
+ .coord-val { font-size: 18px; font-weight: bold; font-family: 'Consolas'; color: #00bcd4; }
34
+ #history { height: 280px; overflow-y: auto; margin-top: 10px; border-top: 1px solid #222; padding-top: 5px; }
35
+ .item { background: #1a1a1a; padding: 8px; border-radius: 4px; margin-bottom: 5px; font-size: 12px; cursor: pointer; border-left: 2px solid #00bcd4; }
36
+ .item:hover { background: #222; }
37
+ </style>
38
+ </head>
39
+ <body>
40
+ <div style="font-size:11px; color:#555; margin-bottom:5px;">Shift + A 记录坐标</div>
41
+ <div class="box">
42
+ <div class="row">
43
+ <label><input type="radio" name="m" value="abs" checked> 屏幕</label>
44
+ <span id="a-v" class="coord-val">0, 0</span>
45
+ </div>
46
+ <div class="row">
47
+ <label><input type="radio" name="m" value="rel"> 窗口</label>
48
+ <span id="r-v" class="coord-val" style="color:#4caf50;">0, 0</span>
49
+ </div>
50
+ <div id="w-t" style="font-size:11px; color:#666; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">窗口: -</div>
51
+ </div>
52
+ <div id="history"></div>
53
+ <script>
54
+ function updateUI(a, r, w) {
55
+ document.getElementById('a-v').innerText = a;
56
+ document.getElementById('r-v').innerText = r;
57
+ document.getElementById('w-t').innerText = "窗口: " + w;
58
+ }
59
+ function getMode() { return document.querySelector('input[name="m"]:checked').value; }
60
+ function addHistory(v) {
61
+ const l = document.getElementById('history');
62
+ const d = document.createElement('div');
63
+ d.className = 'item'; d.innerText = "复制: " + v;
64
+ d.onclick = () => window.pywebview.api.copy(v);
65
+ l.insertBefore(d, l.firstChild);
66
+ }
67
+ </script>
68
+ </body>
69
+ </html>
70
+ """
71
+
72
+
73
+ class ProApi:
74
+ """剪贴板操作代理类,提供将文本复制到系统剪贴板的功能。"""
75
+
76
+ def copy(self, text):
77
+ """将指定文本复制到系统剪贴板。
78
+
79
+ Args:
80
+ text: 要复制到剪贴板的文本内容,会自动转换为字符串。
81
+ """
82
+ try:
83
+ win32clipboard.OpenClipboard()
84
+ win32clipboard.EmptyClipboard()
85
+ win32clipboard.SetClipboardText(str(text))
86
+ win32clipboard.CloseClipboard()
87
+ except:
88
+ pass
89
+
90
+
91
+ class MouseCatch:
92
+ """鼠标坐标捕获工具。
93
+
94
+ 提供一个置顶小窗口,实时显示鼠标的屏幕坐标和窗口相对坐标,
95
+ 支持通过 Shift+A 热键记录坐标并复制到剪贴板。使用 pywebview 渲染界面。
96
+ """
97
+
98
+ def __init__(self):
99
+ """初始化鼠标坐标捕获工具。
100
+
101
+ 设置应用图标路径、窗口标题,并初始化运行状态标志。
102
+ 自动适配打包环境(PyInstaller)和开发环境的资源路径。
103
+ """
104
+ # 路径逻辑 [cite: 2026-01-20]
105
+ base = sys._MEIPASS if getattr(sys, 'frozen', False) else os.path.dirname(os.path.abspath(__file__))
106
+ self.icon_path = os.path.normpath(os.path.join(base, "web", "img", "ico", "favicon.png"))
107
+ self.title = "AScript 坐标捕获工具"
108
+ self.window = None
109
+ self.running = True
110
+
111
+ def _worker(self):
112
+ """后台工作线程,持续追踪鼠标坐标并监听热键事件。
113
+
114
+ 注册 Shift+A 全局热键,循环获取鼠标位置信息(屏幕坐标和窗口相对坐标),
115
+ 实时更新前端 UI 显示。当热键触发时,根据当前模式(屏幕/窗口)将坐标
116
+ 复制到剪贴板并添加到历史记录。
117
+ """
118
+ hotkey_id = 1
119
+ # --- 修改处:将 MOD_ALT 改为 MOD_SHIFT ---
120
+ windll.user32.RegisterHotKey(None, hotkey_id, win32con.MOD_SHIFT, ord('A'))
121
+
122
+ while self.running:
123
+ try:
124
+ x, y = win32gui.GetCursorPos()
125
+ raw_hwnd = win32gui.WindowFromPoint((x, y))
126
+ root_hwnd = win32gui.GetAncestor(raw_hwnd, win32con.GA_ROOT)
127
+ title = win32gui.GetWindowText(root_hwnd) or "Unknown"
128
+ rect = RECT()
129
+ windll.dwmapi.DwmGetWindowAttribute(root_hwnd, 9, byref(rect), sizeof(rect))
130
+ rx, ry = x - rect.left, y - rect.top
131
+
132
+ if self.window:
133
+ try:
134
+ self.window.evaluate_js(f"updateUI('{x}, {y}', '{rx}, {ry}', `{title}`)")
135
+ except:
136
+ pass
137
+
138
+ # 监听热键消息
139
+ msg = MSG()
140
+ if windll.user32.PeekMessageW(byref(msg), 0, 0x0312, 0x0312, 1):
141
+ mode = self.window.evaluate_js("getMode()")
142
+ res = f"{x}, {y}" if mode == "abs" else f"{rx}, {ry}"
143
+ ProApi().copy(res)
144
+ self.window.evaluate_js(f"addHistory('{res}')")
145
+ except:
146
+ pass
147
+ time.sleep(0.05)
148
+
149
+ def run(self):
150
+ """启动鼠标坐标捕获工具应用。
151
+
152
+ 创建 pywebview 窗口并启动后台工作线程,使用 Edge Chromium 内核渲染界面。
153
+ 窗口设置为置顶显示,关闭后自动停止后台线程。
154
+ """
155
+ self.window = webview.create_window(
156
+ self.title, html=HTML_CODE, js_api=ProApi(),
157
+ width=340, height=520, on_top=True
158
+ )
159
+
160
+ threading.Thread(target=self._worker, daemon=True).start()
161
+
162
+ # 启动。注意:此时左上角可能会变,但任务栏在 .py 环境下极难改变
163
+ webview.start(icon=self.icon_path, gui='edgechromium')
164
+ self.running = False
165
+
166
+
167
+ if __name__ == "__main__":
168
+ MouseCatch().run()
@@ -0,0 +1,38 @@
1
+ import eel
2
+ from ascript.windows.tools.gpplug.plug import GpPlug
3
+
4
+ class FindImagesPlug(GpPlug):
5
+ """找图插件,用于在大图中定位小图的位置。"""
6
+ name = "找图"
7
+ description = "快速找到小图在大图中的位置"
8
+ entry_html = "plugs/find_images.html"
9
+ icon = "img/svg/find_images.svg"
10
+
11
+
12
+ class FindColorsPlug(GpPlug):
13
+ """找色插件,用于通过颜色特征在图像中定位目标点位。"""
14
+ name = "找色"
15
+ description = "通过颜色特征,找到图像中的点位"
16
+ entry_html = "plugs/find_colors.html"
17
+ icon = "img/svg/find_colors.svg"
18
+
19
+
20
+ class RapidOCRPlug(GpPlug):
21
+ """Rapid OCR 文字识别插件,用于识别图像中的文字内容。"""
22
+ name = "Rapid文字识别"
23
+ description = "传入图像,识别途中文字"
24
+ entry_html = "plugs/rapidocr.html"
25
+ icon = "img/svg/ocr.svg"
26
+
27
+
28
+ @eel.expose
29
+ def ascript_plug_list():
30
+ """获取所有已注册的图形处理插件列表。
31
+
32
+ 实例化所有插件并将其转换为字典格式,供前端渲染插件菜单使用。
33
+
34
+ Returns:
35
+ list[dict]: 插件信息字典列表,每项包含 name、class_name、description、entry_html、icon 字段。
36
+ """
37
+ plugs = [FindImagesPlug(), FindColorsPlug(), RapidOCRPlug()]
38
+ return [el.to_dict() for el in plugs]