ok-script 0.0.34__tar.gz → 0.0.36__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.
- {ok-script-0.0.34 → ok-script-0.0.36}/PKG-INFO +4 -27
- ok-script-0.0.36/README.md +24 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/BaseCaptureMethod.py +8 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/HwndWindow.py +5 -1
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/adb/ADBCaptureMethod.py +1 -1
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/adb/DeviceManager.py +1 -1
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/windows/WindowsGraphicsCaptureMethod.py +1 -1
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/App.py +2 -33
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/Communicate.py +2 -1
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/MainWindow.py +37 -1
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/start/StartCard.py +4 -4
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/OneTimeTaskTab.py +1 -2
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/logging/Logger.py +11 -1
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/task/BaseTask.py +5 -2
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/task/TaskExecutor.py +4 -1
- {ok-script-0.0.34 → ok-script-0.0.36}/ok_script.egg-info/PKG-INFO +4 -27
- {ok-script-0.0.34 → ok-script-0.0.36}/setup.py +1 -1
- ok-script-0.0.34/README.md +0 -47
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/OK.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/adb/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/adb/bin/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/adb/targets.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/adb/vbox.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/windows/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/windows/d3d11.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/windows/dump.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/windows/utils.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/capture/windows/window.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/color/Color.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/color/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/config/Config.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/config/InfoDict.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/config/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/feature/Box.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/feature/Feature.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/feature/FeatureSet.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/feature/FindFeature.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/feature/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/TabTitles.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/about/AboutTab.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/about/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/common/OKIcon.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/common/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/common/config.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/common/style_sheet.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/debug/AspectRatioWidget.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/debug/DebugTab.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/debug/FrameWidget.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/debug/InfoWidget.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/debug/LoggerWidget.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/debug/Screenshot.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/debug/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/i18n/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/i18n/path.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/i18n/update.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/icon/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/icon/icon.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/overlay/OverlayWindow.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/overlay/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/qss/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/resources.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/settings/SettingTab.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/settings/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/start/SelectCaptureListView.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/start/SelectHwndWindow.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/start/StartTab.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/start/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/ConfigItemFactory.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/ConfigLabelAndWidget.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/LabelAndDoubleSpinBox.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/LabelAndDropDown.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/LabelAndLineEdit.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/LabelAndList.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/LabelAndSpinBox.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/LabelAndSwitchButton.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/LabelAndWidget.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/ModifyListDialog.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/ModifyListItem.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/StartButton.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/TaskCard.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/TaskOpButton.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/TooltipTableWidget.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/TriggerTaskTab.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/tasks/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/util/Alert.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/util/InitWorker.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/util/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/widget/Card.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/widget/FramelessDialog.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/widget/ListTableWidgetItem.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/widget/NumericTableWidgetItem.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/widget/StatusBar.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/widget/Tab.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/widget/TabWidget.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/widget/UpdateConfigWidgetItem.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/widget/YesNonWidgetItem.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/gui/widget/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/interaction/ADBInteraction.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/interaction/BaseInteraction.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/interaction/Win32Interaction.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/interaction/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/logging/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/ocr/OCR.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/ocr/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/predict/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/predict/predict.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Foundation/Collections.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Foundation/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Globalization/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Graphics/Capture/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Graphics/DirectX/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Graphics/Imaging/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Graphics/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Media/Ocr/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Media/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Security/Cryptography/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Security/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Storage/Streams/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Storage/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/delegate.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/export.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/idldsl.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/inspectable.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/roapi.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/types.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/winstring.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/save/BlackBarProcessor.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/save/PostProcessor.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/save/SaveByInterval.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/save/SaveByKeyPress.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/save/SaveMethodBase.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/save/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/scene/FeatureScene.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/scene/Scene.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/scene/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/stats/StreamStats.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/stats/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/task/ExecutorOperation.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/task/OneTimeTask.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/task/TriggerTask.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/task/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/util/__init__.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/util/exit_event.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/util/json.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/util/list.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/util/path.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/util/thread.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/util/win32_process.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok/util/yaml.py +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok_script.egg-info/SOURCES.txt +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok_script.egg-info/dependency_links.txt +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok_script.egg-info/requires.txt +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/ok_script.egg-info/top_level.txt +0 -0
- {ok-script-0.0.34 → ok-script-0.0.36}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ok-script
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.36
|
|
4
4
|
Summary: Automation with Computer Vision for Python
|
|
5
5
|
Home-page: https://github.com/ok-oldking/ok-script
|
|
6
6
|
Author: ok-oldking
|
|
@@ -33,37 +33,14 @@ Requires-Dist: opencv-python==4.9.0.80
|
|
|
33
33
|
5. 支持Python3.7以上版本
|
|
34
34
|
6. 学习成本低, 自定义函数少, 也可以直接使用opencv, RapidOCR等api
|
|
35
35
|
|
|
36
|
-
## Example Usage
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
[
|
|
37
|
+
## 目前有两个已完成项目:
|
|
38
|
+
基于OCR,白荆回廊自动凹技能,可以连续跑几个小时的自动脚本[https://github.com/ok-oldking/ok-baijing](https://github.com/ok-oldking/ok-baijing)
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
# Defining game scenes to handle different in-game situations through automated tasks
|
|
43
|
-
task_executor.scenes.extend([
|
|
44
|
-
WorldScene(interaction, feature_set),
|
|
45
|
-
StartScene(interaction, feature_set),
|
|
46
|
-
MonthlyCardScene(interaction, feature_set),
|
|
47
|
-
DialogCloseButtonScene(interaction, feature_set),
|
|
48
|
-
DialogChoicesScene(interaction, feature_set),
|
|
49
|
-
DialogPlayingScene(interaction, feature_set),
|
|
50
|
-
BlackDialogScene(interaction, feature_set),
|
|
51
|
-
])
|
|
40
|
+
触发式任务,原神自动拾取, 跳过剧情等[https://github.com/ok-oldking/ok-genshin](https://github.com/ok-oldking/ok-genshin)
|
|
52
41
|
|
|
53
|
-
# Adding automated tasks for gameplay, such as dialog navigation and item collection
|
|
54
|
-
task_executor.tasks.extend([
|
|
55
|
-
AutoPlayDialogTask(interaction, feature_set), # speeding up the dialogs
|
|
56
|
-
AutoChooseDialogTask(interaction, feature_set), # choose dialog options
|
|
57
|
-
AutoPickTask(interaction, feature_set), # pickup items in world scene
|
|
58
|
-
AutoLoginTask(interaction, feature_set), # auto login and claim rewards
|
|
59
|
-
])
|
|
60
|
-
```
|
|
61
42
|
|
|
62
43
|
## Scenes
|
|
63
44
|
|
|
64
45
|
## Tasks
|
|
65
46
|
|
|
66
|
-
## Project Structure
|
|
67
|
-
|
|
68
|
-
- `autoui`: Framework code.
|
|
69
|
-
- `genshin`: Example Genshin Impact automation project
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# ok-script
|
|
2
|
+
|
|
3
|
+
类似于AirScript, 使用Python
|
|
4
|
+
|
|
5
|
+
## 优势
|
|
6
|
+
|
|
7
|
+
1. 开源免费, 依赖库均为开源方案, 支持pip install任何第三方库
|
|
8
|
+
2. 代码和打包流程完全由开发者控制, 不会上传服务器, 没有安全性隐患, 不容易被侦测和识别
|
|
9
|
+
3. 一套代码即可支持Windows安卓模拟器/ADB连接的虚拟机, Windows客户端游戏, 安卓系统直接运行(开发中)
|
|
10
|
+
4. 支持GUI以及Console运行, 也可以完全自己开发GUI
|
|
11
|
+
5. 支持Python3.7以上版本
|
|
12
|
+
6. 学习成本低, 自定义函数少, 也可以直接使用opencv, RapidOCR等api
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## 目前有两个已完成项目:
|
|
16
|
+
基于OCR,白荆回廊自动凹技能,可以连续跑几个小时的自动脚本[https://github.com/ok-oldking/ok-baijing](https://github.com/ok-oldking/ok-baijing)
|
|
17
|
+
|
|
18
|
+
触发式任务,原神自动拾取, 跳过剧情等[https://github.com/ok-oldking/ok-genshin](https://github.com/ok-oldking/ok-genshin)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Scenes
|
|
22
|
+
|
|
23
|
+
## Tasks
|
|
24
|
+
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
|
|
3
|
+
class CaptureException(Exception):
|
|
4
|
+
pass
|
|
3
5
|
|
|
4
6
|
class BaseCaptureMethod:
|
|
5
7
|
name = "None"
|
|
@@ -21,6 +23,12 @@ class BaseCaptureMethod:
|
|
|
21
23
|
pass
|
|
22
24
|
|
|
23
25
|
def get_frame(self) -> np.ndarray | None:
|
|
26
|
+
try:
|
|
27
|
+
return self.do_get_frame()
|
|
28
|
+
except Exception as e:
|
|
29
|
+
raise CaptureException() from e
|
|
30
|
+
|
|
31
|
+
def do_get_frame(self):
|
|
24
32
|
pass
|
|
25
33
|
|
|
26
34
|
def draw_rectangle(self):
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# original https://github.com/dantmnf & https://github.com/hakaboom/winAuto
|
|
2
2
|
import ctypes
|
|
3
|
+
import os
|
|
3
4
|
import re
|
|
4
5
|
import threading
|
|
5
6
|
import time
|
|
@@ -194,7 +195,10 @@ def get_exe_name_by_hwnd(hwnd):
|
|
|
194
195
|
exe_name = ctypes.create_unicode_buffer(1024)
|
|
195
196
|
GetModuleFileNameExW(h_process, None, exe_name, 1024)
|
|
196
197
|
|
|
198
|
+
# Extract the executable name from the full path
|
|
199
|
+
exe_only_name = os.path.basename(exe_name.value)
|
|
200
|
+
|
|
197
201
|
# Close the process handle
|
|
198
202
|
CloseHandle(h_process)
|
|
199
203
|
|
|
200
|
-
return
|
|
204
|
+
return exe_only_name
|
|
@@ -54,7 +54,7 @@ class DeviceManager:
|
|
|
54
54
|
except Exception as e:
|
|
55
55
|
logger.error("adb connect error", e)
|
|
56
56
|
self._connect_all = True
|
|
57
|
-
logger.debug(f'connect_all
|
|
57
|
+
logger.debug(f'connect_all')
|
|
58
58
|
|
|
59
59
|
def get_devices(self):
|
|
60
60
|
return list(self.device_dict.values())
|
|
@@ -3,16 +3,14 @@ import sys
|
|
|
3
3
|
|
|
4
4
|
from PySide6.QtCore import QSize, QCoreApplication, QLocale, QTranslator, Qt
|
|
5
5
|
from PySide6.QtGui import QIcon
|
|
6
|
-
from PySide6.QtWidgets import QApplication
|
|
6
|
+
from PySide6.QtWidgets import QApplication
|
|
7
7
|
from qfluentwidgets import FluentTranslator, qconfig, Theme
|
|
8
8
|
|
|
9
9
|
import ok
|
|
10
10
|
import ok.gui.resources
|
|
11
|
-
from ok.gui.Communicate import communicate
|
|
12
11
|
from ok.gui.MainWindow import MainWindow
|
|
13
12
|
from ok.gui.i18n.path import i18n_path
|
|
14
13
|
from ok.gui.overlay.OverlayWindow import OverlayWindow
|
|
15
|
-
from ok.gui.start.StartTab import StartTab
|
|
16
14
|
from ok.logging.Logger import get_logger
|
|
17
15
|
|
|
18
16
|
logger = get_logger(__name__)
|
|
@@ -45,7 +43,6 @@ class App:
|
|
|
45
43
|
self.main_window = None
|
|
46
44
|
self.exit_event = exit_event
|
|
47
45
|
self.icon = QIcon(self.config.get('gui_icon') or ":/icon/icon.ico")
|
|
48
|
-
self.tray = QSystemTrayIcon(self.icon)
|
|
49
46
|
|
|
50
47
|
translator = QTranslator(self.app)
|
|
51
48
|
full_path = os.path.join(i18n_path, f"{self.locale.name()}")
|
|
@@ -57,30 +54,6 @@ class App:
|
|
|
57
54
|
else:
|
|
58
55
|
logger.debug(f"No translation available for {self.locale}, falling back to English/default. {full_path}")
|
|
59
56
|
|
|
60
|
-
# Create a context menu for the tray
|
|
61
|
-
menu = QMenu()
|
|
62
|
-
exit_action = menu.addAction(self.app.tr("Exit"))
|
|
63
|
-
exit_action.triggered.connect(self.quit)
|
|
64
|
-
|
|
65
|
-
# Set the context menu and show the tray icon
|
|
66
|
-
self.tray.setContextMenu(menu)
|
|
67
|
-
self.tray.show()
|
|
68
|
-
|
|
69
|
-
communicate.notification.connect(self.show_notification)
|
|
70
|
-
|
|
71
|
-
def show_notification(self, title, message):
|
|
72
|
-
if title is None:
|
|
73
|
-
title = self.title
|
|
74
|
-
self.tray.showMessage(title, message)
|
|
75
|
-
|
|
76
|
-
def show(self):
|
|
77
|
-
self.loading_window = StartTab(self, self.exit_event)
|
|
78
|
-
size = self.size_relative_to_screen(width=0.6, height=0.4)
|
|
79
|
-
self.loading_window.resize(size)
|
|
80
|
-
self.loading_window.setMinimumSize(size)
|
|
81
|
-
self.center_window(self.loading_window)
|
|
82
|
-
self.loading_window.show()
|
|
83
|
-
|
|
84
57
|
def center_window(self, window):
|
|
85
58
|
screen = self.app.primaryScreen()
|
|
86
59
|
size = screen.size()
|
|
@@ -91,7 +64,7 @@ class App:
|
|
|
91
64
|
window.move(half_screen_width / 2, half_screen_height / 2)
|
|
92
65
|
|
|
93
66
|
def show_main_window(self):
|
|
94
|
-
self.main_window = MainWindow(self.overlay, self.about, exit_event=self.exit_event)
|
|
67
|
+
self.main_window = MainWindow(self.icon, self.overlay, self.about, exit_event=self.exit_event)
|
|
95
68
|
self.main_window.setWindowTitle(f'{self.title} {self.version}') # Set the window title here
|
|
96
69
|
self.main_window.setWindowIcon(self.icon)
|
|
97
70
|
if self.overlay and ok.gui.device_manager.hwnd is not None:
|
|
@@ -119,7 +92,3 @@ class App:
|
|
|
119
92
|
|
|
120
93
|
def exec(self):
|
|
121
94
|
sys.exit(self.app.exec())
|
|
122
|
-
|
|
123
|
-
def quit(self):
|
|
124
|
-
ok.gui.ok.quit()
|
|
125
|
-
self.app.quit()
|
|
@@ -12,12 +12,13 @@ class Communicate(QObject):
|
|
|
12
12
|
task_info = Signal()
|
|
13
13
|
window = Signal(bool, int, int, int, int, int, int, float)
|
|
14
14
|
loading_progress = Signal(str)
|
|
15
|
-
notification = Signal(str, str)
|
|
15
|
+
notification = Signal(str, str, bool)
|
|
16
16
|
executor_paused: Signal = Signal(bool)
|
|
17
17
|
screenshot = Signal(np.ndarray, str)
|
|
18
18
|
update_overlay = Signal()
|
|
19
19
|
adb_devices: Signal = Signal(bool)
|
|
20
20
|
tab = Signal(str)
|
|
21
|
+
capture_error = Signal()
|
|
21
22
|
|
|
22
23
|
def emit_draw_box(self, key: str = None, boxes=None, color=None, frame=None):
|
|
23
24
|
self.draw_box.emit(key, boxes, color, frame)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from PySide6.QtCore import QObject, Signal, Qt
|
|
2
2
|
from PySide6.QtGui import QKeySequence, QShortcut
|
|
3
|
+
from PySide6.QtWidgets import QMenu, QSystemTrayIcon
|
|
3
4
|
from qfluentwidgets import FluentIcon, NavigationItemPosition, MSFluentWindow, InfoBar, InfoBarPosition, MessageBox
|
|
4
5
|
|
|
5
6
|
import ok.gui
|
|
@@ -19,7 +20,7 @@ class Communicate(QObject):
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class MainWindow(MSFluentWindow):
|
|
22
|
-
def __init__(self, debug=False, about=None, exit_event=None):
|
|
23
|
+
def __init__(self, icon, debug=False, about=None, exit_event=None):
|
|
23
24
|
super().__init__()
|
|
24
25
|
self.exit_event = exit_event
|
|
25
26
|
self.start_tab = StartTab()
|
|
@@ -53,6 +54,41 @@ class MainWindow(MSFluentWindow):
|
|
|
53
54
|
self.shortcut = QShortcut(QKeySequence("Ctrl+Alt+D"), self)
|
|
54
55
|
self.shortcut.activated.connect(dump_threads)
|
|
55
56
|
|
|
57
|
+
# Create a context menu for the tray
|
|
58
|
+
menu = QMenu()
|
|
59
|
+
exit_action = menu.addAction(self.tr("Exit"))
|
|
60
|
+
exit_action.triggered.connect(ok.gui.ok.quit)
|
|
61
|
+
|
|
62
|
+
self.tray = QSystemTrayIcon(icon)
|
|
63
|
+
|
|
64
|
+
# Set the context menu and show the tray icon
|
|
65
|
+
self.tray.setContextMenu(menu)
|
|
66
|
+
self.tray.show()
|
|
67
|
+
|
|
68
|
+
communicate.capture_error.connect(self.capture_error)
|
|
69
|
+
communicate.notification.connect(self.show_notification)
|
|
70
|
+
|
|
71
|
+
def show_notification(self, message, title=None, error=None):
|
|
72
|
+
bar = InfoBar.error if error else InfoBar.info
|
|
73
|
+
if title is None:
|
|
74
|
+
title = f"{self.tr('Error') if error else 'Info'}:"
|
|
75
|
+
bar(
|
|
76
|
+
title=title,
|
|
77
|
+
content=message,
|
|
78
|
+
orient=Qt.Horizontal,
|
|
79
|
+
isClosable=True,
|
|
80
|
+
position=InfoBarPosition.TOP,
|
|
81
|
+
duration=5000, # won't disappear automatically
|
|
82
|
+
parent=self.window()
|
|
83
|
+
)
|
|
84
|
+
if title is None:
|
|
85
|
+
title = self.title
|
|
86
|
+
self.tray.showMessage(title, message)
|
|
87
|
+
|
|
88
|
+
def capture_error(self):
|
|
89
|
+
self.show_notification(self.tr('Please check whether the game window is selected correctly!'),
|
|
90
|
+
self.tr('Capture Error'), error=True)
|
|
91
|
+
|
|
56
92
|
def navigate_tab(self, index):
|
|
57
93
|
if index == "start":
|
|
58
94
|
self.switchTo(self.start_tab)
|
|
@@ -80,12 +80,12 @@ class StartCard(SettingCard):
|
|
|
80
80
|
if not ok.gui.executor.connected():
|
|
81
81
|
self.status_bar.setTitle(self.tr("Game Window Disconnected"))
|
|
82
82
|
self.status_bar.setState(True)
|
|
83
|
-
elif task := ok.gui.executor.current_task:
|
|
84
|
-
self.status_bar.setTitle(self.tr("Running") + ": " + task.name)
|
|
85
|
-
self.status_bar.setState(False)
|
|
86
83
|
elif active_trigger_task_count := ok.gui.executor.active_trigger_task_count():
|
|
87
84
|
self.status_bar.setTitle(
|
|
88
|
-
self.tr("Running") + ": " + str(active_trigger_task_count) + self.tr("
|
|
85
|
+
self.tr("Running") + ": " + str(active_trigger_task_count) + ' ' + self.tr("Trigger Tasks"))
|
|
86
|
+
self.status_bar.setState(False)
|
|
87
|
+
elif task := ok.gui.executor.current_task:
|
|
88
|
+
self.status_bar.setTitle(self.tr("Running") + ": " + task.name)
|
|
89
89
|
self.status_bar.setState(False)
|
|
90
90
|
else:
|
|
91
91
|
self.status_bar.setTitle(self.tr("Waiting for task to be enabled"))
|
|
@@ -35,8 +35,7 @@ class OneTimeTaskTab(Tab):
|
|
|
35
35
|
communicate.task_info.connect(self.update_info_table)
|
|
36
36
|
|
|
37
37
|
def task_update(self, task):
|
|
38
|
-
|
|
39
|
-
self.update_info_table()
|
|
38
|
+
self.update_info_table()
|
|
40
39
|
|
|
41
40
|
def update_info_table(self):
|
|
42
41
|
task = ok.gui.executor.current_task
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import os
|
|
3
|
+
import sys
|
|
3
4
|
import traceback
|
|
4
|
-
import ok
|
|
5
5
|
from logging.handlers import TimedRotatingFileHandler
|
|
6
6
|
|
|
7
|
+
import ok
|
|
7
8
|
from ok.util.path import get_path_relative_to_exe, ensure_dir_for_file
|
|
8
9
|
|
|
9
10
|
|
|
@@ -34,6 +35,13 @@ def get_substring_from_last_dot_exclusive(s):
|
|
|
34
35
|
auto_helper_logger = logging.getLogger("ok")
|
|
35
36
|
|
|
36
37
|
|
|
38
|
+
def log_exception_handler(exctype, value, traceback):
|
|
39
|
+
if auto_helper_logger is not None:
|
|
40
|
+
auto_helper_logger.error(f"Uncaught exception: {exctype}, traceback: {traceback}")
|
|
41
|
+
# Call the default excepthook to print the traceback
|
|
42
|
+
sys.__excepthook__(exctype, value, traceback)
|
|
43
|
+
|
|
44
|
+
|
|
37
45
|
def config_logger(config):
|
|
38
46
|
if config.get('debug'):
|
|
39
47
|
auto_helper_logger.setLevel(logging.DEBUG)
|
|
@@ -70,6 +78,8 @@ def config_logger(config):
|
|
|
70
78
|
file_handler.setLevel(logging.ERROR) # File handler level
|
|
71
79
|
auto_helper_logger.addHandler(file_handler)
|
|
72
80
|
|
|
81
|
+
sys.excepthook = log_exception_handler
|
|
82
|
+
|
|
73
83
|
|
|
74
84
|
class Logger:
|
|
75
85
|
def __init__(self, name):
|
|
@@ -64,8 +64,8 @@ class BaseTask(ExecutorOperation):
|
|
|
64
64
|
communicate.task_info.emit()
|
|
65
65
|
|
|
66
66
|
@staticmethod
|
|
67
|
-
def notification(message, title=None):
|
|
68
|
-
communicate.notification.emit(title,
|
|
67
|
+
def notification(message, title=None, error=False):
|
|
68
|
+
communicate.notification.emit(message, title, error)
|
|
69
69
|
|
|
70
70
|
@property
|
|
71
71
|
def enabled(self):
|
|
@@ -93,6 +93,9 @@ class BaseTask(ExecutorOperation):
|
|
|
93
93
|
def info_set(self, key, value):
|
|
94
94
|
self.info[key] = value
|
|
95
95
|
|
|
96
|
+
def info_add(self, key, count=1):
|
|
97
|
+
self.info[key] = self.info.get(key, 0) + count
|
|
98
|
+
|
|
96
99
|
def load_config(self, folder):
|
|
97
100
|
self.config = Config(self.default_config, folder, self.__class__.__name__)
|
|
98
101
|
|
|
@@ -2,6 +2,7 @@ import threading
|
|
|
2
2
|
import time
|
|
3
3
|
import traceback
|
|
4
4
|
|
|
5
|
+
from ok.capture.BaseCaptureMethod import CaptureException
|
|
5
6
|
from ok.capture.adb.DeviceManager import DeviceManager
|
|
6
7
|
from ok.gui.Communicate import communicate
|
|
7
8
|
from ok.logging.Logger import get_logger
|
|
@@ -227,10 +228,12 @@ class TaskExecutor:
|
|
|
227
228
|
logger.info(f"FinishedException, breaking")
|
|
228
229
|
break
|
|
229
230
|
except Exception as e:
|
|
231
|
+
if isinstance(e, CaptureException):
|
|
232
|
+
communicate.capture_error.emit()
|
|
230
233
|
name = ""
|
|
231
234
|
if self.current_task is not None:
|
|
232
|
-
self.current_task.disable()
|
|
233
235
|
name = self.current_task.name
|
|
236
|
+
self.current_task.disable()
|
|
234
237
|
traceback.print_exc()
|
|
235
238
|
stack_trace_str = traceback.format_exc()
|
|
236
239
|
logger.error(f"{name} exception: {e}, traceback: {stack_trace_str}")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ok-script
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.36
|
|
4
4
|
Summary: Automation with Computer Vision for Python
|
|
5
5
|
Home-page: https://github.com/ok-oldking/ok-script
|
|
6
6
|
Author: ok-oldking
|
|
@@ -33,37 +33,14 @@ Requires-Dist: opencv-python==4.9.0.80
|
|
|
33
33
|
5. 支持Python3.7以上版本
|
|
34
34
|
6. 学习成本低, 自定义函数少, 也可以直接使用opencv, RapidOCR等api
|
|
35
35
|
|
|
36
|
-
## Example Usage
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
[
|
|
37
|
+
## 目前有两个已完成项目:
|
|
38
|
+
基于OCR,白荆回廊自动凹技能,可以连续跑几个小时的自动脚本[https://github.com/ok-oldking/ok-baijing](https://github.com/ok-oldking/ok-baijing)
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
# Defining game scenes to handle different in-game situations through automated tasks
|
|
43
|
-
task_executor.scenes.extend([
|
|
44
|
-
WorldScene(interaction, feature_set),
|
|
45
|
-
StartScene(interaction, feature_set),
|
|
46
|
-
MonthlyCardScene(interaction, feature_set),
|
|
47
|
-
DialogCloseButtonScene(interaction, feature_set),
|
|
48
|
-
DialogChoicesScene(interaction, feature_set),
|
|
49
|
-
DialogPlayingScene(interaction, feature_set),
|
|
50
|
-
BlackDialogScene(interaction, feature_set),
|
|
51
|
-
])
|
|
40
|
+
触发式任务,原神自动拾取, 跳过剧情等[https://github.com/ok-oldking/ok-genshin](https://github.com/ok-oldking/ok-genshin)
|
|
52
41
|
|
|
53
|
-
# Adding automated tasks for gameplay, such as dialog navigation and item collection
|
|
54
|
-
task_executor.tasks.extend([
|
|
55
|
-
AutoPlayDialogTask(interaction, feature_set), # speeding up the dialogs
|
|
56
|
-
AutoChooseDialogTask(interaction, feature_set), # choose dialog options
|
|
57
|
-
AutoPickTask(interaction, feature_set), # pickup items in world scene
|
|
58
|
-
AutoLoginTask(interaction, feature_set), # auto login and claim rewards
|
|
59
|
-
])
|
|
60
|
-
```
|
|
61
42
|
|
|
62
43
|
## Scenes
|
|
63
44
|
|
|
64
45
|
## Tasks
|
|
65
46
|
|
|
66
|
-
## Project Structure
|
|
67
|
-
|
|
68
|
-
- `autoui`: Framework code.
|
|
69
|
-
- `genshin`: Example Genshin Impact automation project
|
ok-script-0.0.34/README.md
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# ok-script
|
|
2
|
-
|
|
3
|
-
类似于AirScript, 使用Python
|
|
4
|
-
|
|
5
|
-
## 优势
|
|
6
|
-
|
|
7
|
-
1. 开源免费, 依赖库均为开源方案, 支持pip install任何第三方库
|
|
8
|
-
2. 代码和打包流程完全由开发者控制, 不会上传服务器, 没有安全性隐患, 不容易被侦测和识别
|
|
9
|
-
3. 一套代码即可支持Windows安卓模拟器/ADB连接的虚拟机, Windows客户端游戏, 安卓系统直接运行(开发中)
|
|
10
|
-
4. 支持GUI以及Console运行, 也可以完全自己开发GUI
|
|
11
|
-
5. 支持Python3.7以上版本
|
|
12
|
-
6. 学习成本低, 自定义函数少, 也可以直接使用opencv, RapidOCR等api
|
|
13
|
-
|
|
14
|
-
## Example Usage
|
|
15
|
-
|
|
16
|
-
Basically you only need to write the Tasks and Scenes, the autoui framework will do all the heavy lifting.
|
|
17
|
-
[genshin/main.py](genshin/main.py)
|
|
18
|
-
|
|
19
|
-
```python
|
|
20
|
-
# Defining game scenes to handle different in-game situations through automated tasks
|
|
21
|
-
task_executor.scenes.extend([
|
|
22
|
-
WorldScene(interaction, feature_set),
|
|
23
|
-
StartScene(interaction, feature_set),
|
|
24
|
-
MonthlyCardScene(interaction, feature_set),
|
|
25
|
-
DialogCloseButtonScene(interaction, feature_set),
|
|
26
|
-
DialogChoicesScene(interaction, feature_set),
|
|
27
|
-
DialogPlayingScene(interaction, feature_set),
|
|
28
|
-
BlackDialogScene(interaction, feature_set),
|
|
29
|
-
])
|
|
30
|
-
|
|
31
|
-
# Adding automated tasks for gameplay, such as dialog navigation and item collection
|
|
32
|
-
task_executor.tasks.extend([
|
|
33
|
-
AutoPlayDialogTask(interaction, feature_set), # speeding up the dialogs
|
|
34
|
-
AutoChooseDialogTask(interaction, feature_set), # choose dialog options
|
|
35
|
-
AutoPickTask(interaction, feature_set), # pickup items in world scene
|
|
36
|
-
AutoLoginTask(interaction, feature_set), # auto login and claim rewards
|
|
37
|
-
])
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Scenes
|
|
41
|
-
|
|
42
|
-
## Tasks
|
|
43
|
-
|
|
44
|
-
## Project Structure
|
|
45
|
-
|
|
46
|
-
- `autoui`: Framework code.
|
|
47
|
-
- `genshin`: Example Genshin Impact automation project
|
|
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
|
|
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
|
|
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
|
|
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
|
{ok-script-0.0.34 → ok-script-0.0.36}/ok/rotypes/Windows/Graphics/DirectX/Direct3D11/__init__.py
RENAMED
|
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
|
|
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
|