PyClickerRPA 0.1.0__py3-none-any.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.
- autoclicker/__init__.py +14 -0
- autoclicker/app.py +21 -0
- autoclicker/capture.py +94 -0
- autoclicker/clicker.py +212 -0
- autoclicker/dpi.py +30 -0
- autoclicker/gui/__init__.py +1 -0
- autoclicker/gui/flow_connection.py +91 -0
- autoclicker/gui/flow_editor.py +340 -0
- autoclicker/gui/flow_node.py +107 -0
- autoclicker/gui/hotkeys.py +40 -0
- autoclicker/gui/main_window.py +651 -0
- autoclicker/gui/monitor.py +84 -0
- autoclicker/gui/preview_label.py +176 -0
- autoclicker/gui/qt_runner.py +71 -0
- autoclicker/gui/recorder.py +163 -0
- autoclicker/gui/scheduler_widget.py +160 -0
- autoclicker/gui/snippet_library.py +117 -0
- autoclicker/gui/task_widget.py +547 -0
- autoclicker/matcher.py +152 -0
- autoclicker/models.py +468 -0
- autoclicker/ocr.py +63 -0
- autoclicker/run.py +64 -0
- autoclicker/runner.py +666 -0
- autoclicker/windows.py +53 -0
- pyclickerrpa-0.1.0.dist-info/METADATA +90 -0
- pyclickerrpa-0.1.0.dist-info/RECORD +29 -0
- pyclickerrpa-0.1.0.dist-info/WHEEL +5 -0
- pyclickerrpa-0.1.0.dist-info/entry_points.txt +5 -0
- pyclickerrpa-0.1.0.dist-info/top_level.txt +1 -0
autoclicker/run.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Headless CLI runner: python -m autoclicker.run <task.json> [--window TITLE].
|
|
2
|
+
|
|
3
|
+
Loads a task (C++ or Python .json, same schema) and executes it against a target
|
|
4
|
+
window (by title substring) or the full screen, printing the engine log.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import argparse
|
|
9
|
+
import sys
|
|
10
|
+
import time
|
|
11
|
+
|
|
12
|
+
from autoclicker.models import Task
|
|
13
|
+
from autoclicker.runner import RunnerCallbacks, TaskRunner
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ConsoleCallbacks(RunnerCallbacks):
|
|
17
|
+
def step_started(self, index, description):
|
|
18
|
+
print(f"[{index + 1}] {description}")
|
|
19
|
+
|
|
20
|
+
def log(self, msg):
|
|
21
|
+
print(msg)
|
|
22
|
+
|
|
23
|
+
def match_found(self, x, y, confidence):
|
|
24
|
+
pass
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def main(argv=None) -> int:
|
|
28
|
+
parser = argparse.ArgumentParser(prog="autoclicker.run", description="Run an AutoClicker task headless.")
|
|
29
|
+
parser.add_argument("task", help="Path to a .json task file")
|
|
30
|
+
parser.add_argument("--window", help="Target window title (substring, case-insensitive)")
|
|
31
|
+
args = parser.parse_args(argv)
|
|
32
|
+
|
|
33
|
+
from autoclicker.dpi import set_dpi_aware
|
|
34
|
+
set_dpi_aware()
|
|
35
|
+
|
|
36
|
+
task = Task.load_from_file(args.task)
|
|
37
|
+
if not task.steps:
|
|
38
|
+
print(f"任务为空或加载失败: {args.task}", file=sys.stderr)
|
|
39
|
+
return 1
|
|
40
|
+
|
|
41
|
+
hwnd = None
|
|
42
|
+
if args.window:
|
|
43
|
+
from autoclicker.windows import find_by_title
|
|
44
|
+
info = find_by_title(args.window)
|
|
45
|
+
if info is None:
|
|
46
|
+
print(f"找不到窗口: {args.window}", file=sys.stderr)
|
|
47
|
+
return 2
|
|
48
|
+
hwnd = info.hwnd
|
|
49
|
+
print(f"目标窗口: {info.title} ({info.width}x{info.height})")
|
|
50
|
+
|
|
51
|
+
runner = TaskRunner(task, target_hwnd=hwnd, callbacks=ConsoleCallbacks())
|
|
52
|
+
runner.start()
|
|
53
|
+
try:
|
|
54
|
+
while runner.is_alive():
|
|
55
|
+
time.sleep(0.2)
|
|
56
|
+
except KeyboardInterrupt:
|
|
57
|
+
print("\n中断,停止任务...")
|
|
58
|
+
runner.stop()
|
|
59
|
+
runner.join(timeout=5)
|
|
60
|
+
return 0
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if __name__ == "__main__":
|
|
64
|
+
raise SystemExit(main())
|