ascript 1.2.2__tar.gz → 1.2.4__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.
Files changed (276) hide show
  1. {ascript-1.2.2 → ascript-1.2.4}/PKG-INFO +1 -1
  2. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/__init__.py +6 -1
  3. ascript-1.2.4/ascript/windows/hardware/__init__.py +5 -0
  4. ascript-1.2.4/ascript/windows/hardware/keyboard.py +34 -0
  5. {ascript-1.2.2/ascript/windows → ascript-1.2.4/ascript/windows/hardware}/mouse.py +1 -32
  6. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/resources/templates/windows/pyproject.toml +3 -1
  7. ascript-1.2.4/ascript/windows/screen/ocr/rapidocr_hook.py +174 -0
  8. ascript-1.2.4/ascript/windows/utils/__init__.py +0 -0
  9. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/window/__init__.py +3 -0
  10. {ascript-1.2.2 → ascript-1.2.4}/ascript.egg-info/PKG-INFO +1 -1
  11. {ascript-1.2.2 → ascript-1.2.4}/ascript.egg-info/SOURCES.txt +5 -2
  12. {ascript-1.2.2 → ascript-1.2.4}/pyproject.toml +1 -1
  13. ascript-1.2.2/ascript/windows/screen.py +0 -314
  14. {ascript-1.2.2 → ascript-1.2.4}/MANIFEST.in +0 -0
  15. {ascript-1.2.2 → ascript-1.2.4}/README.md +0 -0
  16. {ascript-1.2.2 → ascript-1.2.4}/ascript/__init__.py +0 -0
  17. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/__init__.py +0 -0
  18. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/action/__init__.py +0 -0
  19. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/action/ashid.py +0 -0
  20. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/cloud_control.py +0 -0
  21. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/data.py +0 -0
  22. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/media.py +0 -0
  23. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/node.py +0 -0
  24. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/plug.py +0 -0
  25. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/screen/__init__.py +0 -0
  26. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/screen/ascv.py +0 -0
  27. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/screen/color_tools.py +0 -0
  28. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/screen/gp.py +0 -0
  29. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/screen/gp_tasks.py +0 -0
  30. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/screen/gp_tool.py +0 -0
  31. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/shizuku/__init__.py +0 -0
  32. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/system/__init__.py +0 -0
  33. {ascript-1.2.2 → ascript-1.2.4}/ascript/android/ui.py +0 -0
  34. {ascript-1.2.2 → ascript-1.2.4}/ascript/hooks/__init__.py +0 -0
  35. {ascript-1.2.2 → ascript-1.2.4}/ascript/hooks/hook-ascript.py +0 -0
  36. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/__init__.py +0 -0
  37. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/action/__init__.py +0 -0
  38. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/__init__.py +0 -0
  39. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/__init__.py +0 -0
  40. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/api_2_android.py +0 -0
  41. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/api_code.py +0 -0
  42. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/api_file.py +0 -0
  43. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/api_label.py +0 -0
  44. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/api_module.py +0 -0
  45. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/api_node.py +0 -0
  46. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/api_screen.py +0 -0
  47. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/api_tool.py +0 -0
  48. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/dao.py +0 -0
  49. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/data.py +0 -0
  50. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/file_utils.py +0 -0
  51. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/label_utils.py +0 -0
  52. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/line_helper.py +0 -0
  53. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/oc.py +0 -0
  54. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/oc_gp.py +0 -0
  55. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/sp_utils.py +0 -0
  56. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/utils.py +0 -0
  57. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/api/wda_gp.py +0 -0
  58. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/developer/ws.py +0 -0
  59. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/ime.py +0 -0
  60. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/media.py +0 -0
  61. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/node.py +0 -0
  62. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/screen/__init__.py +0 -0
  63. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/screen/ascv.py +0 -0
  64. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/screen/color_tools.py +0 -0
  65. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/screen/dao.py +0 -0
  66. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/screen/gp.py +0 -0
  67. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/screen/yolov8.py +0 -0
  68. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/system/__init__.py +0 -0
  69. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/system/device.py +0 -0
  70. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/ui.py +0 -0
  71. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/__init__.py +0 -0
  72. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/_alert.py +0 -0
  73. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/_base.py +0 -0
  74. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/_node.py +0 -0
  75. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/_proto.py +0 -0
  76. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/_types.py +0 -0
  77. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/_utils.py +0 -0
  78. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/_wdapy.py +0 -0
  79. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/_wrap.py +0 -0
  80. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/exceptions.py +0 -0
  81. {ascript-1.2.2 → ascript-1.2.4}/ascript/ios/wdapy/xcui_element_types.py +0 -0
  82. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/daos/__init__.py +0 -0
  83. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/daos/screen.py +0 -0
  84. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/license/__init__.py +0 -0
  85. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/license/achttp.cp310-win_amd64.pyd +0 -0
  86. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/license/achttp.cp311-win_amd64.pyd +0 -0
  87. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/license/achttp.cp312-win_amd64.pyd +0 -0
  88. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/license/achttp.cp313-win_amd64.pyd +0 -0
  89. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/license/achttp.cp314-win_amd64.pyd +0 -0
  90. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/license/achttp.cp38-win_amd64.pyd +0 -0
  91. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/license/achttp.cp39-win_amd64.pyd +0 -0
  92. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/media/__init__.py +0 -0
  93. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/resources/__init__.py +0 -0
  94. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/resources/templates/__init__.py +0 -0
  95. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/resources/templates/__init__py.win.template +0 -0
  96. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/resources/templates/build.as.win.template +0 -0
  97. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/resources/templates/build.py +0 -0
  98. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/resources/templates/logo_windows.ico +0 -0
  99. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/resources/templates/windows/main.py +0 -0
  100. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/resources/templates/windows/res/img/logo.ico +0 -0
  101. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/screen/__init__.py +0 -0
  102. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/screen/as_cv.py +0 -0
  103. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/screen/find_colors.py +0 -0
  104. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/screen/find_images.py +0 -0
  105. {ascript-1.2.2/ascript/windows/tools/gpplug → ascript-1.2.4/ascript/windows/screen/ocr}/__init__.py +0 -0
  106. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/screen/screen_core.py +0 -0
  107. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/store/__init__.py +0 -0
  108. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/system/__init__.py +0 -0
  109. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/system/device.py +0 -0
  110. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/system/easy_print.py +0 -0
  111. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/system/env.py +0 -0
  112. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/system/exception/__init__.py +0 -0
  113. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/system/key_value.py +0 -0
  114. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/system/pip.py +0 -0
  115. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/system/r.py +0 -0
  116. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/system/runtime.py +0 -0
  117. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__init__.py +0 -0
  118. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/__init__.cpython-310.pyc +0 -0
  119. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/__init__.cpython-312.pyc +0 -0
  120. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/__init__.cpython-313.pyc +0 -0
  121. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/__init__.cpython-39.pyc +0 -0
  122. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/action.cpython-310.pyc +0 -0
  123. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/action.cpython-312.pyc +0 -0
  124. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/action.cpython-313.pyc +0 -0
  125. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/action.cpython-39.pyc +0 -0
  126. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/colors_tool.cpython-310.pyc +0 -0
  127. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/colors_tool.cpython-312.pyc +0 -0
  128. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/colors_tool.cpython-313.pyc +0 -0
  129. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/colors_tool.cpython-39.pyc +0 -0
  130. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/config.cpython-310.pyc +0 -0
  131. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/config.cpython-312.pyc +0 -0
  132. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/config.cpython-313.pyc +0 -0
  133. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/config.cpython-39.pyc +0 -0
  134. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/dumptool.cpython-310.pyc +0 -0
  135. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/dumptool.cpython-312.pyc +0 -0
  136. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/dumptool.cpython-313.pyc +0 -0
  137. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/dumptool.cpython-39.pyc +0 -0
  138. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/eel_api.cpython-310.pyc +0 -0
  139. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/eel_api.cpython-312.pyc +0 -0
  140. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/eel_api.cpython-313.pyc +0 -0
  141. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/eel_api.cpython-39.pyc +0 -0
  142. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/mouse_catch.cpython-310.pyc +0 -0
  143. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/mouse_catch.cpython-312.pyc +0 -0
  144. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/mouse_catch.cpython-313.pyc +0 -0
  145. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/mouse_catch.cpython-39.pyc +0 -0
  146. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/plug_manager.cpython-310.pyc +0 -0
  147. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/plug_manager.cpython-312.pyc +0 -0
  148. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/plug_manager.cpython-313.pyc +0 -0
  149. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/__pycache__/plug_manager.cpython-39.pyc +0 -0
  150. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/action.json +0 -0
  151. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/action.py +0 -0
  152. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/colors_tool.py +0 -0
  153. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/config.py +0 -0
  154. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/dumptool.py +0 -0
  155. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/eel_api.py +0 -0
  156. {ascript-1.2.2/ascript/windows/utils → ascript-1.2.4/ascript/windows/tools/gpplug}/__init__.py +0 -0
  157. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/gpplug/__pycache__/__init__.cpython-310.pyc +0 -0
  158. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/gpplug/__pycache__/__init__.cpython-312.pyc +0 -0
  159. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/gpplug/__pycache__/__init__.cpython-313.pyc +0 -0
  160. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/gpplug/__pycache__/__init__.cpython-39.pyc +0 -0
  161. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/gpplug/__pycache__/plug.cpython-310.pyc +0 -0
  162. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/gpplug/__pycache__/plug.cpython-312.pyc +0 -0
  163. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/gpplug/__pycache__/plug.cpython-313.pyc +0 -0
  164. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/gpplug/__pycache__/plug.cpython-39.pyc +0 -0
  165. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/gpplug/plug.py +0 -0
  166. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/mouse_catch.py +0 -0
  167. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/plug_manager.py +0 -0
  168. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/app_store_window.html +0 -0
  169. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/colors.html +0 -0
  170. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/css/screen.css +0 -0
  171. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/css/viewtree.css +0 -0
  172. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/flot_control.html +0 -0
  173. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/img/ico/favicon.png +0 -0
  174. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/img/ico/paintpalette.png +0 -0
  175. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/img/svg/find_colors.svg +0 -0
  176. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/img/svg/find_images.svg +0 -0
  177. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/img/svg/illustration-6.svg +0 -0
  178. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/img/svg/img_default.svg +0 -0
  179. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/img/svg/ocr.svg +0 -0
  180. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/screen/colors.js +0 -0
  181. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/screen/gp_plug.js +0 -0
  182. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/screen/image_mouse.js +0 -0
  183. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/screen/img_view.js +0 -0
  184. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/screen/plug.js +0 -0
  185. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/screen/screen.js +0 -0
  186. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/screen/screen_api.js +0 -0
  187. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/screen/screen_maker.js +0 -0
  188. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/utils/map.js +0 -0
  189. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/utils/upload.js +0 -0
  190. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/viewtree/niv_js.js +0 -0
  191. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/js/viewtree/vtree.js +0 -0
  192. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/bootstrap/css/bootstrap.min.css +0 -0
  193. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/bootstrap/js/bootstrap.bundle.min.js +0 -0
  194. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/bootstrap-icons/0-circle.svg +0 -0
  195. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/bootstrap-icons/0-square.svg +0 -0
  196. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.css +0 -0
  197. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.json +0 -0
  198. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.min.css +0 -0
  199. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/bootstrap-icons/font/bootstrap-icons.scss +0 -0
  200. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/bootstrap-icons/font/fonts/bootstrap-icons.woff +0 -0
  201. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/bootstrap-icons/font/fonts/bootstrap-icons.woff2 +0 -0
  202. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/feather-icons/dist/feather.min.js +0 -0
  203. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/feather-icons/dist/icons.json +0 -0
  204. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery/core.js +0 -0
  205. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery/jquery.js +0 -0
  206. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery/jquery.min.js +0 -0
  207. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery/jquery.min.js.zip +0 -0
  208. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery/jquery.slim.js +0 -0
  209. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery/jquery.slim.min.js +0 -0
  210. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-menu/jquery.contextMenu.js +0 -0
  211. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-menu/jquery.contextMenu.min.css +0 -0
  212. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/css/zTreeStyle.css +0 -0
  213. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/diy/1_close.png +0 -0
  214. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/diy/1_open.png +0 -0
  215. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/diy/2.png +0 -0
  216. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/diy/3.png +0 -0
  217. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/diy/4.png +0 -0
  218. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/diy/5.png +0 -0
  219. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/diy/6.png +0 -0
  220. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/diy/7.png +0 -0
  221. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/diy/8.png +0 -0
  222. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/diy/9.png +0 -0
  223. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/line_conn.gif +0 -0
  224. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/loading.gif +0 -0
  225. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/tree-node-btn.png +0 -0
  226. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/zTreeStandard.gif +0 -0
  227. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/img/zTreeStandard.png +0 -0
  228. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/jquery-zTree/js/jquery.ztree.all.min.js +0 -0
  229. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/css/jquery.treeview.css +0 -0
  230. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/file.png +0 -0
  231. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/ico_loading.png +0 -0
  232. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/icon4.png +0 -0
  233. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/icon5.png +0 -0
  234. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/icon6.png +0 -0
  235. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/py.png +0 -0
  236. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/treeview-black-line.gif +0 -0
  237. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/treeview-black.gif +0 -0
  238. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/treeview-default-line.gif +0 -0
  239. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/treeview-default.gif +0 -0
  240. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/treeview-famfamfam-line.gif +0 -0
  241. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/treeview-famfamfam.gif +0 -0
  242. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/treeview-gray-line.gif +0 -0
  243. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/treeview-gray.gif +0 -0
  244. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/treeview-red-line.gif +0 -0
  245. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/img/treeview-red.gif +0 -0
  246. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/js/jquery.treeview.edit.js +0 -0
  247. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/libs/treeview/js/jquery.treeview.js +0 -0
  248. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/license_window.html +0 -0
  249. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/plugs/a.html +0 -0
  250. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/plugs/demo.html +0 -0
  251. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/plugs/find_colors.html +0 -0
  252. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/plugs/find_images.html +0 -0
  253. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/plugs/rapidocr.html +0 -0
  254. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/tools/web/vtree.html +0 -0
  255. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/ui/__init__.py +0 -0
  256. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/ui/app_store_window.py +0 -0
  257. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/ui/draw_window.py +0 -0
  258. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/ui/flot_test.py +0 -0
  259. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/ui/flot_window.py +0 -0
  260. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/ui/license_window.py +0 -0
  261. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/ui/web_window.py +0 -0
  262. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/utils/node_utils.py +0 -0
  263. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/utils/screen_utils.py +0 -0
  264. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/window/Selector.py +0 -0
  265. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/window/Window.py +0 -0
  266. {ascript-1.2.2 → ascript-1.2.4}/ascript/windows/window/launcher.py +0 -0
  267. {ascript-1.2.2 → ascript-1.2.4}/ascript.egg-info/dependency_links.txt +0 -0
  268. {ascript-1.2.2 → ascript-1.2.4}/ascript.egg-info/requires.txt +0 -0
  269. {ascript-1.2.2 → ascript-1.2.4}/ascript.egg-info/top_level.txt +0 -0
  270. {ascript-1.2.2 → ascript-1.2.4}/docs/source/_build/_sources/autoapi/ascript/windows/client/tools/index.rst.txt +0 -0
  271. {ascript-1.2.2 → ascript-1.2.4}/docs/source/_build/autoapi/ascript/windows/client/tools/index.html +0 -0
  272. {ascript-1.2.2 → ascript-1.2.4}/docs/source/build_index.py +0 -0
  273. {ascript-1.2.2 → ascript-1.2.4}/docs/source/conf.py +0 -0
  274. {ascript-1.2.2 → ascript-1.2.4}/docs/source/doc_extractor.py +0 -0
  275. {ascript-1.2.2 → ascript-1.2.4}/docs/source/generate_api_data.py +0 -0
  276. {ascript-1.2.2 → ascript-1.2.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ascript
3
- Version: 1.2.2
3
+ Version: 1.2.4
4
4
  Summary: Ascript Developer Library
5
5
  License: MIT
6
6
  Classifier: Operating System :: Microsoft :: Windows
@@ -7,4 +7,9 @@ _current_dir = os.path.dirname(os.path.abspath(__file__))
7
7
  # 关键:将 windows 目录加入搜索路径
8
8
  # 这样其下的子模块 license 就能直接 import 旁边的 pyarmor_runtime_000000
9
9
  if _current_dir not in sys.path:
10
- sys.path.insert(0, _current_dir)
10
+ sys.path.insert(0, _current_dir)
11
+
12
+
13
+ from ascript.windows.screen.ocr import rapidocr_hook
14
+ # 静默植入 rapidocr find方法
15
+ rapidocr_hook.install()
@@ -0,0 +1,5 @@
1
+
2
+ from . import keyboard,mouse
3
+
4
+ __all__ = ["keyboard","mouse"]
5
+
@@ -0,0 +1,34 @@
1
+ import pyautogui
2
+ import pyperclip
3
+ import time
4
+ from typing import Union, List, Optional
5
+
6
+ def input(msg: str, interval: float = 0.0):
7
+ """自动识别中英文并输入"""
8
+ # 检查是否包含非 ASCII 字符(如中文)
9
+ if any(ord(c) > 127 for c in msg):
10
+ pyperclip.copy(msg)
11
+ time.sleep(0.1) # 给剪贴板一点缓冲时间,防止粘贴失败
12
+ pyautogui.hotkey('ctrl', 'v')
13
+ else:
14
+ # typewrite 已逐步被 write 取代,推荐使用 write
15
+ pyautogui.write(msg, interval=interval)
16
+
17
+ def key(keys: Union[str, List[str]], presses: int = 1, interval: float = 0.0):
18
+ """按下指定按键"""
19
+ pyautogui.press(keys, presses=presses, interval=interval)
20
+
21
+ def key_hot(*args):
22
+ """
23
+ 组合键操作,例如: key_hot('ctrl', 'c')
24
+ 修正了原先参数传递的错误
25
+ """
26
+ pyautogui.hotkey(*args)
27
+
28
+ def key_down(key_str: str):
29
+ """按下按键不松开"""
30
+ pyautogui.keyDown(key_str)
31
+
32
+ def key_up(key_str: str):
33
+ """松开按键"""
34
+ pyautogui.keyUp(key_str)
@@ -1,7 +1,5 @@
1
1
  import pyautogui
2
- import pyperclip
3
- import time
4
- from typing import Union, List, Optional
2
+
5
3
 
6
4
  # 常量定义
7
5
  LEFT = "left"
@@ -48,32 +46,3 @@ def mouse_up(x: int = None, y: int = None, button: str = PRIMARY, duration: floa
48
46
  """松开鼠标按键"""
49
47
  pyautogui.mouseUp(x=x, y=y, button=button, duration=duration, tween=tween)
50
48
 
51
- def input(msg: str, interval: float = 0.0):
52
- """自动识别中英文并输入"""
53
- # 检查是否包含非 ASCII 字符(如中文)
54
- if any(ord(c) > 127 for c in msg):
55
- pyperclip.copy(msg)
56
- time.sleep(0.1) # 给剪贴板一点缓冲时间,防止粘贴失败
57
- pyautogui.hotkey('ctrl', 'v')
58
- else:
59
- # typewrite 已逐步被 write 取代,推荐使用 write
60
- pyautogui.write(msg, interval=interval)
61
-
62
- def key(keys: Union[str, List[str]], presses: int = 1, interval: float = 0.0):
63
- """按下指定按键"""
64
- pyautogui.press(keys, presses=presses, interval=interval)
65
-
66
- def key_hot(*args):
67
- """
68
- 组合键操作,例如: key_hot('ctrl', 'c')
69
- 修正了原先参数传递的错误
70
- """
71
- pyautogui.hotkey(*args)
72
-
73
- def key_down(key_str: str):
74
- """按下按键不松开"""
75
- pyautogui.keyDown(key_str)
76
-
77
- def key_up(key_str: str):
78
- """松开按键"""
79
- pyautogui.keyUp(key_str)
@@ -10,7 +10,9 @@ readme = "README.md"
10
10
  requires-python = ">=3.9"
11
11
  license = {text = "MIT"}
12
12
  dependencies = [
13
- "ascript"
13
+ "ascript",
14
+ # "rapidocr==3.5.0",
15
+ # "onnxruntime==1.23.2"
14
16
  ]
15
17
 
16
18
  [tool.setuptools]
@@ -0,0 +1,174 @@
1
+ import sys
2
+ import re
3
+ import importlib.abc
4
+ import importlib.util
5
+ import importlib
6
+ from dataclasses import dataclass, asdict
7
+ from typing import List, Optional, Tuple, Union, TYPE_CHECKING
8
+
9
+ # 假设你的硬件操作模块路径如下
10
+ from ...hardware import mouse
11
+
12
+ # --- 1. 类型存根 (仅用于 PyCharm 等 IDE 的代码补全提示) ---
13
+ if TYPE_CHECKING:
14
+ try:
15
+ from rapidocr.utils.output import RapidOCROutput as BaseOutput
16
+ except ImportError:
17
+ class BaseOutput:
18
+ pass
19
+
20
+
21
+ class RapidOCROutput(BaseOutput):
22
+ """IDE 提示:使 RapidOCR 的返回结果具备 find 和 find_all 方法"""
23
+
24
+ def find(self, text_re: str = None, score: float = 0.85) -> 'OCRItem': ...
25
+
26
+ def find_all(self, text_re: str = None, score: float = 0.85) -> List['OCRItem']: ...
27
+
28
+
29
+ # --- 2. 核心结果对象定义 ---
30
+
31
+ @dataclass
32
+ class OCRItem:
33
+ """真实的识别结果对象"""
34
+ txt: str
35
+ box: List[List[float]]
36
+ score: float
37
+ center: Tuple[int, int] # 截图内的相对坐标
38
+ rect: List[int] # [l, t, r, b]
39
+
40
+ def click(self, window=None):
41
+ """
42
+ 点击目标
43
+ :param window: 可选,传入 ascript 的 Window 对象。
44
+ 如果传入,则调用 window.click(x, y) 进行窗口内相对点击;
45
+ 如果不传,则调用全局 mouse.click(x, y) 进行全屏点击。
46
+ """
47
+ x, y = self.center
48
+ if window:
49
+ # 让窗口对象处理相对坐标点击
50
+ print("窗口点击")
51
+ window.click(x, y)
52
+ else:
53
+ # 全屏绝对点击
54
+ mouse.click(x, y)
55
+ return self
56
+
57
+ def to_dict(self) -> dict:
58
+ """转换为字典格式"""
59
+ return asdict(self)
60
+
61
+ def __bool__(self):
62
+ """支持 if item: 语法"""
63
+ return True
64
+
65
+ def __repr__(self):
66
+ return f"<OCRItem txt='{self.txt}' score={self.score:.2f} center={self.center}>"
67
+
68
+
69
+ class NullOCRItem:
70
+ """空对象:当 find 找不到结果时返回,防止链式调用报错"""
71
+
72
+ def __init__(self):
73
+ self.txt, self.box, self.score = "", [], 0.0
74
+ self.center, self.rect = (0, 0), [0, 0, 0, 0]
75
+
76
+ def click(self, window=None):
77
+ """静默处理,什么都不做"""
78
+ return self
79
+
80
+ def to_dict(self) -> dict:
81
+ return {}
82
+
83
+ def __bool__(self):
84
+ """支持 if not item: 语法"""
85
+ return False
86
+
87
+ def __repr__(self):
88
+ return "<NullOCRItem (Not Found)>"
89
+
90
+
91
+ # --- 3. 运行时 Hook 逻辑 ---
92
+
93
+ class RapidOCRHook(importlib.abc.MetaPathFinder):
94
+ def find_spec(self, fullname, path, target=None):
95
+ # 监听 RapidOCR 的核心输出模块
96
+ if fullname == "rapidocr.utils.output":
97
+ importlib.invalidate_caches() # 动态感知新安装的包
98
+ try:
99
+ spec = importlib.util.find_spec(fullname)
100
+ if spec is None: return None
101
+
102
+ if self in sys.meta_path:
103
+ sys.meta_path.remove(self)
104
+
105
+ module = importlib.util.module_from_spec(spec)
106
+ spec.loader.exec_module(module)
107
+ self._patch(module)
108
+ sys.modules[fullname] = module
109
+ return spec
110
+ except Exception:
111
+ return None
112
+ return None
113
+
114
+ def _patch(self, module):
115
+ """执行动态植入方法"""
116
+
117
+ def _build_item(txt, box, score) -> OCRItem:
118
+ """构建结果对象"""
119
+ l, t = float(box[0][0]), float(box[0][1])
120
+ r, b = float(box[2][0]), float(box[2][1])
121
+ center = (int((l + r) / 2), int((t + b) / 2))
122
+ rect = [int(l), int(t), int(r), int(b)]
123
+ return OCRItem(
124
+ txt=str(txt),
125
+ box=box.tolist() if hasattr(box, 'tolist') else box,
126
+ score=float(score),
127
+ center=center,
128
+ rect=rect
129
+ )
130
+
131
+ def find(self, text_re: str = None, score: float = 0.85) -> Union[OCRItem, NullOCRItem]:
132
+ """查找单个结果"""
133
+ txts, boxes, scores = getattr(self, 'txts', None), getattr(self, 'boxes', None), getattr(self, 'scores',
134
+ None)
135
+ if txts is not None and boxes is not None:
136
+ for i in range(len(txts)):
137
+ if scores[i] >= score:
138
+ if text_re is None or re.search(text_re, str(txts[i])):
139
+ return _build_item(txts[i], boxes[i], scores[i])
140
+ return NullOCRItem()
141
+
142
+ def find_all(self, text_re: str = None, score: float = 0.85) -> List[OCRItem]:
143
+ """查找所有结果并按坐标排序"""
144
+ results = []
145
+ txts, boxes, scores = getattr(self, 'txts', None), getattr(self, 'boxes', None), getattr(self, 'scores',
146
+ None)
147
+ if txts is not None and boxes is not None:
148
+ for i in range(len(txts)):
149
+ if scores[i] >= score:
150
+ if text_re is None or re.search(text_re, str(txts[i])):
151
+ results.append(_build_item(txts[i], boxes[i], scores[i]))
152
+
153
+ # 按从上到下、从左到右排序
154
+ results.sort(key=lambda x: (x.center[1], x.center[0]))
155
+ return results
156
+
157
+ # 将方法绑定到目标类
158
+ target_class = "RapidOCROutput"
159
+ if hasattr(module, target_class):
160
+ cls = getattr(module, target_class)
161
+ if not hasattr(cls, "find"):
162
+ cls.find = find
163
+ cls.find_all = find_all
164
+ print(f"✅ [RapidOCR-Hook] 成功注入 find/find_all 扩展")
165
+
166
+
167
+ def install():
168
+ """入口函数:确保 Hook 被注册"""
169
+ target_mod = "rapidocr.utils.output"
170
+ if target_mod in sys.modules:
171
+ RapidOCRHook()._patch(sys.modules[target_mod])
172
+ return
173
+ if not any(isinstance(h, RapidOCRHook) for h in sys.meta_path):
174
+ sys.meta_path.insert(0, RapidOCRHook())
File without changes
@@ -1,5 +1,8 @@
1
1
  from .Window import Window
2
2
  from .Selector import Selector
3
3
 
4
+
5
+
6
+
4
7
  __all__ = ["Window", "Selector"]
5
8
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ascript
3
- Version: 1.2.2
3
+ Version: 1.2.4
4
4
  Summary: Ascript Developer Library
5
5
  License: MIT
6
6
  Classifier: Operating System :: Microsoft :: Windows
@@ -73,10 +73,11 @@ ascript/ios/wdapy/_wrap.py
73
73
  ascript/ios/wdapy/exceptions.py
74
74
  ascript/ios/wdapy/xcui_element_types.py
75
75
  ascript/windows/__init__.py
76
- ascript/windows/mouse.py
77
- ascript/windows/screen.py
78
76
  ascript/windows/daos/__init__.py
79
77
  ascript/windows/daos/screen.py
78
+ ascript/windows/hardware/__init__.py
79
+ ascript/windows/hardware/keyboard.py
80
+ ascript/windows/hardware/mouse.py
80
81
  ascript/windows/license/__init__.py
81
82
  ascript/windows/license/achttp.cp310-win_amd64.pyd
82
83
  ascript/windows/license/achttp.cp311-win_amd64.pyd
@@ -100,6 +101,8 @@ ascript/windows/screen/as_cv.py
100
101
  ascript/windows/screen/find_colors.py
101
102
  ascript/windows/screen/find_images.py
102
103
  ascript/windows/screen/screen_core.py
104
+ ascript/windows/screen/ocr/__init__.py
105
+ ascript/windows/screen/ocr/rapidocr_hook.py
103
106
  ascript/windows/store/__init__.py
104
107
  ascript/windows/system/__init__.py
105
108
  ascript/windows/system/device.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ascript"
7
- version = "1.2.2"
7
+ version = "1.2.4"
8
8
  description = "Ascript Developer Library"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -1,314 +0,0 @@
1
- import re
2
- import sys
3
- from urllib.parse import unquote
4
- import pyautogui
5
- import win32gui
6
- from PIL import ImageGrab, Image
7
-
8
- from ascript.windows.daos.screen import Size, Point, OcrRes
9
- from ascript.windows.utils import screen_utils
10
- import numpy as np
11
- from ascript.windows.window import Window
12
-
13
- def size(hwnd: int = None, rect=None) -> Image:
14
- temp_img = None
15
- if hwnd != 0 and hwnd is not None:
16
- psize = pyautogui.size()
17
- return Size(psize.width, psize.height)
18
- else:
19
- win = Window(hwnd)
20
- return Size(win.width, win.height)
21
-
22
-
23
- def capture(hwnd: int = None, rect=None) -> Image:
24
- temp_img = None
25
- if hwnd != 0 and hwnd is not None:
26
- temp_rect = win32gui.GetWindowRect(hwnd)
27
- temp_img = ImageGrab.grab(temp_rect)
28
- else:
29
- temp_img = ImageGrab.grab()
30
-
31
- if rect:
32
- temp_img = temp_img.crop(rect)
33
- return temp_img
34
-
35
-
36
- def get_color(x, y):
37
- img = capture()
38
- return img.getpixel((x, y))
39
-
40
-
41
- def find_colors(colors: str = None, rect=[], sim: float = 0.9, ore: int = 2, space: int = 5, file: str = None,res_num:int=1):
42
- if res_num>1:
43
- return FindColors(colors, rect, sim, ore, space, file).find()
44
- else:
45
- return FindColors(colors, rect, sim, ore, space, file).find_all(res_num)
46
-
47
-
48
- def compare_colors( colors: str = None, sim: float = 0.9, img_file: str = None):
49
- return CompareColors(colors,sim,img_file)
50
-
51
- def cor(rect=[], pattern: str = None, confidence: float = 0.1, img_file: str = None,res_num:int =0):
52
- if res_num ==1:
53
- return Ocr(rect,pattern=pattern,confidence= confidence,img_path= img_file).find()
54
- else:
55
- return Ocr(rect, pattern=pattern, confidence=confidence, img_path=img_file).find_all(res_num)
56
-
57
- def find_images(img_part: str = None, rect=None, source_file: str = None, confidence: float = 0.1,res_num:int=1):
58
- findimg = FindImages(img_part= img_part,source_rect=rect,source_file=source_file,confidence=confidence)
59
- if res_num==1:
60
- return findimg.find()
61
- else:
62
- return findimg.find_all()
63
-
64
- def find_images_template(img_part: str = None, source_rect=None, source_file: str = None, confidence: float = 0.1,res_num:int=1, threshold=0.5, rgb=False, bgremove=False):
65
- findimg = FindImages(img_part= img_part,source_rect=source_rect,source_file=source_file,confidence=confidence)
66
- if res_num==1:
67
- return findimg.find_template(threshold= threshold,bgremove=bgremove,rgb=rgb)
68
- else:
69
- return findimg.find_all_template(maxcnt=res_num)
70
-
71
- def find_images_sift(img_part: str = None, rect=None, source_file: str = None, confidence: float = 0.1,res_num:int=1, min_match_count: int = 4):
72
- findimg = FindImages(img_part= img_part,source_rect=rect,source_file=source_file,confidence=confidence)
73
- if res_num==1:
74
- return findimg.find_sift(min_match_count= min_match_count)
75
- else:
76
- return findimg.find_all_sift(min_match_count= min_match_count)
77
-
78
- class FindColors:
79
- def __init__(self, colors: str = None, rect=[], sim: float = 0.9, ore: int = 2, space: int = 5, file: str = None,
80
- dict_p: dict = None):
81
- self.rect = rect
82
- self.colors = colors
83
- self.sim = sim
84
- self.ore = ore
85
- self.space = space
86
- self.res_num = 1
87
- self.file = file
88
-
89
- if dict_p:
90
- if 'colors' in dict_p:
91
- self.colors = dict_p['colors']
92
-
93
- if 'rect' in dict_p:
94
- self.rect = dict_p['rect']
95
-
96
- if 'sim' in dict_p:
97
- self.sim = float(dict_p['sim'])
98
-
99
- if 'ore' in dict_p:
100
- self.ore = int(dict_p['ore'])
101
-
102
- if 'space' in dict_p:
103
- self.space = int(dict_p['space'])
104
-
105
- if 'file' in dict_p:
106
- self.file = unquote(dict_p['file'])
107
-
108
- if 'res_num' in dict_p:
109
- self.res_num = int(dict_p['res_num'])
110
-
111
- def find(self):
112
- self.res_num = 1
113
- res = self.exec_find()
114
- if res and len(res) > 0:
115
- return res[0]
116
- return None
117
-
118
- def find_all(self, res_num=sys.maxsize):
119
- self.res_num = res_num
120
- res = self.exec_find()
121
- if res or len(res) > 0:
122
- return res
123
- return None
124
-
125
- def exec_find(self):
126
- # 获取截图
127
- img = None
128
- if self.file:
129
- img = Image.open(self.file)
130
- else:
131
- img = ImageGrab.grab()
132
-
133
- if self.rect and len(self.rect) == 4:
134
- img = img.crop(self.rect)
135
-
136
- # 回填 坐标
137
- ps = screen_utils.find_colors(self.colors, self.sim, self.res_num, self.ore, img, self.space)
138
- if ps and self.rect and len(self.rect) == 4:
139
- for i in range(len(ps)):
140
- ps[i] = Point(ps[i].x + self.rect[0], ps[i].y + self.rect[1])
141
-
142
- return ps
143
-
144
-
145
- class CompareColors:
146
- def __init__(self, colors: str = None, sim: float = 0.9, img_file: str = None, dict_p: dict = None):
147
- self.colors = colors
148
- self.sim = sim
149
- self.img_file = img_file
150
- if dict_p:
151
- if 'colors' in dict_p:
152
- self.colors = dict_p['colors']
153
-
154
- if 'sim' in dict_p:
155
- self.sim = float(dict_p['sim'])
156
-
157
- if 'path' in dict_p:
158
- self.img_file = unquote(dict_p['path'])
159
-
160
- def compare(self):
161
- if self.img_file:
162
- img = Image.open(self.img_file)
163
- else:
164
- img = capture()
165
-
166
- return screen_utils.compare_colors(self.colors, self.sim, img)
167
-
168
-
169
- class Ocr:
170
-
171
- easyOcr = None
172
-
173
- def easyocr_find(rect=[], pattern: str = None, confidence: float = 0.1, img_path: str = None,
174
- dict_p: dict = None):
175
-
176
- return None
177
-
178
-
179
- def __init__(self, rect=[], pattern: str = None, confidence: float = 0.1, img_path: str = None,
180
- dict_p: dict = None):
181
-
182
- self.rect = rect
183
- self.pattern = pattern
184
- self.confidence = confidence
185
- self.img_path = img_path
186
- # self.ocr = PaddleOCR(ocr_version='PP-OCRv3')
187
-
188
- if dict_p:
189
- if 'rect' in dict_p:
190
- self.rect = dict_p['rect']
191
-
192
- if 'pattern' in dict_p:
193
- self.pattern = dict_p['pattern']
194
-
195
- if 'img_path' in dict_p:
196
- self.img_path = unquote(dict_p['img_path'])
197
-
198
- if 'confidence' in dict_p:
199
- self.sim = float(dict_p['confidence'])
200
-
201
- if 'findtype' in dict_p:
202
- if dict_p['findtype'] == 'find':
203
- self.res_num = 1
204
- else:
205
- self.res_num = 0
206
-
207
- # from easyocr import Reader
208
- #
209
- # self.ocr = Reader(['en', 'ch_sim'])
210
-
211
- from paddleocr import PaddleOCR
212
- self.ocr = PaddleOCR()
213
-
214
- def find(self) -> OcrRes:
215
- self.res_num = 1
216
- res = self.exec_find_paddle()
217
- if res:
218
- return res[0]
219
- return None
220
-
221
- def find_all(self, res_num: int = 0) -> [OcrRes]:
222
- self.res_num = res_num
223
- res = self.exec_find_paddle()
224
- return res
225
-
226
- def exec_find(self):
227
- if self.img_path:
228
- img = Image.open(self.img_path)
229
- else:
230
- img = capture(rect=self.rect)
231
-
232
- if self.rect and len(self.rect) == 4:
233
- img = img.crop(self.rect)
234
-
235
- # res_source = self.ocr.readtext(np.array(img))
236
-
237
- res_source = self.ocr.ocr(np.array(img))
238
-
239
- print(res_source)
240
-
241
- res = []
242
- if res_source:
243
- for r in res_source:
244
- if self.pattern:
245
- pattern = re.compile(self.pattern)
246
- if r[2] >= self.confidence and (self.pattern is None or pattern.match(r[1])):
247
-
248
- offsetx = 0
249
- offsety = 0
250
- if self.rect:
251
- offsetx = self.rect[0]
252
- offsety = self.rect[1]
253
-
254
- region_position = r[0]
255
- region_position = [[int(region_position[0][0]) + offsetx, int(region_position[0][1]) + offsety],
256
- [int(region_position[1][0]) + offsetx, int(region_position[1][1]) + offsety],
257
- [int(region_position[2][0]) + offsetx, int(region_position[2][1]) + offsety],
258
- [int(region_position[3][0]) + offsetx, int(region_position[3][1]) + offsety]]
259
-
260
- if self.res_num == 0:
261
- res.append(OcrRes(text=r[1], confidence=r[2], region_position=region_position))
262
- elif len(res) < self.res_num:
263
- res.append(OcrRes(text=r[1], confidence=r[2], region_position=region_position))
264
- else:
265
- return res
266
-
267
- return res
268
-
269
- def exec_find_paddle(self):
270
- if self.img_path:
271
- img = Image.open(self.img_path)
272
- else:
273
- img = capture(rect=self.rect)
274
-
275
- if self.rect and len(self.rect) == 4:
276
- img = img.crop(self.rect)
277
-
278
- res_source = self.ocr.ocr(np.array(img))
279
- res = []
280
- if res_source and res_source[0]:
281
- for r in res_source[0]:
282
-
283
- if self.pattern:
284
- pattern = re.compile(self.pattern)
285
- # [ [[238.0, 12.0], [330.0, 12.0], [330.0, 40.0], [238.0, 40.0]], ('版本控制', 0.9998359680175781)]
286
-
287
- if r[1][1] >= self.confidence and (self.pattern is None or pattern.match(r[1][0])):
288
-
289
- offsetx = 0
290
- offsety = 0
291
- if self.rect:
292
- offsetx = int(self.rect[0])
293
- offsety = int(self.rect[1])
294
-
295
- region_position = r[0]
296
- region_position = [[int(region_position[0][0]) + offsetx, int(region_position[0][1]) + offsety],
297
- [int(region_position[1][0]) + offsetx, int(region_position[1][1]) + offsety],
298
- [int(region_position[2][0]) + offsetx, int(region_position[2][1]) + offsety],
299
- [int(region_position[3][0]) + offsetx, int(region_position[3][1]) + offsety]]
300
-
301
- if self.res_num == 0:
302
- res.append(OcrRes(text=r[1][0], confidence=r[1][1], region_position=region_position))
303
- elif len(res) < self.res_num:
304
- res.append(OcrRes(text=r[1][0], confidence=r[1][1], region_position=region_position))
305
- else:
306
- return res
307
-
308
- return res
309
-
310
- def to_dict(self):
311
- pass
312
-
313
-
314
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes