主题
修改用户自定义设置 - SetConfigByKey
函数简介
通过键值对方式修改单个用户自定义设置项。等价于 SetConfig({"key": value})。
键名大小写不敏感;布尔/数值支持字符串(如 "True"、"1")。与 OCR/YOLO 模型调参共用解析规则,见 JSON配置解析约定。
接口名称
SetConfigByKeyDLL调用
int SetConfigByKey(long ola, string key, string value);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。 |
| key | 字符串 | 配置项名称,如:RealMouseMode。 |
| value | 字符串 | 配置项值,如:true。 |
示例
SDK 调用
cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
ola.SetConfigByKey("DefaultEncoding", "1");csharp
using OLAPlug;
var ola = new OLAPlugServer();
ola.SetConfigByKey("DefaultEncoding", "1");python
from OLAPlugServer import OLAPlugServer
ola = OLAPlugServer()
ola.SetConfigByKey("DefaultEncoding", "1")java
import com.olaplug.OLAPlugServer;
OLAPlugServer ola = new OLAPlugServer();
ola.SetConfigByKey("DefaultEncoding", "1");cpp
var ola = com("OlaPlug.OlaSoft")
ola.SetConfigByKey("DefaultEncoding", "1");vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ola.SetConfigByKey("DefaultEncoding", "1");text
.局部变量 ola, OLAPlug
ola.创建 ()
ola.SetConfigByKey("DefaultEncoding", "1")aardio
import OLAPlugServer;
var ola = OLAPlugServer();
ola.SetConfigByKey("DefaultEncoding", "1");text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
ola.SetConfigByKey("DefaultEncoding", "1");cpp
#include "OLAPlugServer.h"
OLAPlugServer ola;
ola.SetConfigByKey("DefaultEncoding", "1");原生 DLL 调用
cpp
long instance = CreateCOLAPlugInterFace();
SetConfigByKey(instance, "DefaultEncoding", "1");csharp
long instance = CreateCOLAPlugInterFace();
SetConfigByKey(instance, "DefaultEncoding", "1");python
from ctypes import CDLL, c_int, c_int64, create_string_buffer
ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
SetConfigByKey(instance, "DefaultEncoding", "1")返回值
| 返回值 | 说明 |
|---|---|
1 | 成功。 |
0 | 失败。 |
可用配置项
编码与键鼠仿真(全局)
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| DefaultEncoding | 整数型 | 0 | 接口入参默认编码:0=GBK,1=UTF-8,2=Unicode |
| DefaultReturnEncoding | 整数型 | 1 | 接口返回值默认编码:0=GBK,1=UTF-8,2=Unicode |
| SimModeType | 整数型 | 0 | 键鼠仿真模式:0=标准,1=Logitech 驱动,2=LogitechGHubNew,3=Razer,4=欧拉驱动 |
| OLAMouseDeviceMode | 整数型 | 0 | 欧拉驱动鼠标模式 0~10;部分模式可能蓝屏,建议从 0 起试 |
| OLAKeypadDeviceMode | 整数型 | 0 | 欧拉驱动键盘模式 0~10;部分模式可能蓝屏,建议从 0 起试 |
| UseAbsoluteMove | bool型 | true | 驱动鼠标是否使用绝对移动 |
真实鼠标轨迹(实例级)
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| EnableRealMouse | bool型 | true | 是否启用真实鼠标轨迹;MoveTo / MoveToEx 是否走拟人轨迹也受此开关控制 |
| RealMouseMode | 整数型 | 6 | 轨迹风格:1=标准用户,2=游戏玩家,3=非光学鼠标(慢),4=平衡,5=机器人(直线),6=自定义 |
| MinMouseTrajectory | 整数型 | 50 | 最小轨迹距离(像素);小于该值直接定位,不走轨迹 |
| RealMouseBaseTimePer100Pixels | 整数型 | 100 | 每 100 像素的基础移动时间(毫秒) |
| RealMouseFlowFlag | 整数型 | 161 | 速度曲线组合位标志(1/2/4/8/16/32/64/128/256/512 可组合) |
| RealMouseNoise | 双精度浮点数 | 5.0 | 噪声,影响轨迹随机性 |
| RealMouseDeviation | 整数型 | 5 | 偏差,影响路径曲率 |
| RealMouseMinSteps | 整数型 | 300 | 最小步数 |
| RealMouseTimeToSteps | 双精度浮点数 | 2.5 | 步间时间间隔系数 |
| RealMouseOvershoots | 整数型 | 0 | 过冲点数 |
| MouseDriftCheckTime | 整数型 | 0 | 鼠标漂移检测间隔(毫秒);0=不检测 |
| MousePosCallbackMinOffset | 整数型 | 2 | MoveTo 终点矫正阈值(像素);|offsetX| 与 |offsetY| 均小于该值时不矫正;0=不限制。配合 SetWindowCursor 或 SetMousePosCallback |
键盘鼠标间隔与输入锁定(实例级)
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| EnableRealKeypad | bool型 | false | 是否启用真实键盘输入延时 |
| KeyDownInterval | 整数型 | 50 | 键盘单击间隔(毫秒) |
| MouseClickInterval | 整数型 | 50 | 鼠标单击间隔(毫秒) |
| MouseDoubleClickInterval | 整数型 | 200 | 鼠标双击间隔(毫秒) |
| InputLock | bool型 | false | 输入锁定;与 LockInput 行为一致 |
| KeyboardHwnd | 长整数型 | 0 | 键盘消息目标窗口句柄 |
| MouseHwnd | 长整数型 | 0 | 鼠标消息目标窗口句柄 |
| CheckDisplayDeadInterval | 整数型 | 50 | 检测画面卡死间隔(毫秒);0=不检测 |
| SnapPrefetchInterval | 整数型 | 33 | 后台截图预取间隔(毫秒);0=关闭 L1 缓存与预取 Worker |
| DxCaptureMaxFps | 整数型 | 60 | DX hook 截图帧率上限(fps),供目标进程内节流;0=不限制。该值在DX 绑定/初始化时时生效;若运行中修改配置,需重新绑定窗口后才会应用到目标进程内的捕获节流 |
VNC 连接(实例级)
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| VncServer | 字符串 | 127.0.0.1 | VNC 服务器地址 |
| VncPort | 整数型 | 5900 | VNC 端口 |
| VncPassword | 字符串 | (空) | VNC 密码 |
路径、数据库与图像(全局)
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| WorkPath | 字符串 | (空) | 工作路径 |
| DbPath | 字符串 | (空) | SQLite 数据库路径 |
| DbPassword | 字符串 | (空) | SQLite 数据库密码 |
| DriverPath | 字符串 | (空) | 自定义驱动路径 |
| SymbolServer | 字符串 | (空) | 符号服务器,如 https://msdl.microsoft.com |
| SharedMemoryNamePrefix | 字符串 | TSVN_ | 共享内存/沙盒 IPC 前缀;绑定沙盒时与 OpenIpcPath 配合 |
| JpegQuality | 整数型 | 100 | JPG 压缩质量 0~100 |
| MaxOverlap | 双精度浮点数 | 0.5 | 多图返回最大重叠度;0=完全不重叠 |
| MatchColorWeight | 双精度浮点数 | 0.7 | 彩色找图颜色权重 0~1.0 |
| ImageStitchMatchValue | 双精度浮点数 | 0 | 图片拼接匹配阈值 0~1 |
| MultiTemplateAbortOnInvalidImage | bool型 | true | 多模板路径 | 分隔时,某一图加载失败:true=整次失败,false=跳过无效图 |
| MultiColorSimMode | 整数型 | 0 | 多点找色 sim:0=颜色相似度,1=允许部分点不匹配 |
| EnableOcrOverlapCounting | bool型 | false | OCR 是否允许重叠词同时返回 |
YOLO(全局)
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| YoloRegionSortMode | 整数型 | 0 | 检测类任务 Regions 排序:0=置信度降序,1=同分比 x,2=同分比 y 再 x,3=从左到右,4=从上到下。仅对未单独设置 RegionSortMode 的模型生效 |
| YoloAutoWarmup | bool型 | true | 模型加载成功后是否自动预热,避免首次正式检测耗时过长 |
| YoloAutoWarmupIterations | 整数型 | 2 | 自动预热推理次数,有效范围 0~100;0=跳过预热。每次使用 640×640 合成图做真实推理,用于触发 CUDA/TensorRT/ONNX 等首次初始化 |
OCR(全局)
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| OcrAutoWarmup | bool型 | true | OcrLoadModel / OcrLoadModelMemory / 内置模型加载成功后是否自动预热 |
| OcrAutoWarmupIterations | 整数型 | 2 | 自动预热推理次数,0~100;0=跳过。加载阶段跑真实 det/rec 预热,避免首次正式识别耗时过长 |
窗口、虚拟机与绑定模式(全局)
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| FindWindowMode | 整数型 | 0 | 找窗口:0=仅可见,1=全部,2=不可见 |
| VMwareVersion | 整数型 | -1 | VMware 版本;-1=读注册表自动判断,支持 10/16/17/18/19 |
| RemoteServerExeName | 字符串 | RemoteServer.exe | SHM 远程模式下自动发现 B 端进程的 exe 名 |
| BindModeMouseALL | 字符串 | (空) | 绑定模式鼠标方式全量列表(| 分隔) |
| BindModeKeypadALL | 字符串 | (空) | 绑定模式键盘方式全量列表 |
| BindModePubALL | 字符串 | (空) | 绑定模式公共方式全量列表 |
| BindModeMouseDefault | 字符串 | (空) | 常用绑定模式鼠标方式 |
| BindModeKeypadDefault | 字符串 | (空) | 常用绑定模式键盘方式 |
相关接口
- 批量写入:SetConfig
- 读取:GetConfig
- 解析规则:JSON配置解析约定
