commit d409882c64cd0f7610f198540279c4f1da0b4e18 Author: jc <2646393949@qq.com> Date: Mon Sep 22 21:07:30 2025 +0800 first commit diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..1fa6b3e --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,30 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "cmake", + "request": "launch", + "name": "CMake: 配置项目", + "cmakeDebugType": "configure", + "clean": false, + "configureAll": false + }, + { + "name": "Python 调试程序: 当前文件", + "type": "debugpy", + "request": "launch", + "program": "${workspaceFolder}/src/main.py", + "console": "integratedTerminal" + }, + { + "name": "test_main_create_block", + "type": "debugpy", + "request": "launch", + "program": "${workspaceFolder}/src/main_test.py", + "console": "integratedTerminal" + } + ] +} \ No newline at end of file diff --git a/data/dialog_result.json b/data/dialog_result.json new file mode 100644 index 0000000..9fb13d5 --- /dev/null +++ b/data/dialog_result.json @@ -0,0 +1,88 @@ +{ + "dependency": [ + ], + "flow": [ + { + "name": "0_基本配置", + "memo": null, + "kind": "visual", + "blocks": [ + { + "id": "b60be60e-d970-4e4f-9564-6a66b138d08a", + "name": "dialog.show_custom_dialog", + "isEnabled": true, + "inputs": { + "settings": { + "value": "10:{\"dialogTitle\":null,\"height\":0,\"width\":0,\"timeout\":0,\"autoCloseButton\":null,\"use_wait_timeout\":false,\"canRememberContent\":false,\"settings\":{\"editors\":[],\"buttons\":[{\"type\":\"Button\",\"label\":\"确定\",\"theme\":\"white\",\"hotKey\":\"Return\",\"uuid\":\"e49138d8-6857-4ef3-9550-4d098e95e7ce\"},{\"type\":\"Button\",\"label\":\"取消\",\"theme\":\"white\",\"hotKey\":\"Escape\",\"uuid\":\"5b7bd90e-50c1-4583-9e8a-d59ea1c1efc9\"}]}}" + }, + "dialog_title": { + "value": "10:" + }, + "default_btn": { + "value": "10:确定", + "display": "确定" + }, + "is_auto_click": { + "value": "13:False" + }, + "timeout": { + "value": null + }, + "globals": { + "value": "13:globals()" + }, + "locals": { + "value": "13:locals()" + }, + "storage_key": { + "value": "13:`block_id`" + } + }, + "outputs": { + "dialog_result": { + "name": "dialog_result", + "isEnable": true + } + } + }, + { + "id": "6e80cd80-7109-427c-87e8-22ffd91ef176", + "name": "workflow.if", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "operand1": { + "value": "11:dialog_result.pressed_button" + }, + "operator": { + "value": "10:!=", + "display": "不等于" + }, + "operand2": { + "value": "10:确定" + }, + "operator_options": { + "value": "10:{}" + } + }, + "outputs": {} + }, + { + "id": "2a389cae-75f6-43f1-a365-b2e47c1d4e18", + "name": "process.exit", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "2091634e-7ee7-4c1f-b3a8-cb3f00dc4770", + "name": "workflow.endif", + "isEnabled": true, + "inputs": {}, + "outputs": {} + } + ], + "parameters": [] + } + ] +} \ No newline at end of file diff --git a/data/superbrowser.json b/data/superbrowser.json new file mode 100644 index 0000000..e49a47c --- /dev/null +++ b/data/superbrowser.json @@ -0,0 +1,292 @@ +{ + "dependency": [ + "super_browser==25.9.3", + "activity_f4d5de04==23.11.1" + ], + "flow": [ + { + "name": "main", + "memo": "我的自动化应用", + "kind": "visual", + "blocks": [ + { + "id": "48a2e4c6-3b44-4e55-a581-0ed0d56323cc", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%,无返回结果", + "inputs": { + "process": { + "value": "10:setting_process", + "display": "0_基本配置" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result", + "isEnable": false + } + } + }, + { + "id": "ed930e1f-722d-43b9-9b84-0a0a175944ce", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%并传入参数%inputs:WyLotKblj7flgLzkuLol6LSm5Y+3Je+8jCIsIuWvhueggeWAvOS4uiXlr4bnoIEl77yMIiwi5LyB5Lia5ZCN56ew5YC85Li6JeS8geS4muWQjeensCXvvIwiXQ==%无返回结果", + "inputs": { + "process": { + "value": "10:login_process", + "display": "1_登录" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[{\"账号\":\"10:\"},{\"密码\":\"10:\"},{\"企业名称\":\"10:\"}]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result2", + "isEnable": false + } + } + }, + { + "id": "80850dab-a050-435e-b6b4-09f2aa2455f8", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%并传入参数%inputs:WyLlupfpk7rlkI3np7DlgLzkuLol5bqX6ZO65ZCN56ewJe+8jCJd%无返回结果", + "inputs": { + "process": { + "value": "10:func_process", + "display": "2_功能模块" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[{\"店铺名称\":\"10:\"}]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result3", + "isEnable": false + } + } + } + ], + "parameters": [] + }, + { + "name": "0_基本配置", + "memo": "setting_process", + "kind": "visual", + "blocks": [ + { + "id": "b60be60e-d970-4e4f-9564-6a66b138d08a", + "name": "dialog.show_custom_dialog", + "isEnabled": true, + "inputs": { + "settings": { + "value": "10:{\"dialogTitle\":null,\"height\":0,\"width\":0,\"timeout\":0,\"autoCloseButton\":null,\"use_wait_timeout\":false,\"canRememberContent\":false,\"settings\":{\"editors\":[],\"buttons\":[{\"type\":\"Button\",\"label\":\"确定\",\"theme\":\"white\",\"hotKey\":\"Return\",\"uuid\":\"e49138d8-6857-4ef3-9550-4d098e95e7ce\"},{\"type\":\"Button\",\"label\":\"取消\",\"theme\":\"white\",\"hotKey\":\"Escape\",\"uuid\":\"5b7bd90e-50c1-4583-9e8a-d59ea1c1efc9\"}]}}" + }, + "dialog_title": { + "value": "10:" + }, + "default_btn": { + "value": "10:确定", + "display": "确定" + }, + "is_auto_click": { + "value": "13:False" + }, + "timeout": { + "value": null + }, + "globals": { + "value": "13:globals()" + }, + "locals": { + "value": "13:locals()" + }, + "storage_key": { + "value": "13:`block_id`" + } + }, + "outputs": { + "dialog_result": { + "name": "dialog_result", + "isEnable": true + } + } + }, + { + "id": "6e80cd80-7109-427c-87e8-22ffd91ef176", + "name": "workflow.if", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "operand1": { + "value": "11:dialog_result.pressed_button" + }, + "operator": { + "value": "10:!=", + "display": "不等于" + }, + "operand2": { + "value": "10:确定" + }, + "operator_options": { + "value": "10:{}" + } + }, + "outputs": {} + }, + { + "id": "2a389cae-75f6-43f1-a365-b2e47c1d4e18", + "name": "process.exit", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "2091634e-7ee7-4c1f-b3a8-cb3f00dc4770", + "name": "workflow.endif", + "isEnabled": true, + "inputs": {}, + "outputs": {} + } + ], + "parameters": [] + }, + { + "name": "1_登录", + "memo": "login_process", + "kind": "visual", + "blocks": [ + { + "id": "81b42701-4cb6-4603-b262-75f793c92d58", + "name": "xbot_extensions.super_browser.A4 紫鸟登录", + "isEnabled": true, + "inputs": { + "紫鸟版本": { + "value": "10:V5", + "display": "V5" + }, + "企业名称": { + "value": "11:企业名称" + }, + "企业用户名": { + "value": "11:账号" + }, + "密码": { + "value": "11:密码" + }, + "是否填写账号密码": { + "value": "13:False" + }, + "是否退出登录": { + "value": "13:False" + } + }, + "outputs": {}, + "block_title": "紫鸟控制台操作/紫鸟登录" + } + ], + "parameters": [ + { + "name": "账号", + "direction": "In", + "type": "str", + "value": "", + "description": "", + "kind": "Text" + }, + { + "name": "密码", + "direction": "In", + "type": "str", + "value": "", + "description": "", + "kind": "Text" + }, + { + "name": "企业名称", + "direction": "In", + "type": "str", + "value": "", + "description": "", + "kind": "Text" + } + ] + }, + { + "name": "2_功能模块", + "memo": "func_process", + "kind": "visual", + "blocks": [ + { + "id": "a1d0e848-2023-4bb9-abbf-25214bb93ef5", + "name": "xbot_extensions.super_browser.A2 打开店铺", + "isEnabled": true, + "inputs": { + "店铺名称": { + "value": "11:店铺名称" + }, + "匹配类型": { + "value": "10:相等", + "display": "相等" + }, + "打开账号": { + "value": "10:点击", + "display": "点击" + }, + "隐私模式": { + "value": "13:False" + }, + "超时时间": { + "value": "13:50" + } + }, + "outputs": { + "完整店铺名称": { + "name": "完整店铺名称", + "isEnable": true + }, + "web_page": { + "name": "web_page", + "isEnable": true + } + }, + "block_title": "紫鸟控制台操作/打开店铺" + } + ], + "parameters": [ + { + "name": "店铺名称", + "direction": "In", + "type": "str", + "value": "", + "description": "", + "kind": "Text" + } + ] + } + ] +} diff --git a/data/templete1.json b/data/templete1.json new file mode 100644 index 0000000..cab97b9 --- /dev/null +++ b/data/templete1.json @@ -0,0 +1,167 @@ +{ + "name": "main", + "memo": "测试_jc", + "kind": "visual", + "blocks": [ + { + "id": "51db7333-6ae1-4429-ac86-354bd60e86d3", + "name": "excel.launch", + "isEnabled": true, + "inputs": { + "launch_way": { + "value": "10:open", + "display": "打开已有的Excel" + }, + "driver_way": { + "value": "10:auto_check", + "display": "自动检测" + }, + "open_filename": { + "value": "10:D:\\env_text\\京东商智商家版\\16839740_成交订单_2025-07-01~2025-07-31.xlsx" + }, + "save_filename": { + "value": "10:" + }, + "isvisible": { + "value": "13:False" + }, + "ignoreformula": { + "value": "13:False" + }, + "password": { + "value": null + }, + "write_password": { + "value": null + }, + "update_links": { + "value": "13:False" + } + }, + "outputs": { + "excel_instance": { + "name": "excel_instance", + "variableLabel": "打开的Excel对象", + "isEnable": true + } + } + }, + { + "id": "1ed06cd6-2b02-4ef9-a714-7a010f4e3e19", + "name": "excel.read_data_from_workbook", + "isEnabled": true, + "comment": "从Excel对象%workbook%中读取已使用的矩形区域内容,将数据保存到%excel_data%", + "inputs": { + "workbook": { + "value": "11:excel_instance", + "display": "excel_instance" + }, + "read_way": { + "value": "10:used_range", + "display": "已使用区域内容" + }, + "range": { + "value": null + }, + "cell_row_num": { + "value": null + }, + "cell_column_name": { + "value": null + }, + "area_begin_row_num": { + "value": null + }, + "area_begin_column_name": { + "value": null + }, + "area_end_row_num": { + "value": null + }, + "area_end_column_name": { + "value": null + }, + "row_row_num": { + "value": null + }, + "get_display_text": { + "value": "13:False" + }, + "has_header_row": { + "value": "13:False" + }, + "column_column_name": { + "value": null + }, + "sheet_name": { + "value": "10:" + }, + "using_text": { + "value": "13:False" + }, + "text_cols": { + "value": "10:" + }, + "clear_space": { + "value": "13:False" + } + }, + "outputs": { + "excel_data": { + "name": "excel_data", + "variableLabel": "Excel已使用区域内容", + "type": "list>", + "isEnable": true + } + } + }, + { + "id": "6da8c5eb-fcf5-4199-80f5-df5fd529a375", + "name": "excel.close", + "isEnabled": true, + "inputs": { + "operation": { + "value": "10:close_specified", + "display": "关闭指定Excel文件" + }, + "excel_instance": { + "value": "11:excel_instance" + }, + "close_way": { + "value": "10:save", + "display": "保存" + }, + "filename": { + "value": null + }, + "overwrite_file": { + "value": "13:True" + }, + "close_process": { + "value": "10:office", + "display": "office" + }, + "task_kill": { + "value": "13:True" + } + }, + "outputs": {} + }, + { + "id": "ee73d8ec-1441-45b2-8bec-4d4d10b4153a", + "name": "programing.log", + "isEnabled": true, + "inputs": { + "type": { + "value": "10:info", + "display": "信息" + }, + "text": { + "value": "11:excel_data" + } + }, + "outputs": {} + } + ], + "parameters": [] +} \ No newline at end of file diff --git a/data/test.json b/data/test.json new file mode 100644 index 0000000..fde032e --- /dev/null +++ b/data/test.json @@ -0,0 +1,3058 @@ +{ + "dependency": [ + "super_browser==25.9.3", + "activity_f4d5de04==23.11.1", + "activity_temu_shop==25.9.34", + "popup_detector==24.12.0" + ], + "name": "Temu通用模板", + "flow":[ + { + "name": "main", + "memo": "我的自动化应用", + "kind": "visual", + "blocks": [ + { + "id": "d27ac450-84a1-4ddd-957a-c61ee0d13931", + "name": "xbot_extensions.popup_detector.A1 智能屏蔽弹窗(web)", + "isEnabled": true, + "inputs": {}, + "outputs": {}, + "block_title": "弹窗智能侦测器/智能屏蔽弹窗(web)" + }, + { + "id": "5946f7ac-b75e-429b-8d87-dd63214c502e", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:唤起自定义对话框配置" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "3329baf5-8469-4c9a-9bb2-fead84bd35bb", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%,无返回结果", + "inputs": { + "process": { + "value": "10:process1", + "display": "0配置应用" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result", + "isEnable": false + } + } + }, + { + "id": "99fb4d22-e969-4233-9df8-244b165356dd", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:业务流程" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "f5703eff-78bc-44d8-9726-3da0c3723876", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:读取导入的文件数据:A列:账号 B列:密码 C列:店铺名称 D列:站点" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "0b7f3fd7-e404-4645-b40e-c7ef180e25f5", + "name": "excel.launch", + "isEnabled": true, + "inputs": { + "launch_way": { + "value": "10:open", + "display": "打开已有的Excel" + }, + "driver_way": { + "value": "10:auto_check", + "display": "自动检测" + }, + "open_filename": { + "value": "13:glv['config_path']" + }, + "save_filename": { + "value": "10:" + }, + "isvisible": { + "value": "13:True" + }, + "ignoreformula": { + "value": "13:False" + }, + "password": { + "value": null + }, + "write_password": { + "value": null + }, + "update_links": { + "value": "13:False" + } + }, + "outputs": { + "excel_instance": { + "name": "excel_instance", + "variableLabel": "打开的Excel对象", + "isEnable": true + } + } + }, + { + "id": "7404c49e-49d6-417d-aa20-f969d418d7c7", + "name": "excel.read_data_from_workbook", + "isEnabled": true, + "comment": "从Excel对象%workbook%中读取已使用的矩形区域内容,将数据保存到%excel_data%", + "inputs": { + "workbook": { + "value": "11:excel_instance", + "display": "excel_instance" + }, + "read_way": { + "value": "10:used_range", + "display": "已使用区域内容" + }, + "range": { + "value": null + }, + "cell_row_num": { + "value": null + }, + "cell_column_name": { + "value": null + }, + "area_begin_row_num": { + "value": null + }, + "area_begin_column_name": { + "value": null + }, + "area_end_row_num": { + "value": null + }, + "area_end_column_name": { + "value": null + }, + "row_row_num": { + "value": null + }, + "get_display_text": { + "value": "13:False" + }, + "has_header_row": { + "value": "13:False" + }, + "column_column_name": { + "value": null + }, + "sheet_name": { + "value": "10:" + }, + "using_text": { + "value": "13:False" + }, + "text_cols": { + "value": "10:" + }, + "clear_space": { + "value": "13:False" + } + }, + "outputs": { + "excel_data": { + "name": "excel_data", + "variableLabel": "Excel已使用区域内容", + "type": "list>", + "isEnable": true + } + } + }, + { + "id": "040ab193-5163-4929-bfd3-49b1e12c43bd", + "name": "programing.snippet", + "isEnabled": true, + "inputs": { + "snippet": { + "value": "10:glv['excel_data'] = excel_data" + } + }, + "outputs": {} + }, + { + "id": "9c1b7628-0fc4-413a-a656-0bc353e30b6c", + "name": "excel.close", + "isEnabled": true, + "inputs": { + "operation": { + "value": "10:close_specified", + "display": "关闭指定Excel文件" + }, + "excel_instance": { + "value": "11:excel_instance" + }, + "close_way": { + "value": "10:save", + "display": "保存" + }, + "filename": { + "value": null + }, + "overwrite_file": { + "value": "13:True" + }, + "close_process": { + "value": "10:office", + "display": "office" + }, + "task_kill": { + "value": "13:True" + } + }, + "outputs": {} + }, + { + "id": "ef3063ce-cbf3-420e-8f65-492b97501ce6", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:将店铺名称和站点进行数据格式化,转为dict" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "09bf777f-c43a-4d9a-b35d-e51fd92db501", + "name": "process.invoke_module", + "isEnabled": true, + "comment": "调用模块%module%中的%function%方法并传入参数%params:WyJhcmdz5YC85Li6JWFyZ3Ml77yMIl0=%将结果保存到%invoke_result%", + "inputs": { + "module": { + "value": "10:deal_with_data", + "display": "deal_with_data" + }, + "function": { + "value": "10:main" + }, + "params": { + "value": "16:[{\"args\":\"10:\"}]" + }, + "returnType": { + "value": "10:any" + } + }, + "outputs": { + "invoke_result": { + "name": "invoke_result", + "type": "any", + "isEnable": true + } + } + }, + { + "id": "09c0226c-01e2-4083-95c8-9f8443f01dee", + "name": "programing.log", + "isEnabled": true, + "inputs": { + "type": { + "value": "10:info", + "display": "信息" + }, + "text": { + "value": "10:成功读取配置文件" + } + }, + "outputs": {} + }, + { + "id": "ef66c8f8-2d25-498c-b018-b0c29eaac85e", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:获取店铺名称和站点格式化后的数据" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "85b04538-6a57-4750-b561-439f447daf91", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置任意类型变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:any" + }, + "value": { + "value": "13:glv['shop_dict']" + } + }, + "outputs": { + "variable": { + "name": "shop_dict", + "variableLabel": "任意类型", + "type": "any", + "isEnable": true + } + } + }, + { + "id": "ae6f635a-b9d1-4ef0-9581-6fad00f36f43", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:循环外层元组组成的账号密码为键的字典" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "c31f7c1c-7865-40d6-ace2-378d293714aa", + "name": "workflow.loop_dict", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "dict": { + "value": "11:shop_dict" + } + }, + "outputs": { + "loop_key": { + "name": "企业信息元组", + "isEnable": true + }, + "loop_value": { + "name": "紫鸟店铺信息字典", + "isEnable": true + } + } + }, + { + "id": "5d53fe24-fba1-49f3-842d-e0f677752f94", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:获取账号密码" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "d4cf0c05-1b42-42ac-9a18-8e68f3443a6d", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:企业信息元组[0]" + } + }, + "outputs": { + "variable": { + "name": "company", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "345a6650-02fc-4c48-9ff5-74c2b1005994", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:企业信息元组[1]" + } + }, + "outputs": { + "variable": { + "name": "username", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "7f92dbfb-07cb-4210-b721-e3f24a0f2f0b", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:企业信息元组[2]" + } + }, + "outputs": { + "variable": { + "name": "password", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "d3cfee96-37e2-4aa3-8fd7-84cefddc0e2f", + "name": "programing.try", + "isEnabled": true, + "foldState": "UnFold", + "inputs": {}, + "outputs": {} + }, + { + "id": "5e47d621-365f-417f-8e45-10f703b55125", + "name": "xbot_extensions.super_browser.A4 紫鸟登录", + "isEnabled": true, + "inputs": { + "紫鸟版本": { + "value": "10:V6", + "display": "V6" + }, + "企业名称": { + "value": "11:company" + }, + "企业用户名": { + "value": "11:username" + }, + "密码": { + "value": "11:password" + }, + "是否填写账号密码": { + "value": "13:True" + }, + "是否退出登录": { + "value": "13:True" + } + }, + "outputs": {}, + "block_title": "紫鸟控制台操作/紫鸟登录" + }, + { + "id": "f51d935e-8914-46d2-a359-fe4ee3c43c92", + "name": "programing.catch", + "isEnabled": true, + "foldState": "UnFold", + "inputs": {}, + "outputs": { + "exception": { + "name": "exception", + "isEnable": true + } + } + }, + { + "id": "cf5ab997-8f81-494b-a257-d03d65f4ad55", + "name": "programing.log", + "isEnabled": true, + "inputs": { + "type": { + "value": "10:error", + "display": "错误" + }, + "text": { + "value": "13:f'{username} 账号登录失败,失败原因:{exception}'" + } + }, + "outputs": {} + }, + { + "id": "9cab7db4-7c08-4c6b-ac05-f14f823ee357", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%并传入参数%inputs:WyLlupfpk7rkv6Hmga/lgLzkuLol5bqX6ZO65L+h5oGvJe+8jCIsIumUmeivr+aXpeW/l+WAvOS4uiXplJnor6/ml6Xlv5cl77yMIl0=%无返回结果", + "inputs": { + "process": { + "value": "10:process5", + "display": "D错误文件" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[{\"店铺信息\":\"13:f'{username} 紫鸟账号'\"},{\"错误日志\":\"11:exception\"}]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result5", + "isEnable": false + } + } + }, + { + "id": "2819e1d9-d0bc-4d48-87c2-8075280a011f", + "name": "workflow.continue", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "924599f5-e0ae-4a29-a268-d090eedcefe2", + "name": "programing.endtry", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "97742e6e-a42d-4c9f-873f-d634ba9a1e2a", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:循环内层店铺名称为键的字典" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "22ff4535-f365-49cb-bb00-28c54aa84496", + "name": "workflow.loop_dict", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "dict": { + "value": "11:紫鸟店铺信息字典" + } + }, + "outputs": { + "loop_key": { + "name": "紫鸟店铺", + "isEnable": true + }, + "loop_value": { + "name": "temu店铺", + "isEnable": true + } + } + }, + { + "id": "2a0407d2-39e4-48e0-92da-c7afa9222561", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置任意类型变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:any" + }, + "value": { + "value": "11:紫鸟店铺" + } + }, + "outputs": { + "variable": { + "name": "purple_shop_name", + "variableLabel": "任意类型", + "type": "any", + "isEnable": true + } + } + }, + { + "id": "890ca1b0-add2-48b8-9951-0cb08cc651b5", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:进行打开紫鸟店铺以及temu账号登录" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "64518066-e5b6-4602-87e9-c9d2a17f660d", + "name": "programing.try", + "isEnabled": true, + "foldState": "UnFold", + "inputs": {}, + "outputs": {} + }, + { + "id": "39d8df76-df25-43f8-953f-a41e4776003e", + "name": "xbot_extensions.super_browser.A2 打开店铺", + "isEnabled": true, + "inputs": { + "店铺名称": { + "value": "11:紫鸟店铺" + }, + "匹配类型": { + "value": "10:相等", + "display": "相等" + }, + "打开账号": { + "value": "10:点击", + "display": "点击" + }, + "隐私模式": { + "value": "13:False" + }, + "超时时间": { + "value": "13:50" + } + }, + "outputs": { + "完整店铺名称": { + "name": "完整店铺名称", + "isEnable": true + }, + "web_page": { + "name": "web_page2", + "isEnable": true + } + }, + "block_title": "紫鸟控制台操作/打开店铺" + }, + { + "id": "d4816254-f981-4984-aa88-9c7b2db8ab5c", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:将网页最大化" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "51c4e882-53ba-4a94-9e2a-3caf9cb2c4dc", + "name": "win32.window.get_window", + "isEnabled": true, + "comment": "获取当前激活窗口,将窗口对象保存到%result_window_instance%", + "inputs": { + "window_type": { + "value": "10:active", + "display": "当前激活窗口" + }, + "selector": { + "value": null + }, + "handle": { + "value": "10:" + }, + "title": { + "value": "10:" + }, + "handle_checked": { + "value": "13:False" + }, + "class_name": { + "value": "10:" + }, + "use_wildcard": { + "value": "13:False" + } + }, + "outputs": { + "result_window_instance": { + "name": "software_window", + "isEnable": true + } + } + }, + { + "id": "8e948c81-8e05-4141-9b2b-c56dee367c31", + "name": "win32.window.set_state", + "isEnabled": true, + "inputs": { + "window_type": { + "value": "10:window_instance", + "display": "窗口对象" + }, + "window": { + "value": "11:software_window", + "display": "software_window" + }, + "selector": { + "value": null + }, + "handle": { + "value": "10:" + }, + "title": { + "value": "10:" + }, + "handle_checked": { + "value": "13:False" + }, + "class_name": { + "value": "10:" + }, + "use_wildcard": { + "value": "13:False" + }, + "flag": { + "value": "10:maximize", + "display": "最大化窗口" + } + }, + "outputs": {} + }, + { + "id": "e98b676d-2b2f-46b5-a29e-194dbe5b3e79", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%,无返回结果", + "inputs": { + "process": { + "value": "10:process2", + "display": "A账号登录" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result4", + "isEnable": false + } + } + }, + { + "id": "a377f277-8ed3-4d17-bfad-fb452fbd5825", + "name": "programing.catch", + "isEnabled": true, + "foldState": "UnFold", + "inputs": {}, + "outputs": { + "exception": { + "name": "exception2", + "isEnable": true + } + } + }, + { + "id": "b46a5364-88e5-40d5-832c-3d4333ea9b48", + "name": "programing.log", + "isEnabled": true, + "inputs": { + "type": { + "value": "10:error", + "display": "错误" + }, + "text": { + "value": "13:f'{username} 账号的 {purple_shop_name} 紫鸟店铺切换失败,失败原因:{exception2}'" + } + }, + "outputs": {} + }, + { + "id": "5bf893ae-822d-4a81-a2e7-8dcd74c73aa5", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%并传入参数%inputs:WyLlupfpk7rkv6Hmga/lgLzkuLol5bqX6ZO65L+h5oGvJe+8jCIsIumUmeivr+aXpeW/l+WAvOS4uiXplJnor6/ml6Xlv5cl77yMIl0=%无返回结果", + "inputs": { + "process": { + "value": "10:process5", + "display": "D错误文件" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[{\"店铺信息\":\"13:f'{username} 账号 {purple_shop_name} 紫鸟店铺'\"},{\"错误日志\":\"11:exception2\"}]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result6", + "isEnable": false + } + } + }, + { + "id": "1893516d-5b9a-4bf6-894d-d06f62fe6e7e", + "name": "workflow.continue", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "3b6c922b-576c-4de9-8c1a-365ff595eed1", + "name": "programing.endtry", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "b862a2e5-947d-4406-a548-a1b98ed6f41a", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:循环站点,进行操作" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "cfd449e7-fb4e-4042-9384-bb08d94ca32e", + "name": "workflow.loop_dict", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "dict": { + "value": "11:temu店铺" + } + }, + "outputs": { + "loop_key": { + "name": "temu店铺名称", + "isEnable": true + }, + "loop_value": { + "name": "站点列表", + "isEnable": true + } + } + }, + { + "id": "e1dac6ce-390d-467e-b7ca-e74a4b549fc4", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:获取temu店铺名称" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "b80bf350-726c-427b-bea2-fd7aaede9520", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置任意类型变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:any" + }, + "value": { + "value": "13:temu店铺名称[0]" + } + }, + "outputs": { + "variable": { + "name": "temu_shop_name", + "variableLabel": "任意类型", + "type": "any", + "isEnable": true + } + } + }, + { + "id": "a8ca1e4b-36fe-4ba9-9e77-f9214f765d6a", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:temu店铺名称[1]" + } + }, + "outputs": { + "variable": { + "name": "temu_shop_type", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "d4329bc1-4e83-499b-ac78-d70a4f41025e", + "name": "programing.try", + "isEnabled": true, + "foldState": "UnFold", + "inputs": {}, + "outputs": {} + }, + { + "id": "d2e62b12-9499-4a01-a883-f237042294a3", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%并传入参数%inputs:WyLlupfpk7rlkI3np7DlgLzkuLol5bqX6ZO65ZCN56ewJe+8jCJd%无返回结果", + "inputs": { + "process": { + "value": "10:process3", + "display": "B切换店铺" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[{\"店铺名称\":\"11:temu_shop_name\"}]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result2", + "isEnable": false + } + } + }, + { + "id": "a6db9b17-8be6-42da-a39e-83d7345cedeb", + "name": "programing.catch", + "isEnabled": true, + "foldState": "UnFold", + "inputs": {}, + "outputs": { + "exception": { + "name": "exception3", + "isEnable": true + } + } + }, + { + "id": "e3f015df-683d-4d74-a1cb-f5de379aed7f", + "name": "programing.log", + "isEnabled": true, + "inputs": { + "type": { + "value": "10:error", + "display": "错误" + }, + "text": { + "value": "13:f' {purple_sho_name} 紫鸟店铺的 {temu_shop_name} temu店铺数据切换失败,失败原因:{exception3}'" + } + }, + "outputs": {} + }, + { + "id": "4e2221b0-1802-490e-b74e-987cc607afc5", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%并传入参数%inputs:WyLlupfpk7rkv6Hmga/lgLzkuLol5bqX6ZO65L+h5oGvJe+8jCIsIumUmeivr+aXpeW/l+WAvOS4uiXplJnor6/ml6Xlv5cl77yMIl0=%无返回结果", + "inputs": { + "process": { + "value": "10:process5", + "display": "D错误文件" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[{\"店铺信息\":\"13:f'{purple_sho_name} 紫鸟店铺的{temu_shop_name} temu店铺'\"},{\"错误日志\":\"11:exception3\"}]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result7", + "isEnable": false + } + } + }, + { + "id": "205ec243-1983-49ba-880c-98ade21eeb18", + "name": "workflow.continue", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "e41ef13a-692e-455e-b30d-35d318374abc", + "name": "programing.endtry", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "0d41d023-df67-4756-aaf2-d3394e77b8b0", + "name": "workflow.forin", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "list": { + "value": "11:站点列表" + }, + "loop_start_index": { + "value": "10:0" + }, + "loop_end_index": { + "value": "10:-1" + }, + "output_with_index": { + "value": "13:False" + } + }, + "outputs": { + "loop_item": { + "name": "站点", + "type": "any", + "isEnable": true + }, + "loop_index": { + "name": "loop_item_index", + "isEnable": false + } + } + }, + { + "id": "38f76393-6183-42cb-a701-24b2b998e94e", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置任意类型变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:any" + }, + "value": { + "value": "11:站点" + } + }, + "outputs": { + "variable": { + "name": "station", + "variableLabel": "任意类型", + "type": "any", + "isEnable": true + } + } + }, + { + "id": "4107cae8-f2cf-4e7b-b05a-bf1658666291", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:进行站点切换以及数据导出" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "51ac85fd-b189-409c-95f5-37dd9e7a3cd4", + "name": "programing.try", + "isEnabled": true, + "foldState": "UnFold", + "inputs": {}, + "outputs": {} + }, + { + "id": "86eaedbf-7d15-4072-b626-995bd96eab35", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%并传入参数%inputs:WyLnq5nngrnlgLzkuLol56uZ54K5Je+8jCIsIuW6l+mTuueKtuaAgeWAvOS4uiXlupfpk7rnirbmgIEl77yMIiwidGVtdeW6l+mTuuWQjeensOWAvOS4uiV0ZW115bqX6ZO65ZCN56ewJe+8jCJd%无返回结果", + "inputs": { + "process": { + "value": "10:process4", + "display": "C切换站点数据导出" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[{\"站点\":\"11:station\"},{\"店铺状态\":\"11:temu_shop_type\"},{\"temu店铺名称\":\"11:temu_shop_name\"}]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result3", + "isEnable": false + } + } + }, + { + "id": "6a48cb2f-618b-4971-9cc2-ef2fcf2ab9fe", + "name": "programing.catch", + "isEnabled": true, + "foldState": "UnFold", + "inputs": {}, + "outputs": { + "exception": { + "name": "exception4", + "isEnable": true + } + } + }, + { + "id": "ac8a0129-ee83-4294-bda5-e799892f820f", + "name": "programing.log", + "isEnabled": true, + "inputs": { + "type": { + "value": "10:error", + "display": "错误" + }, + "text": { + "value": "13:f'{purple_shop_name} 紫鸟店铺的 {temu_shop_name} temu店铺 的 {station}站点 数据导出失败,失败原因:{exception4}'" + } + }, + "outputs": {} + }, + { + "id": "6ea12c7e-e278-460d-ae86-6c6374419735", + "name": "process.run", + "isEnabled": true, + "comment": "执行流程%process%并传入参数%inputs:WyLlupfpk7rkv6Hmga/lgLzkuLol5bqX6ZO65L+h5oGvJe+8jCIsIumUmeivr+aXpeW/l+WAvOS4uiXplJnor6/ml6Xlv5cl77yMIl0=%无返回结果", + "inputs": { + "process": { + "value": "10:process5", + "display": "D错误文件" + }, + "package": { + "value": "11:__name__" + }, + "inputs": { + "value": "16:[{\"店铺信息\":\"10:{purple_shop_name} 紫鸟店铺的 {temu_shop_name} temu店铺 的 {station}站点\"},{\"错误日志\":\"11:exception4\"}]" + }, + "outputs": { + "value": "10:[]" + } + }, + "outputs": { + "process_result": { + "name": "process_result8", + "isEnable": false + } + } + }, + { + "id": "929c89bb-fcc4-4b93-9741-01d985a5b177", + "name": "workflow.continue", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "d43c5698-cf30-4288-90ff-0f4b0cc46068", + "name": "programing.endtry", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "90580bb9-69f5-441e-9e19-4f5d3b83c41b", + "name": "workflow.endloop", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "73a0de0a-439c-4f01-81b8-f93e7c79d029", + "name": "workflow.endloop", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "39769698-72af-48ea-8941-53004253ba6a", + "name": "workflow.endloop", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "d4435245-0099-4965-bafe-398150201d44", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:一个账号运行完毕,关闭浏览器" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "ae777f90-037d-42da-b484-4dbe32f0e6cb", + "name": "workflow.endloop", + "isEnabled": true, + "inputs": {}, + "outputs": {} + } + ], + "parameters": [] + }, + { + "name": "0配置应用", + "memo": "process1", + "kind": "visual", + "blocks": [ + { + "id": "6fccbaa3-0ebd-451d-a0b3-441a034bcea1", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:自定义对话框,配置文件" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "b05b2640-3a81-4695-a29e-c867230611d8", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "10:Temu-活动数据导出" + } + }, + "outputs": { + "variable": { + "name": "dialog_title", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "cae316ae-c333-4a2e-a28f-23868a286418", + "name": "dialog.show_custom_dialog", + "isEnabled": true, + "inputs": { + "settings": { + "value": "10:{\"dialogTitle\":{\"VAR\":\"dialog_title\"},\"height\":0,\"width\":0,\"timeout\":0,\"autoCloseButton\":null,\"use_wait_timeout\":false,\"canRememberContent\":true,\"settings\":{\"editors\":[{\"type\":\"File\",\"label\":\"配置文件\",\"VariableName\":\"shop_info_file\",\"kind\":0,\"filter\":\"所有文件|*.*\",\"value\":null,\"nullText\":\"请传入店铺信息文件\",\"uuid\":\"8cd377d3-4546-413e-bb2f-5ebd0a8dfc6b\"},{\"type\":\"File\",\"label\":\"文件夹路径\",\"VariableName\":\"save_dir\",\"kind\":2,\"filter\":\"所有文件|*.*\",\"value\":null,\"nullText\":\"导出的数据保存的文件夹位置\",\"uuid\":\"5915768d-a0e6-46b1-b16a-1d26b1aaeef1\"},{\"type\":\"Date\",\"label\":\"开始时间\",\"VariableName\":\"start_time\",\"value\":\"2025-09-17T19:54:25.5890395+08:00\",\"nullText\":null,\"dateFormat\":\"yyyy/MM/dd\",\"uuid\":\"e668d3dc-ae6c-48f0-bce6-1fe4c767b15d\"},{\"type\":\"Date\",\"label\":\"结束时间\",\"VariableName\":\"end_time\",\"value\":\"2025-09-17T19:54:38.6452829+08:00\",\"nullText\":null,\"dateFormat\":\"yyyy/MM/dd\",\"uuid\":\"ce203dfe-10f5-4a92-b463-296b7d83f885\"}],\"buttons\":[{\"type\":\"Button\",\"label\":\"确定\",\"theme\":\"white\",\"hotKey\":\"Return\",\"uuid\":\"d0da9a5e-76e0-4aad-b11a-c648353dd56b\"},{\"type\":\"Button\",\"label\":\"取消\",\"theme\":\"white\",\"hotKey\":\"Escape\",\"uuid\":\"bf1d4072-927b-4be8-a660-d3007f31fcc3\"}]}}" + }, + "dialog_title": { + "value": "11:dialog_title" + }, + "default_btn": { + "value": "10:确定", + "display": "确定" + }, + "is_auto_click": { + "value": "13:False" + }, + "timeout": { + "value": null + }, + "globals": { + "value": "13:globals()" + }, + "locals": { + "value": "13:locals()" + }, + "storage_key": { + "value": "13:`block_id`" + } + }, + "outputs": { + "dialog_result": { + "name": "dialog_result", + "isEnable": true + } + } + }, + { + "id": "abaddb33-0a09-42df-b218-d5263b6f3c6f", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:点击取消,则退出应用" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "ec4b1cd6-694c-477c-9380-f4ed50a1e4b4", + "name": "workflow.if", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "operand1": { + "value": "11:dialog_result.pressed_button" + }, + "operator": { + "value": "10:==", + "display": "等于" + }, + "operand2": { + "value": "10:取消" + }, + "operator_options": { + "value": "10:{}" + } + }, + "outputs": {} + }, + { + "id": "a27caba4-6b0f-47e9-bb59-b8fb2fc5b6a8", + "name": "process.exit", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "10ddf611-1dda-40a5-824e-6d432fc96bdc", + "name": "workflow.endif", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "f31595c7-9a08-4cd6-b217-28b429c16cc0", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:将选择的配置文件放到全局变量\r\nglv['config_path'] 全局店铺信息文件\r\nglv['config_save_dir'] 活动数据保存的文件夹" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "34614599-d822-4571-b17a-a8963e37407b", + "name": "programing.snippet", + "isEnabled": true, + "inputs": { + "snippet": { + "value": "10:glv['config_path'] = dialog_result.shop_info_file" + } + }, + "outputs": {} + }, + { + "id": "0477c739-a5f6-4b17-bce6-a85df4fd44e6", + "name": "programing.snippet", + "isEnabled": true, + "inputs": { + "snippet": { + "value": "10:glv['config_save_dir'] = dialog_result.save_dir" + } + }, + "outputs": {} + }, + { + "id": "409e2619-acd2-454f-b530-f65b128bc7e4", + "name": "programing.snippet", + "isEnabled": true, + "inputs": { + "snippet": { + "value": "10:glv['config_start_time'] = dialog_result.start_time" + } + }, + "outputs": {} + }, + { + "id": "415b81c0-7d3d-4104-993f-94de952116d4", + "name": "programing.snippet", + "isEnabled": true, + "inputs": { + "snippet": { + "value": "10:glv['config_end_time'] = dialog_result.end_time" + } + }, + "outputs": {} + }, + { + "id": "906a2a92-0647-4287-8152-7cdb67ea22a2", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:错误文件" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "d2bc4e45-a23b-4009-9f53-5255e5a31869", + "name": "datetime.now", + "isEnabled": true, + "inputs": {}, + "outputs": { + "datetime_instance": { + "name": "current_datetime", + "isEnable": true + } + } + }, + { + "id": "c5e0dc7d-e765-47c2-ac3f-d4a6669b4fe3", + "name": "datetime.to_string", + "isEnabled": true, + "inputs": { + "datetime": { + "value": "11:current_datetime" + }, + "format": { + "value": "10:%Y-%m-%d" + } + }, + "outputs": { + "text": { + "name": "current_day", + "isEnable": true + } + } + }, + { + "id": "b67e0a98-3bb2-4bec-9464-c9498dbf7b3f", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:f'错误文件-{current_day}'" + } + }, + "outputs": { + "variable": { + "name": "file_name", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "64eaca12-3dc4-4303-afec-3a53c330bcc4", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:f'{glv[\"config_save_dir\"]}' + '\\\\' + f'{file_name}.xlsx'" + } + }, + "outputs": { + "variable": { + "name": "file_path", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "510ed54b-f505-4017-804d-dabdfa456d57", + "name": "programing.snippet", + "isEnabled": true, + "inputs": { + "snippet": { + "value": "10:glv['config_error_path'] = file_path" + } + }, + "outputs": {} + }, + { + "id": "eff85b9b-a573-46c2-9954-f4f2e198e417", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:判断店铺数据文件是否存在,若不存在则终止应用" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "d615db4f-4710-41f5-93ce-0118e1cd3610", + "name": "file.if_exist", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "path": { + "value": "13:glv['config_path']" + }, + "expect_exist": { + "value": "10:no_exist", + "display": "不存在" + } + }, + "outputs": {} + }, + { + "id": "e3cd90a2-da13-4c53-bdc3-9eda16bcd7e0", + "name": "programing.log", + "isEnabled": true, + "inputs": { + "type": { + "value": "10:error", + "display": "错误" + }, + "text": { + "value": "10:店铺信息文件不存在" + } + }, + "outputs": {} + }, + { + "id": "8c416b5b-f208-4d7d-bbeb-b235159b9a79", + "name": "process.exit", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "800acec7-e8e7-412b-b895-f278ebcba7ca", + "name": "workflow.endif", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "2079320f-a813-4e0b-978a-9f954e7bb9cf", + "name": "dir.if_exist", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "path": { + "value": "13:glv['config_save_dir']" + }, + "expect_exist": { + "value": "10:no_exist", + "display": "不存在" + } + }, + "outputs": {} + }, + { + "id": "b6a48fa8-e0cf-4a4b-8299-9fe38e3e6ec9", + "name": "programing.log", + "isEnabled": true, + "inputs": { + "type": { + "value": "10:error", + "display": "错误" + }, + "text": { + "value": "10:数据导出的文件夹不存在" + } + }, + "outputs": {} + }, + { + "id": "02de4f5d-ae2b-463c-bcc4-60b03a79148a", + "name": "process.exit", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "2febe4b9-11bf-4e49-aaf2-f79df3fbbc77", + "name": "workflow.endif", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "5017c5a3-eec2-478a-ac84-f9d6ac3e0894", + "name": "file.if_exist", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "path": { + "value": "11:file_path" + }, + "expect_exist": { + "value": "10:no_exist", + "display": "不存在" + } + }, + "outputs": {} + }, + { + "id": "143ecd57-a842-407d-a2e7-c98e3711812a", + "name": "excel.launch", + "isEnabled": true, + "comment": "%launch_way% %save_filename%,将Excel对象保存到%excel_instance%", + "inputs": { + "launch_way": { + "value": "10:create", + "display": "新建Excel" + }, + "driver_way": { + "value": "10:auto_check", + "display": "自动检测" + }, + "open_filename": { + "value": "10:" + }, + "save_filename": { + "value": "11:file_path" + }, + "isvisible": { + "value": "13:True" + }, + "ignoreformula": { + "value": "13:False" + }, + "password": { + "value": "10:" + }, + "write_password": { + "value": "10:" + }, + "update_links": { + "value": "13:False" + } + }, + "outputs": { + "excel_instance": { + "name": "excel_instance", + "variableLabel": "新建的Excel对象", + "isEnable": true + } + } + }, + { + "id": "21afd482-a16b-40db-8320-bcd89c26c3d9", + "name": "excel.write_data_to_workbook", + "isEnabled": true, + "comment": "在Excel对象%workbook%中第%row_num%%write_way%,从第%begin_column_name%列开始写入内容%content%", + "inputs": { + "workbook": { + "value": "11:excel_instance", + "display": "excel_instance" + }, + "write_range": { + "value": "10:row", + "display": "行" + }, + "write_way": { + "value": "10:override", + "display": "覆盖一行" + }, + "write_column_way": { + "value": "10:override", + "display": "覆盖一列" + }, + "row_num": { + "value": "10:1" + }, + "column_name": { + "value": "10:" + }, + "begin_row_num": { + "value": "10:0" + }, + "begin_column_name": { + "value": "10:A" + }, + "content": { + "value": "13:['时间','店铺信息', '错误原因']" + }, + "sheet_name": { + "value": "10:" + }, + "write_as_text_cols": { + "value": null + } + }, + "outputs": {} + }, + { + "id": "3b5519d1-7a82-453a-bf63-090a95060077", + "name": "excel.close", + "isEnabled": true, + "inputs": { + "operation": { + "value": "10:close_specified", + "display": "关闭指定Excel文件" + }, + "excel_instance": { + "value": "11:excel_instance" + }, + "close_way": { + "value": "10:save", + "display": "保存" + }, + "filename": { + "value": null + }, + "overwrite_file": { + "value": "13:True" + }, + "close_process": { + "value": "10:office", + "display": "office" + }, + "task_kill": { + "value": "13:True" + } + }, + "outputs": {} + }, + { + "id": "bb23b5ba-b3e3-4b96-9491-72380939f9d3", + "name": "workflow.endif", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "be2fffd5-12df-4162-9b10-a7d0efccb052", + "name": "programing.log", + "isEnabled": true, + "inputs": { + "type": { + "value": "10:info", + "display": "信息" + }, + "text": { + "value": "10:文件配置成功" + } + }, + "outputs": {} + } + ], + "parameters": [] + }, + { + "name": "A账号登录", + "memo": "process2", + "kind": "visual", + "blocks": [ + { + "id": "87b21e81-eb76-4163-b20d-6ff6a93a180a", + "name": "web.get", + "isEnabled": true, + "comment": "在%web_type%中匹配当前选中的网页,将网页对象保存到%browser%,网页加载超时后重试此指令", + "inputs": { + "web_type": { + "value": "10:ziniaobrowser", + "display": "ziniaobrowser" + }, + "mode": { + "value": "10:activated", + "display": "匹配当前选中的网页" + }, + "value": { + "value": "10:" + }, + "use_wildcard": { + "value": "13:False" + }, + "silent_running": { + "value": "13:False" + }, + "wait_load_completed": { + "value": "13:True" + }, + "load_timeout": { + "value": "10:20" + }, + "stop_load_if_load_timeout": { + "value": "10:handleExcept", + "display": "执行\"错误处理\"" + }, + "open_page": { + "value": "13:False" + }, + "url": { + "value": null + } + }, + "outputs": { + "browser": { + "name": "web_page", + "isEnable": true + } + }, + "exception_handling": { + "logging": true, + "mode": "retry", + "retryTime": 3, + "retryInterval": 3 + } + }, + { + "id": "0b2c905a-80ac-4b23-bdcd-7f5b63b45d3b", + "name": "web.browser.get_details", + "isEnabled": true, + "inputs": { + "browser": { + "value": "11:web_page", + "display": "web_page" + }, + "operation": { + "value": "10:url", + "display": "获取网址" + } + }, + "outputs": { + "webpage_attribute": { + "name": "web_page_attribute", + "variableLabel": "网页地址", + "isEnable": true + } + } + }, + { + "id": "4b31a9ff-e5bf-4bbf-ae19-beb55ced5ec0", + "name": "workflow.if", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "operand1": { + "value": "11:web_page_attribute" + }, + "operator": { + "value": "10:in", + "display": "包含" + }, + "operand2": { + "value": "13:'login'" + }, + "operator_options": { + "value": "10:{\"ignoreCase\":\"False\"}" + } + }, + "outputs": {} + }, + { + "id": "c73f265d-e6a5-4c3b-a01f-aa5a618242f2", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:点击同意复选框" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "7c7b5841-6dfe-4cf4-a9d6-519ff6d740ff", + "name": "web.element.click", + "isEnabled": true, + "inputs": { + "browser": { + "value": "11:web_page", + "display": "web_page" + }, + "element": { + "value": "12:登录页面_同意按钮", + "display": "登录页面_同意按钮" + }, + "simulate": { + "value": "13:True" + }, + "move_mouse": { + "value": "13:False" + }, + "clicks": { + "value": "10:click", + "display": "单击" + }, + "button": { + "value": "10:left", + "display": "鼠标左键" + }, + "keys": { + "value": "10:null", + "display": "无" + }, + "delay_after": { + "value": "10:1" + }, + "anchor_type": { + "value": "10:center", + "display": "中心点" + }, + "sudoku_part": { + "value": "10:MiddleCenter" + }, + "offset_x": { + "value": "10:0" + }, + "offset_y": { + "value": "10:0" + }, + "timeout": { + "value": "10:20" + } + }, + "outputs": {} + }, + { + "id": "e72918a2-583d-4c29-9370-4f549f19ce1c", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:点击登录" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "b9eaea24-017d-43e9-8960-d61e3fcb1851", + "name": "web.element.click", + "isEnabled": true, + "inputs": { + "browser": { + "value": "11:web_page", + "display": "web_page" + }, + "element": { + "value": "12:登录_按钮", + "display": "登录_按钮" + }, + "simulate": { + "value": "13:True" + }, + "move_mouse": { + "value": "13:False" + }, + "clicks": { + "value": "10:click", + "display": "单击" + }, + "button": { + "value": "10:left", + "display": "鼠标左键" + }, + "keys": { + "value": "10:null", + "display": "无" + }, + "delay_after": { + "value": "10:1" + }, + "anchor_type": { + "value": "10:center", + "display": "中心点" + }, + "sudoku_part": { + "value": "10:MiddleCenter" + }, + "offset_x": { + "value": "10:0" + }, + "offset_y": { + "value": "10:0" + }, + "timeout": { + "value": "10:20" + } + }, + "outputs": {} + }, + { + "id": "5d82120a-2938-4bc1-82d0-bd95dddc3dff", + "name": "web.browser.element_display", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "browser": { + "value": "11:web_page", + "display": "web_page" + }, + "content_type": { + "value": "10:display", + "display": "可见" + }, + "selector": { + "value": "12:授权_勾选框", + "display": "授权_勾选框" + } + }, + "outputs": {} + }, + { + "id": "2b93a1c0-4e01-4e3f-abd1-27b7fb9d9c7e", + "name": "web.element.click", + "isEnabled": true, + "inputs": { + "browser": { + "value": "11:web_page", + "display": "web_page" + }, + "element": { + "value": "12:授权_勾选框", + "display": "授权_勾选框" + }, + "simulate": { + "value": "13:True" + }, + "move_mouse": { + "value": "13:False" + }, + "clicks": { + "value": "10:click", + "display": "单击" + }, + "button": { + "value": "10:left", + "display": "鼠标左键" + }, + "keys": { + "value": "10:null", + "display": "无" + }, + "delay_after": { + "value": "10:1" + }, + "anchor_type": { + "value": "10:center", + "display": "中心点" + }, + "sudoku_part": { + "value": "10:MiddleCenter" + }, + "offset_x": { + "value": "10:0" + }, + "offset_y": { + "value": "10:0" + }, + "timeout": { + "value": "10:20" + } + }, + "outputs": {} + }, + { + "id": "6d869ab1-03b8-48a3-a5e7-9f6332a895a8", + "name": "workflow.endif", + "isEnabled": true, + "inputs": {}, + "outputs": {} + }, + { + "id": "e30ae832-a456-4b66-bb5b-fd75aababe5d", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:进行站点登录" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "5e482386-31eb-4e07-8c7a-3a01cd762206", + "name": "web.element.click", + "isEnabled": true, + "inputs": { + "browser": { + "value": "11:web_page", + "display": "web_page" + }, + "element": { + "value": "12:跨境Temu商家中心", + "display": "跨境Temu商家中心" + }, + "simulate": { + "value": "13:True" + }, + "move_mouse": { + "value": "13:False" + }, + "clicks": { + "value": "10:click", + "display": "单击" + }, + "button": { + "value": "10:left", + "display": "鼠标左键" + }, + "keys": { + "value": "10:null", + "display": "无" + }, + "delay_after": { + "value": "10:1" + }, + "anchor_type": { + "value": "10:center", + "display": "中心点" + }, + "sudoku_part": { + "value": "10:MiddleCenter" + }, + "offset_x": { + "value": "10:0" + }, + "offset_y": { + "value": "10:0" + }, + "timeout": { + "value": "10:20" + } + }, + "outputs": {} + }, + { + "id": "a2ecb0a4-ed16-4ee5-b012-efb7890c2552", + "name": "workflow.endif", + "isEnabled": true, + "inputs": {}, + "outputs": {} + } + ], + "parameters": [] + }, + { + "name": "B切换店铺", + "memo": "process3", + "kind": "visual", + "blocks": [ + { + "id": "88f7a385-595e-4354-be7b-bdfbdfeeca79", + "name": "web.get", + "isEnabled": true, + "comment": "在%web_type%中匹配当前选中的网页,将网页对象保存到%browser%,网页加载超时后重试此指令", + "inputs": { + "web_type": { + "value": "10:ziniaobrowser", + "display": "ziniaobrowser" + }, + "mode": { + "value": "10:activated", + "display": "匹配当前选中的网页" + }, + "value": { + "value": "10:" + }, + "use_wildcard": { + "value": "13:False" + }, + "silent_running": { + "value": "13:False" + }, + "wait_load_completed": { + "value": "13:True" + }, + "load_timeout": { + "value": "10:20" + }, + "stop_load_if_load_timeout": { + "value": "10:handleExcept", + "display": "执行\"错误处理\"" + }, + "open_page": { + "value": "13:False" + }, + "url": { + "value": null + } + }, + "outputs": { + "browser": { + "name": "web_page", + "isEnable": true + } + }, + "exception_handling": { + "logging": true, + "mode": "retry", + "retryTime": 3, + "retryInterval": 3 + } + }, + { + "id": "7af8ecc4-f6bf-4d94-b14b-cab6a59c8cf9", + "name": "xbot_extensions.activity_temu_shop.switch_store", + "isEnabled": true, + "inputs": { + "web_page": { + "value": "11:web_page", + "display": "web_page" + }, + "store_name": { + "value": "11:店铺名称" + } + }, + "outputs": {}, + "block_title": "temu 商家后台扩展/Temu-切换店铺" + } + ], + "parameters": [ + { + "name": "店铺名称", + "direction": "In", + "type": "str", + "value": "", + "description": "", + "kind": "Text" + } + ] + }, + { + "name": "C切换站点数据导出", + "memo": "process4", + "kind": "visual", + "blocks": [ + { + "id": "69630f85-cdcb-4d2d-89e4-9d67d3530e1f", + "name": "web.get", + "isEnabled": true, + "comment": "在%web_type%中匹配当前选中的网页,将网页对象保存到%browser%,网页加载超时后重试此指令", + "inputs": { + "web_type": { + "value": "10:ziniaobrowser", + "display": "ziniaobrowser" + }, + "mode": { + "value": "10:activated", + "display": "匹配当前选中的网页" + }, + "value": { + "value": "10:" + }, + "use_wildcard": { + "value": "13:False" + }, + "silent_running": { + "value": "13:False" + }, + "wait_load_completed": { + "value": "13:True" + }, + "load_timeout": { + "value": "10:20" + }, + "stop_load_if_load_timeout": { + "value": "10:handleExcept", + "display": "执行\"错误处理\"" + }, + "open_page": { + "value": "13:False" + }, + "url": { + "value": null + } + }, + "outputs": { + "browser": { + "name": "web_page", + "isEnable": true + } + }, + "exception_handling": { + "logging": true, + "mode": "retry", + "retryTime": 3, + "retryInterval": 3 + } + }, + { + "id": "8ef6359f-944f-4a87-962f-47f0bce2b5ea", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:获取全局变量" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "94b36c07-24ab-4e16-8851-d884212550fb", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:glv['config_start_time']" + } + }, + "outputs": { + "variable": { + "name": "start_time", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "b809a1f6-63c8-4d5f-a33f-dea0bb94151a", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:glv['config_end_time']" + } + }, + "outputs": { + "variable": { + "name": "end_time", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "4f3b811b-b291-4910-8328-a8379081b2f8", + "name": "datetime.to_string", + "isEnabled": true, + "inputs": { + "datetime": { + "value": "11:start_time" + }, + "format": { + "value": "10:%Y-%m-%d" + } + }, + "outputs": { + "text": { + "name": "start_time", + "isEnable": true + } + } + }, + { + "id": "d486f1aa-85b1-40f5-b3f5-a1c9c23fcf72", + "name": "datetime.to_string", + "isEnabled": true, + "inputs": { + "datetime": { + "value": "11:end_time" + }, + "format": { + "value": "10:%Y-%m-%d" + } + }, + "outputs": { + "text": { + "name": "end_time", + "isEnable": true + } + } + }, + { + "id": "111de464-fa98-42be-a0ef-39e26480efc6", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:f'{start_time}~{end_time}'" + } + }, + "outputs": { + "variable": { + "name": "time", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "4b2d47ef-3d48-44f4-b67a-906f29c71f41", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:glv['config_save_dir']" + } + }, + "outputs": { + "variable": { + "name": "save_dir", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "2603acaf-c619-4cef-aa82-9bd361283369", + "name": "datetime.now", + "isEnabled": true, + "inputs": {}, + "outputs": { + "datetime_instance": { + "name": "current_datetime", + "isEnable": true + } + } + }, + { + "id": "265813c0-e32e-42e9-a9d6-a98b4e0bcb1e", + "name": "datetime.to_string", + "isEnabled": true, + "inputs": { + "datetime": { + "value": "11:current_datetime" + }, + "format": { + "value": "10:%Y-%m-%d" + } + }, + "outputs": { + "text": { + "name": "current_day", + "isEnable": true + } + } + }, + { + "id": "58b08baf-0d73-40d2-bedf-fa3b47ddfe18", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:f'{temu店铺名称}-{站点}-{current_day}.xlsx'" + } + }, + "outputs": { + "variable": { + "name": "file_name", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "78f2790c-461d-4bb2-92c5-919c7b51d530", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:进行站点切换" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "b8b327b3-f2f7-47ea-b94d-68fe2ba53731", + "name": "xbot_extensions.activity_temu_shop.switch_area", + "isEnabled": true, + "inputs": { + "web_page": { + "value": "11:web_page", + "display": "web_page" + }, + "area": { + "value": "11:站点" + } + }, + "outputs": {}, + "block_title": "temu 商家后台扩展/Temu-卖家中心-切换区域" + }, + { + "id": "08f61eb4-426c-42e3-8d4f-958aa2b3ff61", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:判断店铺是全托还是半托" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "bd295035-fddb-4d6d-bb59-c85789592b40", + "name": "programing.log", + "isEnabled": true, + "inputs": { + "type": { + "value": "10:info", + "display": "信息" + }, + "text": { + "value": "11:店铺状态" + } + }, + "outputs": {} + }, + { + "id": "0bc10f44-bd3f-4eb4-bf4e-df741d806779", + "name": "workflow.if", + "isEnabled": true, + "foldState": "UnFold", + "inputs": { + "operand1": { + "value": "11:店铺状态" + }, + "operator": { + "value": "10:in", + "display": "包含" + }, + "operand2": { + "value": "13:'全托'" + }, + "operator_options": { + "value": "10:{\"ignoreCase\":\"False\"}" + } + }, + "outputs": {} + }, + { + "id": "98c60045-f892-45ed-b379-16033a65171c", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:进行全托店铺的数据导出" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "a57f1f6e-4398-42b7-bcb3-d7dc2f9f0ca1", + "name": "web.get", + "isEnabled": true, + "comment": "在%web_type%中匹配当前选中的网页,将网页对象保存到%browser%,网页加载超时后重试此指令", + "inputs": { + "web_type": { + "value": "10:ziniaobrowser", + "display": "ziniaobrowser" + }, + "mode": { + "value": "10:activated", + "display": "匹配当前选中的网页" + }, + "value": { + "value": "10:" + }, + "use_wildcard": { + "value": "13:False" + }, + "silent_running": { + "value": "13:False" + }, + "wait_load_completed": { + "value": "13:True" + }, + "load_timeout": { + "value": "10:20" + }, + "stop_load_if_load_timeout": { + "value": "10:handleExcept", + "display": "执行\"错误处理\"" + }, + "open_page": { + "value": "13:False" + }, + "url": { + "value": null + } + }, + "outputs": { + "browser": { + "name": "web_page", + "isEnable": true + } + }, + "exception_handling": { + "logging": true, + "mode": "retry", + "retryTime": 3, + "retryInterval": 3 + } + }, + { + "id": "d0217630-9805-4aff-9800-4fb726483bd2", + "name": "xbot_extensions.activity_temu_shop.active_data_export", + "isEnabled": true, + "inputs": { + "web_page": { + "value": "11:web_page", + "display": "web_page" + }, + "time_range": { + "value": "11:time" + }, + "file_folder": { + "value": "11:save_dir" + }, + "file_name": { + "value": "11:file_name" + } + }, + "outputs": { + "file_path": { + "name": "file_path", + "isEnable": true + } + }, + "block_title": "temu 商家后台扩展/Temu-数据中心-活动数据导出(全托)" + }, + { + "id": "89442ceb-36ce-4e27-982c-81d3fbadc6cd", + "name": "workflow.else", + "isEnabled": true, + "foldState": "UnFold", + "inputs": {}, + "outputs": {} + }, + { + "id": "709c7983-926b-462e-9af1-1103394f7b9a", + "name": "programing.comment", + "isEnabled": true, + "inputs": { + "content": { + "value": "10:进行半托店铺数据导出" + } + }, + "outputs": {}, + "isCommentBlockExpanded": true + }, + { + "id": "c4486439-0a74-4bdf-b11c-93f72f64a164", + "name": "web.get", + "isEnabled": true, + "comment": "在%web_type%中匹配当前选中的网页,将网页对象保存到%browser%,网页加载超时后重试此指令", + "inputs": { + "web_type": { + "value": "10:ziniaobrowser", + "display": "ziniaobrowser" + }, + "mode": { + "value": "10:activated", + "display": "匹配当前选中的网页" + }, + "value": { + "value": "10:" + }, + "use_wildcard": { + "value": "13:False" + }, + "silent_running": { + "value": "13:False" + }, + "wait_load_completed": { + "value": "13:True" + }, + "load_timeout": { + "value": "10:20" + }, + "stop_load_if_load_timeout": { + "value": "10:handleExcept", + "display": "执行\"错误处理\"" + }, + "open_page": { + "value": "13:False" + }, + "url": { + "value": null + } + }, + "outputs": { + "browser": { + "name": "web_page", + "isEnable": true + } + }, + "exception_handling": { + "logging": true, + "mode": "retry", + "retryTime": 3, + "retryInterval": 3 + } + }, + { + "id": "78520fcf-8c41-407c-936d-4b98c017489a", + "name": "xbot_extensions.activity_temu_shop.active_data_export_half", + "isEnabled": true, + "inputs": { + "web_page": { + "value": "11:web_page", + "display": "web_page" + }, + "time_range": { + "value": "11:time" + }, + "file_folder": { + "value": "11:save_dir" + }, + "file_name": { + "value": "11:file_name" + } + }, + "outputs": { + "file_path": { + "name": "file_path2", + "isEnable": true + } + }, + "block_title": "temu 商家后台扩展/Temu-数据中心-活动数据导出(半托)" + }, + { + "id": "e407a9e8-21c9-4432-9e0b-4b80754c40a8", + "name": "workflow.endif", + "isEnabled": true, + "inputs": {}, + "outputs": {} + } + ], + "parameters": [ + { + "name": "站点", + "direction": "In", + "type": "str", + "value": "", + "description": "", + "kind": "Text" + }, + { + "name": "店铺状态", + "direction": "In", + "type": "str", + "value": "", + "description": "", + "kind": "Text" + }, + { + "name": "temu店铺名称", + "direction": "In", + "type": "str", + "value": "", + "description": "", + "kind": "Text" + } + ] + }, + { + "name": "D错误文件", + "memo": "process5", + "kind": "visual", + "blocks": [ + { + "id": "d520efe6-61a8-4fa0-b293-35ab6f8baee2", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "13:glv['config_error_path']" + } + }, + "outputs": { + "variable": { + "name": "error_path", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "6e883b1e-7be2-4a84-b21d-9d4a3cd275ff", + "name": "datetime.now", + "isEnabled": true, + "inputs": {}, + "outputs": { + "datetime_instance": { + "name": "current_datetime", + "isEnable": true + } + } + }, + { + "id": "ae93432d-21a9-4ebe-8ce6-a9d15bcc1363", + "name": "datetime.to_string", + "isEnabled": true, + "inputs": { + "datetime": { + "value": "11:current_datetime" + }, + "format": { + "value": "10:%Y年%m月%d日 %H:%M:%S" + } + }, + "outputs": { + "text": { + "name": "current_time", + "isEnable": true + } + } + }, + { + "id": "8b861421-99f9-4a0d-a5ab-b9f2c7dcdd68", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "11:店铺信息" + } + }, + "outputs": { + "variable": { + "name": "shop_info", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "16938ecf-e052-4ed2-a160-75d8515cd00b", + "name": "programing.variable", + "isEnabled": true, + "comment": "设置字符串变量%variable%=%value%", + "inputs": { + "value_type": { + "value": "10:str" + }, + "value": { + "value": "11:错误日志" + } + }, + "outputs": { + "variable": { + "name": "error_info", + "variableLabel": "字符串", + "type": "str", + "isEnable": true + } + } + }, + { + "id": "86808c30-38d1-49f7-b017-7af12b7f18ec", + "name": "excel.launch", + "isEnabled": true, + "inputs": { + "launch_way": { + "value": "10:open", + "display": "打开已有的Excel" + }, + "driver_way": { + "value": "10:auto_check", + "display": "自动检测" + }, + "open_filename": { + "value": "11:error_path" + }, + "save_filename": { + "value": "10:" + }, + "isvisible": { + "value": "13:True" + }, + "ignoreformula": { + "value": "13:False" + }, + "password": { + "value": null + }, + "write_password": { + "value": null + }, + "update_links": { + "value": "13:False" + } + }, + "outputs": { + "excel_instance": { + "name": "excel_instance", + "variableLabel": "打开的Excel对象", + "isEnable": true + } + } + }, + { + "id": "487c2cda-a5aa-46a0-8e6e-fc7d3a94ce53", + "name": "excel.write_data_to_workbook", + "isEnabled": true, + "comment": "在Excel对象%workbook%中%write_way%,从第%begin_column_name%列开始写入内容%content%", + "inputs": { + "workbook": { + "value": "11:excel_instance", + "display": "excel_instance" + }, + "write_range": { + "value": "10:row", + "display": "行" + }, + "write_way": { + "value": "10:append", + "display": "追加一行" + }, + "write_column_way": { + "value": "10:override", + "display": "覆盖一列" + }, + "row_num": { + "value": "10:0" + }, + "column_name": { + "value": "10:" + }, + "begin_row_num": { + "value": "10:0" + }, + "begin_column_name": { + "value": "10:A" + }, + "content": { + "value": "13:[f'{current_time}',f'{shop_info}',f'{error_info}']" + }, + "sheet_name": { + "value": "10:" + }, + "write_as_text_cols": { + "value": null + } + }, + "outputs": {} + }, + { + "id": "c2dbbec9-2f37-4e05-b469-3ce7fefc9c6c", + "name": "excel.close", + "isEnabled": true, + "inputs": { + "operation": { + "value": "10:close_specified", + "display": "关闭指定Excel文件" + }, + "excel_instance": { + "value": "11:excel_instance" + }, + "close_way": { + "value": "10:save", + "display": "保存" + }, + "filename": { + "value": null + }, + "overwrite_file": { + "value": "13:True" + }, + "close_process": { + "value": "10:office", + "display": "office" + }, + "task_kill": { + "value": "13:True" + } + }, + "outputs": {} + } + ], + "parameters": [ + { + "name": "店铺信息", + "direction": "In", + "type": "str", + "value": "", + "description": "", + "kind": "Text" + }, + { + "name": "错误日志", + "direction": "In", + "type": "str", + "value": "", + "description": "", + "kind": "Text" + } + ] + } + ] +} \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e69de29 diff --git a/src/Converter/__pycache__/utils.cpython-310.pyc b/src/Converter/__pycache__/utils.cpython-310.pyc new file mode 100644 index 0000000..de8312b Binary files /dev/null and b/src/Converter/__pycache__/utils.cpython-310.pyc differ diff --git a/src/Converter/utils.py b/src/Converter/utils.py new file mode 100644 index 0000000..a4578d0 --- /dev/null +++ b/src/Converter/utils.py @@ -0,0 +1,36 @@ +import random +import re +import time + + +def clear_quote(s): + if s.startswith("'") and s.endswith("'"): + return s[1:-1] + elif s.startswith('"') and s.endswith('"'): + return s[1:-1] + else: + return s + + +def convert_self_to_glv(python_code: str) -> str: + if 'self' not in python_code: + return python_code + + # 第一步:替换属性访问 self.xxx → glv['xxx'] or self.xxx -> glv["xxx"] + # NOTE(huifu.zc) 这里无法完全避免 rf'glv['abc']' 这样的问题, 只能尽力避免 + if python_code.find('"') > 0: + python_code = re.sub(r'\bself\.([a-zA-Z_][a-zA-Z0-9_]*)', r"glv['\1']", python_code) + else: + python_code = re.sub(r'\bself\.([a-zA-Z_][a-zA-Z0-9_]*)', r'glv["\1"]', python_code) + + # 第二步:替换函数参数中的self → glv + # 增强的正则表达式,处理赋值情况 (project=self) + python_code = re.sub(r'([(,=]\s*)\bself\b(?!\.)', r'\1glv', python_code) + + return python_code + + +def gen_random_var(var_base: str): + time_in_ns = str(int(time.time_ns()/100)) + random.seed(time.time_ns()) + return f"{var_base}_{time_in_ns[-6:]}_{random.randint(100, 200)}" diff --git a/src/Xbot/Blockly/BlockManager.py b/src/Xbot/Blockly/BlockManager.py new file mode 100644 index 0000000..09c9d0b --- /dev/null +++ b/src/Xbot/Blockly/BlockManager.py @@ -0,0 +1,193 @@ +import json +import os +import sys +from typing import Dict, Any, Optional, List +import logging +import glob +from .BlockPrototype import BlockPrototype, FieldPrototype +from .Variable import VariablePrototype + +class BlockManager: + """块定义管理器""" + _instance = None + _component_configs: Dict[str, Dict] = {} # 存储每个组件的配置,键为组件名称 + _block_prototypes: Dict[str, BlockPrototype] = {} # 缓存已加载的块原型 + + def __new__(cls): + if cls._instance is None: + cls._instance = super(BlockManager, cls).__new__(cls) + cls._instance._load_block_configs() + return cls._instance + + def _get_resource_path(self, relative_path): + """获取资源文件的路径,支持普通运行和打包环境""" + # 检查是否在PyInstaller环境中运行 + if hasattr(sys, '_MEIPASS'): + # PyInstaller创建的临时文件夹 + base_path = sys._MEIPASS + else: + # 普通Python环境 + base_path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + + return os.path.join(base_path, relative_path) + + def _load_block_configs(self): + """加载所有块定义配置文件""" + try: + # 获取块配置文件目录 + config_dir = self._get_resource_path("assert/block_settings") + + if not os.path.exists(config_dir): + logging.warning(f"找不到块配置目录: {config_dir}") + # 在打包环境中尝试其他可能的路径 + if hasattr(sys, '_MEIPASS'): + alt_paths = [ + os.path.join(sys._MEIPASS, "block_settings"), + os.path.join(sys._MEIPASS, "assert", "block_settings"), + ] + for alt_path in alt_paths: + if os.path.exists(alt_path): + config_dir = alt_path + logging.info(f"找到替代块配置目录: {config_dir}") + break + else: + # 输出更详细的诊断信息 + logging.error(f"无法找到块配置目录,已尝试以下路径:") + for path in [config_dir] + alt_paths: + logging.error(f" - {path}") + if hasattr(sys, '_MEIPASS'): + logging.error(f"PyInstaller临时目录内容: {os.listdir(sys._MEIPASS)}") + return + else: + return + + # 查找所有 .blocks.json 文件 + config_files = glob.glob(os.path.join(config_dir, "*.blocks.json")) + + if not config_files: + logging.warning(f"未找到块配置文件: {config_dir}") + # 列出目录内容以进行诊断 + if os.path.exists(config_dir): + logging.warning(f"目录内容: {os.listdir(config_dir)}") + return + + # 加载每个文件 + for config_file in config_files: + try: + with open(config_file, 'r', encoding='utf-8-sig') as f: + config_data = json.load(f) + # 从文件名获取组件名称 + component_name = os.path.basename(config_file).split('.')[0] + self._component_configs[component_name] = config_data + + # 预加载所有块原型 + for block_data in config_data.get('blocks', []): + block_name = block_data.get('name') + if block_name: + prototype = BlockPrototype.from_dict(block_data) + self._block_prototypes[block_name] = prototype + + logging.info(f"已加载组件 {component_name} 的块定义") + except Exception as e: + logging.error(f"加载块配置文件失败 {config_file}: {e}") + logging.exception(e) + + logging.info(f"总共加载了 {len(self._component_configs)} 个组件的块定义") + logging.info(f"总共加载了 {len(self._block_prototypes)} 个块原型") + + except Exception as e: + logging.error(f"加载块配置失败: {e}") + logging.exception(e) + + def get_block_prototype(self, block_name: str) -> Optional[BlockPrototype]: + """获取块原型定义 + + Args: + block_name: 块名称 (如 'programing.log') + + Returns: + Optional[BlockPrototype]: 块原型定义,如果不存在则返回None + """ + if block_name is None: + raise ValueError("block_name 不能为空") + + # 首先从缓存中查找 + if block_name in self._block_prototypes: + return self._block_prototypes[block_name] + + # 解析命名空间和块名 + if '.' in block_name: + namespace, block_short_name = block_name.split('.', 1) + else: + # 在转换失败情况下,会添加一个无效的 block,此时不需要警告 + if 'EnumWidget_' in block_name: + return None + print(f"不规范的块名称格式: {block_name},应为'namespace.name'格式.....") + return None + + # 查找对应的组件配置 + component_config = self._component_configs.get(namespace) + if not component_config: + # if 'xbot_extensions' in namespace: + # return None + print(f"找不到组件配置: {namespace}") + return None + + # 在该组件的块列表中查找指定名称的块 + blocks = component_config.get('blocks', []) + for block_data in blocks: + if block_data.get('name') == block_name: + # 创建并缓存块原型 + prototype = BlockPrototype.from_dict(block_data) + self._block_prototypes[block_name] = prototype + return prototype + + print(f"在组件 {namespace} 中找不到块定义: {block_short_name}") + return None + + def get_input_definitions(self, block_name: str) -> Dict[str, FieldPrototype]: + """获取块的输入字段定义 + + Args: + block_name: 块名称 + + Returns: + Dict[str, FieldPrototype]: 字段名到定义的映射 + """ + prototype = self.get_block_prototype(block_name) + if not prototype: + return {} + + # 将输入字段定义转换为字段名到定义的映射 + return {input_def.name: input_def for input_def in prototype.inputs} + + def get_output_definitions(self, block_name: str) -> Dict[str, VariablePrototype]: + """获取块的输出变量定义 + + Args: + block_name: 块名称 + + Returns: + Dict[str, VariablePrototype]: 变量名到定义的映射 + """ + prototype = self.get_block_prototype(block_name) + if not prototype: + return {} + + # 将输出变量定义转换为变量名到定义的映射 + return {output_def.name: output_def for output_def in prototype.outputs} + + def get_required_inputs(self, block_name: str) -> List[str]: + """获取块的必填输入字段名称 + + Args: + block_name: 块名称 + + Returns: + List[str]: 必填字段名列表 + """ + prototype = self.get_block_prototype(block_name) + if not prototype: + return [] + + return prototype.get_required_inputs() diff --git a/src/Xbot/Blockly/BlockPrototype.py b/src/Xbot/Blockly/BlockPrototype.py new file mode 100644 index 0000000..bb14d06 --- /dev/null +++ b/src/Xbot/Blockly/BlockPrototype.py @@ -0,0 +1,196 @@ +from dataclasses import dataclass, field +from typing import List, Dict, Any, Optional +from .Variable import VariablePrototype # 导入自 Variable 模块 + +@dataclass +class FieldPrototype: + name: str + label: str + type: str = "str" + required: bool = False + tips: str = "" + default: Optional[Any] = None + defaultDisplay: Optional[str] = None + editor: Dict[str, Any] = field(default_factory=dict) + category: str = "normal" + + def to_dict(self) -> Dict[str, Any]: + """转换为字典表示""" + result = { + "name": self.name, + "label": self.label, + "type": self.type, + "required": self.required, + "tips": self.tips, + "category": self.category + } + + # 添加可选字段 + if self.default is not None: + result["default"] = self.default + if self.defaultDisplay: + result["defaultDisplay"] = self.defaultDisplay + if self.editor: + result["editor"] = self.editor + + return result + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> 'FieldPrototype': + """从字典创建字段原型""" + return cls( + name=data.get("name"), + label=data.get("label", ""), + type=data.get("type"), + required=data.get("required", False), + tips=data.get("tips", ""), + default=data.get("default", None), + defaultDisplay=data.get("defaultDisplay"), + editor=data.get("editor", {}), + category=data.get("category", "normal") + ) + +@dataclass +class VariablePrototype: + name: str + id: str + type: str + label: str = "" + variableLabel: Optional[str] = None + tips: str = "" + + def to_dict(self) -> Dict[str, Any]: + """转换为字典表示""" + result = { + "name": self.name, + "type": self.type, + } + + if self.label: + result["label"] = self.label + if self.variableLabel: + result["variableLabel"] = self.variableLabel + if self.tips: + result["tips"] = self.tips + + + return result + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> 'VariablePrototype': + """从字典创建变量原型""" + return cls( + name=data.get("name"), + type=data.get("type"), + id=data.get("id"), + label=data.get("label", ""), + variableLabel=data.get("variableLabel", ""), + tips=data.get("tips", "") + ) + +@dataclass +class BlockPrototype: + """块原型定义""" + name: str + title: str + description: str = "" + comment: str = "" + icon: str = "" + function: str = "" + helpUrl: str = "" + extension: str = "" + hidden: bool = False + canDebug: bool = True + isCondition: bool = False + isLoop: bool = False + isPseudo: bool = False + statement: bool = False + keywords: List[str] = field(default_factory=list) + inputs: List[FieldPrototype] = field(default_factory=list) + outputs: List[VariablePrototype] = field(default_factory=list) # 更新为 VariablePrototype + exceptionHandling: Optional[str] = None + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> 'BlockPrototype': + """从字典创建块原型""" + # 处理输入字段 + inputs = [] + for input_data in data.get("inputs", []): + inputs.append(FieldPrototype.from_dict(input_data)) + + # 处理输出变量 + outputs = [] + for output_data in data.get("outputs", []): + outputs.append(VariablePrototype.from_dict(output_data)) # 使用 VariablePrototype + + # 处理关键词 + keywords = [] + keywords_str = data.get("keywords", "") + if keywords_str: + keywords = keywords_str.split(";") + + return cls( + name=data.get("name", ""), + title=data.get("title", ""), + description=data.get("description", ""), + comment=data.get("comment", ""), + icon=data.get("icon", ""), + function=data.get("function", ""), + helpUrl=data.get("helpUrl", ""), + extension=data.get("extension", ""), + hidden=data.get("hidden", False), + canDebug=data.get("canDebug", True), + isCondition=data.get("isCondition", False), + isLoop=data.get("isLoop", False), + isPseudo=data.get("isPseudo", False), + statement=data.get("statement", False), + keywords=keywords, + inputs=inputs, + outputs=outputs, + exceptionHandling=data.get("exception_handling") + ) + + def to_dict(self) -> Dict[str, Any]: + """转换为字典表示""" + result = { + "name": self.name, + "statement": self.statement, + "title": self.title, + "keywords": ";".join(self.keywords) if self.keywords else None, + "description": self.description, + "comment": self.comment, + "icon": self.icon, + "function": self.function, + "helpUrl": self.helpUrl, + "extension": self.extension, + "hidden": self.hidden, + "canDebug": self.canDebug, + "isCondition": self.isCondition, + "isLoop": self.isLoop, + "isPseudo": self.isPseudo, + "inputs": [input.to_dict() for input in self.inputs], + "outputs": [output.to_dict() for output in self.outputs] + } + + if self.exceptionHandling: + result["exception_handling"] = self.exceptionHandling + + return result + + def get_input_by_name(self, name: str) -> Optional[FieldPrototype]: + """通过名称获取输入字段定义""" + for input_def in self.inputs: + if input_def.name == name: + return input_def + return None + + def get_output_by_name(self, name: str) -> Optional[VariablePrototype]: + """通过名称获取输出变量定义""" + for output_def in self.outputs: + if output_def.name == name: + return output_def + return None + + def get_required_inputs(self) -> List[str]: + """获取所有必填输入字段名称""" + return [input_def.name for input_def in self.inputs if input_def.required] diff --git a/src/Xbot/Blockly/Field.py b/src/Xbot/Blockly/Field.py new file mode 100644 index 0000000..129a085 --- /dev/null +++ b/src/Xbot/Blockly/Field.py @@ -0,0 +1,111 @@ +from dataclasses import dataclass +from typing import Dict, Any, Optional, Union, List +from enum import Enum + +from .BlockPrototype import FieldPrototype +from .FieldValue import FieldValue, FieldValueKind, FieldValueFactory + + +@dataclass +class Field: + """块的输入字段定义""" + + label: str + displayValue: str + prototype: FieldPrototype = None + value: Optional["FieldValue"] = None # 引用 FieldValue 类型 + + def __post_init__(self): + """初始化后处理""" + # 如果没有设置值,但有原型,则从原型创建默认值 + if self.value is None and self.prototype is not None: + if self.prototype.default: + self.value = FieldValueFactory.create(self.prototype.default) + + def reset_value(self): + self.value = None + if self.prototype.default: + self.value = FieldValueFactory.create(self.prototype.default) + + def set_text_value(self, content): + self.value = FieldValue(FieldValueKind.TEXT, content) + + def set_image_value(self, content): + self.value = FieldValue(FieldValueKind.IMAGE, content) + + def no_inputbox_text_value(self, content): + self.value = FieldValue(FieldValueKind.TEXT, content) + for item in self.prototype.editor["options"]: + if item["value"].lower() == content.lower(): + self.displayValue = item["display"] + return + + + def set_display_value(self, display_value): + self.displayValue = display_value + + def set_group_array_value(self, value): + self.value = FieldValue(FieldValueKind.GROUPARRAY, value) + + def set_expression_value(self, content): + from Converter.utils import convert_self_to_glv + + if content is not None and "self" in content: + content = convert_self_to_glv(content) + self.value = FieldValue(FieldValueKind.EXPRESSION, content) + + def set_global_var(self, global_var_name): + self.value = FieldValue(FieldValueKind.VARIABLE, f"glv['{global_var_name}']") + + def set_flow_arg(self, flow_var_name): + self.value = FieldValue(FieldValueKind.VARIABLE, flow_var_name) + + def set_flow_var(self, local_var_name): + self.value = FieldValue(FieldValueKind.VARIABLE, local_var_name) + + def to_dict(self) -> Dict[str, Any]: + """转换为字典表示""" + result = {} + + if self.value: + result["value"] = str(self.value) + else: + result["value"] = None + + if self.displayValue: + result["display"] = self.displayValue + + # if self.label: + # result["label"] = self.label + + # 如果 result 是一个空字典,则返回 None + if not result: + return None + + return result + + def not_inputbox_filed(self): + return ( + self.prototype.editor["kind"] != "textbox" + and self.prototype.editor["kind"].lower() != "memoedit" + and self.prototype.editor["kind"] != "select" + ) + + @classmethod + def from_prototype(cls, prototype: FieldPrototype) -> "Field": + """从字段原型创建Field实例""" + field = cls( + label=prototype.label, + displayValue=prototype.defaultDisplay or "", + prototype=prototype, + ) + + return field + + @classmethod + def from_value_string(cls, label: str, value_string: str) -> "Field": + """从值字符串创建Field实例""" + + field = cls(label=label, displayValue="") + + return field diff --git a/src/Xbot/Blockly/FieldValue.py b/src/Xbot/Blockly/FieldValue.py new file mode 100644 index 0000000..81b1871 --- /dev/null +++ b/src/Xbot/Blockly/FieldValue.py @@ -0,0 +1,191 @@ +from typing import List, Dict, Any, Optional, Union +import json +from enum import Enum + +class FieldValueKind(str, Enum): + """字段值类型枚举""" + TEXT = "10" # Text = 10 + VARIABLE = "11" # Variable = 11 + SELECTOR = "12" # Selector = 12 + EXPRESSION = "13" # Expression = 13 + IMAGE = "14" # Image = 14 + ARRAY = "15" # Array = 15 + GROUPARRAY = "16" # GroupArray = 16 + OPERATOR = "17" # Operator = 17 + APEXPR = "18" # APExpr = 18 + + +class FieldValue: + """字段值基类""" + def __init__(self, kind: FieldValueKind, content: str): + """初始化字段值 + + Args: + kind: 字段值类型 + content: 字段内容 + """ + self.kind = kind + self._content = content or "" + + @property + def content(self) -> str: + """获取字段内容""" + return self._content + + @content.setter + def content(self, value: str): + """设置字段内容""" + self._content = value or "" + + def __str__(self) -> str: + """转换为字符串表示""" + if self._content: + return f"{self.kind.value}:{self._content}" + else: + return f"{self.kind.value}:" + + +class FieldValueArray(FieldValue): + """数组类型字段值""" + def __init__(self, content: str = ""): + """初始化数组字段值""" + super().__init__(FieldValueKind.ARRAY, content) + self._items: List[str] = [] + # 解析初始内容 + self._parse_content() + + def _parse_content(self): + """解析内容字符串为数组项""" + if not self._content: + self._items = [] + return + + try: + self._items = json.loads(self._content) + if not isinstance(self._items, list): + self._items = [] + except json.JSONDecodeError: + self._items = [] + + @property + def items(self) -> List[str]: + """获取数组项列表""" + return self._items + + @items.setter + def items(self, values: List[str]): + """设置数组项列表""" + self._items = values or [] + self._content = json.dumps(self._items) + + @property + def content(self) -> str: + """获取字段内容,确保是JSON格式""" + return self._content + + @content.setter + def content(self, value: str): + """设置字段内容并解析""" + self._content = value or "" + self._parse_content() + + +class FieldValueGroupArray(FieldValue): + """分组数组类型字段值""" + def __init__(self, content: str = ""): + """初始化分组数组字段值""" + super().__init__(FieldValueKind.GROUPARRAY, content) + self._groups: List[Dict[str, Any]] = [] + # 解析初始内容 + self._parse_content() + + def _parse_content(self): + """解析内容字符串为分组项""" + if not self._content: + self._groups = [] + return + + try: + self._groups = json.loads(self._content) + if not isinstance(self._groups, list): + self._groups = [] + except json.JSONDecodeError: + self._groups = [] + + @property + def groups(self) -> List[Dict[str, Any]]: + """获取分组列表""" + return self._groups + + @groups.setter + def groups(self, values: List[Dict[str, Any]]): + """设置分组列表""" + self._groups = values or [] + self._content = json.dumps(self._groups) + + @property + def content(self) -> str: + """获取字段内容,确保是JSON格式""" + return self._content + + @content.setter + def content(self, value: str): + """设置字段内容并解析""" + self._content = value or "" + self._parse_content() + + def __str__(self) -> str: + """转换为字符串表示""" + def __str__(self) -> str: + """转换为字符串表示""" + result = {} + for name, value in self._groups.items(): + result[name] = [str(item) for item in value] + return f"{self.kind.value}:{json.dumps(result)}" + +class FieldValueFactory: + """字段值工厂类,用于创建和解析字段值""" + + @staticmethod + def create(value_string: str) -> FieldValue: + """从值字符串创建字段值实例 + + Args: + value_string: 格式为 "kind:content" 的字符串 + + Returns: + FieldValue: 字段值实例 + """ + # 解析值字符串 + parts = value_string.split(':', 1) + if len(parts) != 2: + # 格式不正确,默认为文本类型 + return FieldValue(FieldValueKind.TEXT, value_string) + + kind_str, content = parts + + try: + kind = FieldValueKind(kind_str) + except ValueError: + # 无效的类型,默认为文本 + return FieldValue(FieldValueKind.TEXT, value_string) + + return FieldValueFactory.create_by_kind(kind, content) + + @staticmethod + def create_by_kind(kind: FieldValueKind, content: str = "") -> FieldValue: + """根据类型和内容创建字段值实例 + + Args: + kind: 字段值类型 + content: 字段内容 + + Returns: + FieldValue: 字段值实例 + """ + if kind == FieldValueKind.ARRAY: + return FieldValueArray(content) + elif kind == FieldValueKind.GROUPARRAY: + return FieldValueGroupArray(content) + else: + return FieldValue(kind, content) \ No newline at end of file diff --git a/src/Xbot/Blockly/Variable.py b/src/Xbot/Blockly/Variable.py new file mode 100644 index 0000000..4a217a5 --- /dev/null +++ b/src/Xbot/Blockly/Variable.py @@ -0,0 +1,93 @@ +from dataclasses import dataclass +from typing import Dict, Any, Optional + +from Xbot.Blockly.FieldValue import FieldValueKind + +@dataclass +class VariablePrototype: + """变量原型定义""" + name: str + type: str = "any" + id: Optional[str] = None + label: Optional[str] = None + variableLabel: Optional[str] = None + tips: Optional[str] = None + + def to_dict(self) -> Dict[str, Any]: + """转换为字典表示""" + result = { + "name": self.name, + "type": self.type, + } + + # 添加可选字段 + if self.id: + result["id"] = self.id + if self.label: + result["label"] = self.label + if self.variableLabel: + result["variableLabel"] = self.variableLabel + if self.tips: + result["tips"] = self.tips + + return result + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> 'VariablePrototype': + """从字典创建变量原型""" + return cls( + name=data.get("name"), + type=data.get("type"), + id=data.get("id", None), + label=data.get("label", None), + variableLabel=data.get("variableLabel", None), + tips=data.get("tips", None) + ) + +@dataclass +class Variable: + """块的输出变量定义""" + name: str + isEnable: bool = True + variableLabel: Optional[str] = None + type: Optional[str] = None + defaultValue: Optional[Any] = None + prototype: Optional[VariablePrototype] = None + id: Optional[str] = None + + def to_dict(self) -> Dict[str, Any]: + """转换为字典表示""" + result = { + "name": self.name, + "isEnable": self.isEnable + } + + # if self.variableLabel: + # result["variableLabel"] = self.variableLabel + + # if self.type: + # result["type"] = self.type + + # if self.defaultValue: + # result["defaultValue"] = self.defaultValue + + return result + + def set_name(self, name): + self.name = name + + def set_type(self, field_type:FieldValueKind): + self.type = field_type.value.lower() + + @classmethod + def from_prototype(cls, prototype: VariablePrototype) -> 'Variable': + """从变量原型创建Variable实例""" + return cls( + name=prototype.name, + isEnable=True, + variableLabel=prototype.variableLabel, + type=prototype.type, + defaultValue=None, + prototype=prototype, + id=prototype.id + ) diff --git a/src/Xbot/Blockly/XbotBlock.py b/src/Xbot/Blockly/XbotBlock.py new file mode 100644 index 0000000..5b4ec6f --- /dev/null +++ b/src/Xbot/Blockly/XbotBlock.py @@ -0,0 +1,198 @@ +import enum +from dataclasses import dataclass, field +from typing import Optional, Dict, Any, List +import uuid +import logging +from .Field import Field, FieldValueKind +from .Variable import Variable +from .BlockManager import BlockManager +from .BlockPrototype import BlockPrototype, FieldPrototype +from .FieldValue import FieldValueFactory + +# 创建全局单例 +_block_manager = BlockManager() + + +class XbotExceptionKind(str, enum.Enum): + Default = "default" + Abort = "exit" + Contine = "continue" + Retry = "retry" + + +@dataclass +class XbotBlock: + """Xbot流程块定义""" + id: str + name: str # 块类型名称 + fields: Dict[str, Field] = field(default_factory=dict) + variables: Dict[str, Variable] = field(default_factory=dict) + isEnabled: bool = True + block_title: Optional[str] = None + comment: Optional[str] = None + fold_state: Optional[str] = None + block_prototype: BlockPrototype = None + _exception_mode: Optional[XbotExceptionKind] = XbotExceptionKind.Default + + def __post_init__(self): + """初始化后处理""" + if not self.fields: + self.fields = {} + + # 如果没有提供ID则自动生成 + if not self.id: + self.id = str(uuid.uuid4()) + + if not self.fields: + self.fields = {} + + if not self.variables: + self.variables = {} + + self.prepareDefaultInputOutput() + if not self.block_prototype: + # if 'xbot_extensions' in self.name: + # return + print(f"未找到块定义: {self.name}") + return + + if not self.comment: + self.comment = self.block_prototype.comment + + def set_exception_mode_continue(self): + self._exception_mode = XbotExceptionKind.Contine + + def prepareDefaultInputOutput(self): + """加载块定义并创建默认输入输出""" + self.block_prototype = _block_manager.get_block_prototype(self.name) + if not self.block_prototype: + return + + # 为每个输入字段创建对应的 Field 实例 + for field_prototype in self.block_prototype.inputs: + # 如果该字段已经存在,则跳过 + print(f"输入字段: {field_prototype.name}") + print(self.fields) + if field_prototype.name in self.fields: + continue + + field = Field.from_prototype(field_prototype) + + self.fields[field_prototype.name] = field + + for var_prototype in self.block_prototype.outputs: + if var_prototype.name in self.variables: + continue + + variable = Variable.from_prototype(var_prototype) + + self.variables[var_prototype.id] = variable + + @property + def local_variables(self) -> List[str]: + """获取块定义的局部变量列表""" + return [name for name, var in self.variables.items() if var.isEnable] + + @property + def component_namespace(self) -> str: + """获取组件命名空间""" + return self.name.split('.')[0] if '.' in self.name else '' + + @property + def component_name(self) -> str: + """获取组件基础名称""" + return self.name.split('.')[-1] if '.' in self.name else self.name + + def validate(self) -> List[str]: + """验证块配置 + + Returns: + List[str]: 错误信息列表,如果没有错误则为空列表 + """ + errors = [] + + # 验证必填字段 + required_fields = _block_manager.get_required_fields(self.name) + for field_name in required_fields: + if field_name not in self.fields: + errors.append(f"缺少必填字段: {field_name}") + elif not self.fields[field_name].value: + errors.append(f"必填字段值为空: {field_name}") + + return errors + + def to_dict(self) -> Dict[str, Any]: + """转换为字典格式""" + result = { + "id": self.id, + "name": self.name, + "isEnabled": self.isEnabled, + "inputs": {}, + "outputs": {} + } + + # 添加可选字段 + if self.comment: + result["comment"] = self.comment + + if self.fold_state: + result["foldState"] = self.fold_state + + if self.block_title: + result["block_title"] = self.block_title + + # 处理输入字段 + print(f"输入字段: {self.fields}") + for name, field in self.fields.items(): + result["inputs"][name] = field.to_dict() + + # 处理输出变量 + for name, variable in self.variables.items(): + result["outputs"][name] = variable.to_dict() + + # 错误处理 - 部分模式没有支持, 需要的时候再支持 + if self._exception_mode == XbotExceptionKind.Contine: + result["exception_handling"] = { + "logging": True, + "mode": "continue", + "retryTime": 1, + "retryInterval": 1 + } + return result + + @classmethod + def from_dict(cls, data: Dict[str, Any]) -> 'XbotBlock': + """从字典创建Block实例""" + block = cls( + id=data.get('id', str(uuid.uuid4())), + name=data.get('name', ''), + isEnabled=data.get('isEnabled', True), + comment=data.get('comment'), + fold_state=data.get('foldState') + ) + + if 'block_title' in data: + block.block_title = data['block_title'] + + # 处理输入字段 + for name, input_data in data.get('inputs', {}).items(): + if "value" in input_data: + # 使用 Field.from_value_string 方法创建字段 + field = Field.from_value_string( + label=input_data.get("label", name), + value_string=input_data["value"] + ) + field.displayValue = input_data.get("display", "") + block.fields[name] = field + + # 处理输出变量 + for name, output_data in data.get('outputs', {}).items(): + variable = Variable( + name=name, + isEnable=output_data.get("isEnable", True), + variableLabel=output_data.get("variableLabel"), + type=output_data.get("type", "any") + ) + block.variables[name] = variable + + return block diff --git a/src/Xbot/Blockly/__init__.py b/src/Xbot/Blockly/__init__.py new file mode 100644 index 0000000..fbce87c --- /dev/null +++ b/src/Xbot/Blockly/__init__.py @@ -0,0 +1,4 @@ +from .BlockManager import BlockManager +from .XbotBlock import XbotBlock +from .Field import Field, FieldValueKind +from .Variable import Variable \ No newline at end of file diff --git a/src/Xbot/Blockly/__pycache__/BlockManager.cpython-310.pyc b/src/Xbot/Blockly/__pycache__/BlockManager.cpython-310.pyc new file mode 100644 index 0000000..2ccfa26 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/BlockManager.cpython-310.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/BlockManager.cpython-312.pyc b/src/Xbot/Blockly/__pycache__/BlockManager.cpython-312.pyc new file mode 100644 index 0000000..f43c313 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/BlockManager.cpython-312.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/BlockManager.cpython-313.pyc b/src/Xbot/Blockly/__pycache__/BlockManager.cpython-313.pyc new file mode 100644 index 0000000..5addfeb Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/BlockManager.cpython-313.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/BlockPrototype.cpython-310.pyc b/src/Xbot/Blockly/__pycache__/BlockPrototype.cpython-310.pyc new file mode 100644 index 0000000..d595c6c Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/BlockPrototype.cpython-310.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/BlockPrototype.cpython-312.pyc b/src/Xbot/Blockly/__pycache__/BlockPrototype.cpython-312.pyc new file mode 100644 index 0000000..be00659 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/BlockPrototype.cpython-312.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/BlockPrototype.cpython-313.pyc b/src/Xbot/Blockly/__pycache__/BlockPrototype.cpython-313.pyc new file mode 100644 index 0000000..2c7cba1 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/BlockPrototype.cpython-313.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/Field.cpython-310.pyc b/src/Xbot/Blockly/__pycache__/Field.cpython-310.pyc new file mode 100644 index 0000000..80d4b01 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/Field.cpython-310.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/Field.cpython-312.pyc b/src/Xbot/Blockly/__pycache__/Field.cpython-312.pyc new file mode 100644 index 0000000..dfc5bd4 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/Field.cpython-312.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/Field.cpython-313.pyc b/src/Xbot/Blockly/__pycache__/Field.cpython-313.pyc new file mode 100644 index 0000000..73ad6a3 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/Field.cpython-313.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/FieldValue.cpython-310.pyc b/src/Xbot/Blockly/__pycache__/FieldValue.cpython-310.pyc new file mode 100644 index 0000000..ea1a2d1 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/FieldValue.cpython-310.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/FieldValue.cpython-312.pyc b/src/Xbot/Blockly/__pycache__/FieldValue.cpython-312.pyc new file mode 100644 index 0000000..040fc9f Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/FieldValue.cpython-312.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/FieldValue.cpython-313.pyc b/src/Xbot/Blockly/__pycache__/FieldValue.cpython-313.pyc new file mode 100644 index 0000000..0ad009f Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/FieldValue.cpython-313.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/Variable.cpython-310.pyc b/src/Xbot/Blockly/__pycache__/Variable.cpython-310.pyc new file mode 100644 index 0000000..6afcc51 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/Variable.cpython-310.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/Variable.cpython-312.pyc b/src/Xbot/Blockly/__pycache__/Variable.cpython-312.pyc new file mode 100644 index 0000000..09a4829 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/Variable.cpython-312.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/Variable.cpython-313.pyc b/src/Xbot/Blockly/__pycache__/Variable.cpython-313.pyc new file mode 100644 index 0000000..5a00305 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/Variable.cpython-313.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/XbotBlock.cpython-310.pyc b/src/Xbot/Blockly/__pycache__/XbotBlock.cpython-310.pyc new file mode 100644 index 0000000..9927f50 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/XbotBlock.cpython-310.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/XbotBlock.cpython-312.pyc b/src/Xbot/Blockly/__pycache__/XbotBlock.cpython-312.pyc new file mode 100644 index 0000000..f519f4b Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/XbotBlock.cpython-312.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/XbotBlock.cpython-313.pyc b/src/Xbot/Blockly/__pycache__/XbotBlock.cpython-313.pyc new file mode 100644 index 0000000..22ba6f7 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/XbotBlock.cpython-313.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/__init__.cpython-310.pyc b/src/Xbot/Blockly/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..bf9c476 Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/__init__.cpython-312.pyc b/src/Xbot/Blockly/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..a09b79c Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/__init__.cpython-312.pyc differ diff --git a/src/Xbot/Blockly/__pycache__/__init__.cpython-313.pyc b/src/Xbot/Blockly/__pycache__/__init__.cpython-313.pyc new file mode 100644 index 0000000..f3589bc Binary files /dev/null and b/src/Xbot/Blockly/__pycache__/__init__.cpython-313.pyc differ diff --git a/src/Xbot/CodeFlow.py b/src/Xbot/CodeFlow.py new file mode 100644 index 0000000..1070f7b --- /dev/null +++ b/src/Xbot/CodeFlow.py @@ -0,0 +1,93 @@ +from dataclasses import dataclass +from typing import Dict, Any, Optional +import json +import os.path +from .XbotFlow import XbotFlow, FlowKind +from .FlowParameter import FlowParameter, FieldValueKind + + + +DEFAULT_CODE_TEMPLATE = '''# 使用提醒: +# 1. xbot包提供软件自动化、数据表格、Excel、日志、AI等功能 +# 2. package包提供访问当前应用数据的功能,如获取元素、访问全局变量、获取资源文件等功能 +# 3. 当此模块作为流程独立运行时执行main函数 +# 4. 可视化流程中可以通过"调用模块"的指令使用此模块 + +import xbot +from xbot import print, sleep +from .import package +from .package import variables as glv + +def main(args): + pass +''' + +@dataclass +class CodeFlow(XbotFlow): + """代码类型流程""" + code: str = "" + + def load_flow_json(self, project_dir: str) -> None: + """从flow.json文件加载流程定义""" + dev_dir = os.path.join(project_dir, ".dev") + flow_path = os.path.join(dev_dir, f"{self.filename}.flow.json") + + if not os.path.exists(flow_path): + print(f"警告: 流程文件不存在: {flow_path}") + return + + with open(flow_path, 'r', encoding='utf-8') as f: + data = json.load(f) + + # 加载parameters + self.parameters = [] + for param_data in data.get('parameters', []): + param = FlowParameter( + name=param_data.get('name', ''), + direction=param_data.get('direction', 'In'), + type=param_data.get('type', 'any'), + value=param_data.get('value', ''), + description=param_data.get('description', ''), + kind=FieldValueKind(param_data.get('kind', 'Expression')) + ) + self.parameters.append(param) + + # 从Python文件加载代码内容 + code_path = os.path.join(project_dir, f"{self.filename}.py") + if os.path.exists(code_path): + with open(code_path, 'r', encoding='utf-8') as code_file: + self.code = code_file.read() + else: + print(f"警告: 代码文件不存在: {code_path}, 使用默认模板") + self.code = DEFAULT_CODE_TEMPLATE + + def to_disk(self) -> Dict[str, Any]: + """将流程转换为字典格式 (flow.json内容)""" + return { + 'name': self.name, + 'kind': self.kind.lower(), + 'parameters': [param.to_dict() for param in self.parameters] + } + + def save_flow_json(self, project_dir: str) -> None: + """保存流程定义到flow.json和Python文件 + + Args: + project_dir: 项目根目录 + """ + # 先调用父类方法保存flow.json + super().save_flow_json(project_dir) + + # 然后保存Python代码文件 + code_path = os.path.join(project_dir, f"{self.filename}.py") + print(f"保存代码文件: {code_path}") + with open(code_path, 'w', encoding='utf-8') as f: + f.write(self.code or DEFAULT_CODE_TEMPLATE) + + def set_code(self, code: str): + """设置代码内容""" + self.code = code + + def get_code(self) -> str: + """获取代码内容""" + return self.code diff --git a/src/Xbot/FlowParameter.py b/src/Xbot/FlowParameter.py new file mode 100644 index 0000000..604d3b9 --- /dev/null +++ b/src/Xbot/FlowParameter.py @@ -0,0 +1,89 @@ +from dataclasses import dataclass +import enum +from typing import Dict, Any + +class DirectionKind(str, enum.Enum): + IN = "In" + OUT = "Out" + +class FieldValueKind(str, enum.Enum): + """字段值类型枚举 + + 对应关系: + 10: 文本值 (TEXT) + 11: 变量引用 (VARIABLE) + 12: 选择器 (SELECTOR) + 13: 表达式 (EXPRESSION) + 14: 图片 (IMAGE) + 15: 数组 (ARRAY) + 16: 分组数组 (GROUPARRAY) + 17: 运算符 (OPERATOR) + 18: AI表达式 (APEXPR) + """ + TEXT = "10" # Text = 10 + VARIABLE = "11" # Variable = 11 + SELECTOR = "12" # Selector = 12 + EXPRESSION = "13" # Expression = 13 + IMAGE = "14" # Image = 14 + ARRAY = "15" # Array = 15 + GROUPARRAY = "16" # GroupArray = 16 + OPERATOR = "17" # Operator = 17 + APEXPR = "18" # APExpr = 18 + + @classmethod + def from_string(cls, value: str) -> 'FieldValueKind': + """从字符串创建枚举值 + + 支持字符串名称 (如 "TEXT") 和实际值 (如 "10") + """ + # 尝试将输入当作枚举成员名称处理 + name_map = { + "TEXT": cls.TEXT, + "VARIABLE": cls.VARIABLE, + "SELECTOR": cls.SELECTOR, + "EXPRESSION": cls.EXPRESSION, + "IMAGE": cls.IMAGE, + "ARRAY": cls.ARRAY, + "GROUPARRAY": cls.GROUPARRAY, + "OPERATOR": cls.OPERATOR, + "APEXPR": cls.APEXPR, + } + + # 处理忽略大小写的情况 + if value.upper() in name_map: + return name_map[value.upper()] + + # 尝试直接用值创建 + try: + return cls(value) + except ValueError: + # 如果都失败,返回默认值 + return cls.TEXT + +@dataclass +class FlowParameter: + """流程参数定义""" + name: str = "" + direction: DirectionKind = DirectionKind.IN + value: str = "" + type: str = "" + description: str = "" + kind: FieldValueKind = FieldValueKind.TEXT + + def __post_init__(self): + self._name = self.name + self._direction = self.direction + self._value = self.value + self._description = self.description + self._kind = self.kind + + def to_dict(self) -> Dict[str, Any]: + """转换为字典表示""" + return { + "name": self.name, + "direction": self.direction.value, + "value": self.value, + "type": self.type, + "description": self.description, + "kind": self.kind.value + } diff --git a/src/Xbot/ShadowBotPaths.py b/src/Xbot/ShadowBotPaths.py new file mode 100644 index 0000000..cf5418f --- /dev/null +++ b/src/Xbot/ShadowBotPaths.py @@ -0,0 +1,32 @@ +import os +import glob + + +class ShadowBotPaths: + @staticmethod + def get_shadowbot_root(): + """获取ShadowBot安装根目录""" + return os.path.join(os.environ["LOCALAPPDATA"], "ShadowBot") + + @staticmethod + def get_first_user_dir(): + """获取第一个用户目录""" + users_dir = os.path.join(ShadowBotPaths.get_shadowbot_root(), "users") + user_dirs = glob.glob(os.path.join(users_dir, "*")) + if not user_dirs: + raise FileNotFoundError("未找到ShadowBot用户目录") + + # NOTE(huifu.zc) 为多账户的用户方便指定账号 + env_defined_id = os.environ.get("__XBOT_YSQ_CONV_USR_ID__", "") + if env_defined_id is not None and len(env_defined_id) > 0: + for user_dir in user_dirs: + user_id = os.path.basename(user_dir) + if user_id == env_defined_id: + return user_dir + + return user_dirs[0] + + @staticmethod + def get_apps_dir(): + """获取应用目录""" + return os.path.join(ShadowBotPaths.get_first_user_dir(), "apps") diff --git a/src/Xbot/VisualFlow.py b/src/Xbot/VisualFlow.py new file mode 100644 index 0000000..574677d --- /dev/null +++ b/src/Xbot/VisualFlow.py @@ -0,0 +1,75 @@ +from dataclasses import dataclass, field +from typing import Optional, List, Dict, Any +import json +import os.path +from .XbotFlow import XbotFlow, FlowKind +from .Blockly import XbotBlock +from .FlowParameter import FlowParameter, DirectionKind, FieldValueKind + +@dataclass +class VisualFlow(XbotFlow): + """可视化流程""" + blocks: List[XbotBlock] = field(default_factory=list) + connections: List[Dict[str, str]] = field(default_factory=list) + + def load_flow_json(self, project_dir: str) -> None: + """从flow.json文件加载流程定义""" + dev_dir = os.path.join(project_dir, ".dev") + flow_path = os.path.join(dev_dir, f"{self.filename}.flow.json") + + if not os.path.exists(flow_path): + print(f"警告: 流程文件不存在: {flow_path}") + return + + with open(flow_path, 'r', encoding='utf-8') as f: + data = json.load(f) + self.memo = data.get('memo', '') + + # 加载blocks + self.blocks = [] + for block_data in data.get('blocks', []): + block = XbotBlock.from_dict(block_data) + self.blocks.append(block) + + # 加载parameters + self.parameters = [] + for param_data in data.get('parameters', []): + param = FlowParameter( + name=param_data.get('name', ''), + direction=param_data.get('direction', 'In'), + type=param_data.get('type', 'any'), + value=param_data.get('value', ''), + description=param_data.get('description', ''), + kind=FieldValueKind(param_data.get('kind', 'Expression')) + ) + self.parameters.append(param) + + # 加载connections (如果有) + self.connections = data.get('connections', []) + + def to_disk(self) -> Dict[str, Any]: + """将流程转换为字典格式""" + return { + 'name': self.name, + 'memo': self.memo, + 'kind': self.kind.lower(), + 'blocks': [block.to_dict() for block in self.blocks], + 'parameters': [param.to_dict() for param in self.parameters], + } + + def create_new_block(self, block_id: str, block_name: str, + inputs: Dict[str, Dict[str, Any]] = None, + outputs: Dict[str, Any] = None, + is_enabled: bool = True, + block_title: Optional[str] = None) -> XbotBlock: + """添加新的代码块""" + block = XbotBlock( + id=block_id, + name=block_name, + inputs=inputs or {}, + outputs=outputs or {}, + isEnabled=is_enabled, + block_title=block_title + ) + self.blocks.append(block) + return block diff --git a/src/Xbot/XBotHelper.py b/src/Xbot/XBotHelper.py new file mode 100644 index 0000000..428fb7f --- /dev/null +++ b/src/Xbot/XBotHelper.py @@ -0,0 +1,47 @@ +from Xbot import XbotProject, XbotBlock + + +class XBotGlobalVariable(object): + @classmethod + def build_glv_var(cls, var_name: str): + assert isinstance(var_name, str) + return f"glv['{var_name}']" + + +class XBotVariableUtil(object): + self_prefix_string = "self." + + @classmethod + def is_self_var(cls, var_name: str): + return var_name.startswith(cls.self_prefix_string) + + @classmethod + def trim_self(cls, var_name): + return var_name[len(cls.self_prefix_string):] + + @classmethod + def create_comment_block(cls, comment): + comment_block = XbotBlock(id="", name="programing.comment") + comment_block.fields["content"].set_text_value(comment) + return comment_block + + @classmethod + def create_var_block(cls, project: XbotProject, var_name: str, var_value: str): + set_var_block = XbotBlock(id="", name="programing.variable") + # 绑定的变量 = ret_name (any) + set_var_block.fields["value_type"].set_text_value("any") + + if cls.is_self_var(var_name): + var_value_without_self = cls.trim_self(var_name) + cls.add_global_if_not_existed(project, var_value_without_self) + set_var_block.variables["variable"].set_name(var_value_without_self) + else: + set_var_block.variables["variable"].set_name(var_name) + + set_var_block.fields["value"].set_expression_value(var_value) + return set_var_block + + @classmethod + def add_global_if_not_existed(cls, project: XbotProject, var_name: str) -> None: + if not project.global_variable_exist(var_name): + project.add_global_variable(var_name, value=None) \ No newline at end of file diff --git a/src/Xbot/XbotApp.py b/src/Xbot/XbotApp.py new file mode 100644 index 0000000..e6b8481 --- /dev/null +++ b/src/Xbot/XbotApp.py @@ -0,0 +1,46 @@ +import json +import os +import shutil +import uuid +from Xbot.XbotProject import XbotProject +from Xbot.XbotFlow import XbotFlow + + + +class XbotApp: + def __init__(self, app_root: str, app_id: str, app_name: str): + self.project = XbotProject(app_root, app_id, app_name) + self.main_flow = XbotFlow(self.project.dev_dir) + self.main_flow.project = self.project + + def create(self): + """创建完整的Xbot应用程序结构""" + if not os.path.exists(self.project.template_dir): + raise FileNotFoundError(f"模板目录不存在: {self.project.template_dir}") + + self.project.create_project_structure() + self.main_flow.create_flow() + self._create_python_modules() + self._update_package_json() + + def _create_python_modules(self): + """创建Python模块文件""" + with open(os.path.join(self.project.robot_dir, "main.py"), "w", encoding="utf-8") as f: + f.write("# main.py implementation\n") + + def _update_package_json(self): + """更新package.json文件""" + package_file = os.path.join(self.project.robot_dir, "package.json") + with open(package_file, 'r', encoding="utf-8") as f: + package_data = json.load(f) + + package_data.update({ + "uuid": self.project.app_id, + "name": self.project.app_name, + "flows": [XbotFlow.get_flow_config("main")] + }) + + with open(package_file, 'w', encoding="utf-8") as f: + json.dump(package_data, f, indent=2, ensure_ascii=False) + + diff --git a/src/Xbot/XbotAppCreator.py b/src/Xbot/XbotAppCreator.py new file mode 100644 index 0000000..8782792 --- /dev/null +++ b/src/Xbot/XbotAppCreator.py @@ -0,0 +1,317 @@ +import os +import shutil +import sys +import uuid + +from .ShadowBotPaths import ShadowBotPaths +from .XbotProject import XbotProject +from Xbot.Blockly import Variable, Field +import json + +# 添加项目根目录到Python路径 +project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if project_root not in sys.path: + sys.path.append(project_root) + +from .bot_import import insert_new_app + +def _get_template_dir(): + """获取模板目录,适用于普通运行和PyInstaller打包的情况""" + # 检查是否在PyInstaller环境中运行 + if hasattr(sys, '_MEIPASS'): + # PyInstaller创建的临时文件夹 + base_path = sys._MEIPASS + else: + # 普通Python环境 + base_path = os.path.dirname(os.path.abspath(__file__)) + + template_path = os.path.join(base_path, "Xbot", "XbotAppTemplate", "xbot_robot") + + # 如果路径不存在,尝试其他可能的路径 + if not os.path.exists(template_path): + template_path = os.path.join(base_path, "XbotAppTemplate", "xbot_robot") + + return template_path + +class XbotAppCreator: + def __init__(self, app_root: str, app_id: str, app_name: str): + """初始化应用创建器 + + Args: + app_root: 应用根目录 + app_id: 应用唯一标识 + app_name: 应用名称 + """ + self.app_root = app_root + self.app_id = app_id + self.app_name = app_name + self.app_dir = os.path.join(app_root, app_id) + self.robot_dir = os.path.join(self.app_dir, "xbot_robot") + self.template_dir = _get_template_dir() # 使用辅助函数获取模板目录 + + def create(self) -> XbotProject: + """创建新的Xbot应用 + + Returns: + XbotProject: 创建的项目实例 + """ + # 验证模板目录 + if not os.path.exists(self.template_dir): + # 输出更多诊断信息 + print(f"模板目录不存在: {self.template_dir}") + print(f"当前工作目录: {os.getcwd()}") + print(f"Python路径: {sys.path}") + + if hasattr(sys, '_MEIPASS'): + print(f"PyInstaller临时目录: {sys._MEIPASS}") + print(f"临时目录内容: {os.listdir(sys._MEIPASS)}") + + if os.path.exists(os.path.join(sys._MEIPASS, 'Xbot')): + print(f"Xbot目录内容: {os.listdir(os.path.join(sys._MEIPASS, 'Xbot'))}") + + raise FileNotFoundError(f"模板目录不存在: {self.template_dir}") + + # 创建应用目录 + os.makedirs(self.app_dir, exist_ok=True) + + # 复制机器人模板 + self._copy_robot_template() + + # 加载并更新项目 + return self._init_project() + + def _copy_robot_template(self): + """从模板目录复制xbot_robot内容到目标目录""" + if os.path.exists(self.robot_dir): + shutil.rmtree(self.robot_dir) + + print(f"正在从模板创建机器人: {self.template_dir} -> {self.robot_dir}") + shutil.copytree(self.template_dir, self.robot_dir) + + def _init_project(self) -> XbotProject: + """初始化项目配置""" + # 加载项目 + project = XbotProject.load(self.robot_dir) + + # 更新基本信息 + project.uuid = self.app_id + project.name = self.app_name + + # 保存更新后的配置和流程 + project.save_all(self.robot_dir) + + print(f"已初始化项目:") + print(f"- 名称: {project.name}") + print(f"- UUID: {project.uuid}") + print(f"- 位置: {self.robot_dir}") + + return project + +def create_and_import_app(app_name: str, temp_path: str) -> tuple[str, str]: + """创建并导入新的Xbot应用 + + Returns: + tuple[str, str]: (app_id, app_path) + """ + try: + output_dir = ShadowBotPaths.get_apps_dir() + app_id = str(uuid.uuid4()) + + # 创建应用 + creator = XbotAppCreator(output_dir, app_id, app_name) + project = creator.create() + + # 加载扩展 + project.add_internal_dependency('super_browser==25.9.3') + project.add_internal_dependency('activity_f4d5de04==23.11.1') + # code = project.create_code_flow('module1', '') + code = project.create_new_flow('module1', '') + code.add_input_parameter('参数一', 'str', '参数1的默认值', '参数1的描述', 'TEXT') + code.add_output_parameter('结果', 'str', '结果的默认值', '结果的描述', 'TEXT') + + # project.add_global_variable('全局变量1', 'str', '全局变量1的默认值', '全局变量1的描述', 'TEXT') + # project.add_global_variable('全局变量2', 'any', '0', '全局变量2的描述', 'Expression') + + main = project.main + main.add_input_parameter('参数一', 'str', '参数1的默认值', '参数1的描述', 'TEXT') + main.add_output_parameter('结果', 'str', '结果的默认值', '结果的描述', 'TEXT') + block = main.add_block('dialog.show_custom_dialog') + block.fields['dialog_title'].set_text_value('Hello, World!') + block.variables['dialog_result'].set_name('1111') + # block = main.add_block('programing.log') + + # 创建脚手架 + # # 打开excel + # block = main.add_block('excel.launch') + # file_path = r"D:\env_text\万相台\批量报表下载.xlsx" + # block.fields['open_filename'].set_text_value(file_path) + # block.fields['save_filename'].set_text_value("excel_instance") + # block.fields['driver_way'].set_text_value("office") + # # 关闭excel + # block = main.add_block('excel.close') + # block.fields['operation'].set_text_value("close_specified") + # block.fields['excel_instance'].set_text_value("excel_instance") + # block.fields['close_way'].set_text_value("save") + # 打开紫鸟登录 + block = main.add_block('xbot_extensions.super_browser.A2 打开店铺') + # block.fields['紫鸟版本'].set_text_value("V5") + + + + project.save_all(creator.robot_dir) + + app_path = os.path.join(output_dir, app_id) + + # 导入应用到数据库 + print("\n=== 开始导入数据库 ===") + user_dir = ShadowBotPaths.get_first_user_dir() + user_id = os.path.basename(user_dir) + insert_new_app(app_id, user_id, app_name) + + return app_id, app_path + + except Exception as e: + print(f"\n错误: 创建或导入失败") + print(f"详细信息: {str(e)}") + raise + +def create_and_import_app_test(app_name: str, temp_path: str) -> tuple[str, str]: + """ + 根据json配置文件创建并导入新的Xbot应用脚手架 + """ + try: + output_dir = ShadowBotPaths.get_apps_dir() + app_id = str(uuid.uuid4()) + + # 1. 创建应用基本结构 + creator = XbotAppCreator(output_dir, app_id, app_name) + project = creator.create() + + + print(f"正在从配置文件创建脚手架: {temp_path}") + with open(temp_path, 'r', encoding='utf-8') as f: + config = json.load(f) + + # 3. 添加依赖 + if 'dependency' in config: + for dep in config['dependency']: + print(f"添加依赖: {dep}") + project.add_internal_dependency(dep) + + # 4. 创建和配置流程 + if 'flow' in config: + for flow_data in config['flow']: + flow_name = flow_data['name'] + + if flow_name == 'main': + flow = project.main + print("配置主流程 (main)...") + else: + if flow_data.get('kind') == 'visual': + flow = project.create_new_flow(flow_name, flow_data.get('memo')) + print(f"创建新可视化流程: {flow_name}") + else: + flow = project.create_code_flow(flow_name, flow_data.get('memo', '')) + print(f"创建新代码流程: {flow_name}") + + if 'parameters' in flow_data: + for param in flow_data['parameters']: + if param.get('direction') == 'In': + flow.add_input_parameter(param['name'], param.get('type', 'str'), param.get('value', ''), param.get('description', ''), param.get('kind', 'Text')) + + if 'blocks' in flow_data: + for block_data in flow_data['blocks']: + print(f" -> 添加积木块: {block_data['name']}") + block = flow.add_block(block_data['name']) + if 'inputs' in block_data: + for input_name, input_info in block_data['inputs'].items(): + value = input_info.get('value') + display = input_info.get('display', '') + if value is None: + continue + value_str = str(value) + if value_str.startswith('10:'): + block.fields[input_name].set_text_value(value_str[3:]) + elif value_str.startswith('11:'): + block.fields[input_name].set_expression_value(value_str[3:]) + elif value_str.startswith('13:'): + block.fields[input_name].set_text_value(value_str[3:]) + elif value_str.startswith('16:'): + block.fields[input_name].set_text_value(value_str[3:]) + else: + block.fields[input_name].set_text_value(value_str) + + if display: + block.fields[input_name].set_display_value(display) + + # **错误修复逻辑** + if 'outputs' in block_data: + for output_name, output_info in block_data['outputs'].items(): + if output_info.get('isEnable'): + var_name = output_info.get('name') + if var_name: + # 检查指定的 output_name 是否存在 + if output_name in block.fields: + block.variables[output_name].set_name(var_name) + # 如果不存在,并且只有一个输出,尝试使用通用的 'output' 字段 + elif len(block_data['outputs']) == 1 and 'output' in block.fields: + print(f" [警告] 字段 '{output_name}' 未找到. 尝试使用通用字段 'output'.") + block.variables['output'].set_name(var_name) + else: + # 如果还是找不到,则打印一个更明确的错误信息 + print(f" [错误] 无法为积木块 '{block_data['name']}' 设置输出变量 '{var_name}'. " + f"字段 '{output_name}' 或备用字段 'output' 均不存在。 " + f"可用字段: {list(block.fields.keys())}") + + + # 5. 保存所有更改 + print("\n保存项目所有更改...") + project.save_all(creator.robot_dir) + + # 6. 导入应用到数据库 + app_path = os.path.join(output_dir, app_id) + print("\n=== 开始导入数据库 ===") + user_dir = ShadowBotPaths.get_first_user_dir() + user_id = os.path.basename(user_dir) + insert_new_app(app_id, user_id, app_name) + + return app_id, app_path + + except Exception as e: + import traceback + print(f"\n错误: 创建或导入失败") + print(f"详细信息: {str(e)}") + traceback.print_exc() + raise + +def create_and_import_app_for_convert(app_name: str) -> tuple[str, str]: + """创建并导入新的Xbot应用 + + Returns: + tuple[str, str]: (app_id, app_path) + """ + try: + output_dir = ShadowBotPaths.get_apps_dir() + app_id = str(uuid.uuid4()) + + # 创建应用 + creator = XbotAppCreator(output_dir, app_id, app_name) + project = creator.create() + + project.save_all(creator.robot_dir) + + app_path = os.path.join(output_dir, app_id) + + # 导入应用到数据库 + print("\n=== 开始导入数据库 ===") + user_dir = ShadowBotPaths.get_first_user_dir() + user_id = os.path.basename(user_dir) + insert_new_app(app_id, user_id, app_name) + + return app_id, app_path + + except Exception as e: + print(f"\n错误: 创建或导入失败") + print(f"详细信息: {str(e)}") + raise + diff --git a/src/Xbot/XbotAppTemplate/xbot_robot/.dev/main.flow.json b/src/Xbot/XbotAppTemplate/xbot_robot/.dev/main.flow.json new file mode 100644 index 0000000..60a78f7 --- /dev/null +++ b/src/Xbot/XbotAppTemplate/xbot_robot/.dev/main.flow.json @@ -0,0 +1,8 @@ +{ + "name": "main", + "memo": "测试_jc", + "kind": "visual", + "blocks": [ + ], + "parameters": [] +} \ No newline at end of file diff --git a/src/Xbot/XbotAppTemplate/xbot_robot/__init__.py b/src/Xbot/XbotAppTemplate/xbot_robot/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/Xbot/XbotAppTemplate/xbot_robot/imagesV2.xml b/src/Xbot/XbotAppTemplate/xbot_robot/imagesV2.xml new file mode 100644 index 0000000..d246e95 --- /dev/null +++ b/src/Xbot/XbotAppTemplate/xbot_robot/imagesV2.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Xbot/XbotAppTemplate/xbot_robot/main.py b/src/Xbot/XbotAppTemplate/xbot_robot/main.py new file mode 100644 index 0000000..62bcacf --- /dev/null +++ b/src/Xbot/XbotAppTemplate/xbot_robot/main.py @@ -0,0 +1,7 @@ +import xbot +import xbot_visual +from . import package +import time + +def main(args): + pass diff --git a/src/Xbot/XbotAppTemplate/xbot_robot/package.json b/src/Xbot/XbotAppTemplate/xbot_robot/package.json new file mode 100644 index 0000000..7258619 --- /dev/null +++ b/src/Xbot/XbotAppTemplate/xbot_robot/package.json @@ -0,0 +1,13 @@ +{ + "version": "1", + "name": "浦发-新应用测试11", + "package_version": 2, + "startup": "main", + "flows": [{ + "name": "main", + "filename": "main", + "kind": "visual" + }], + "variables": [], + "external_dependencies": [] +} diff --git a/src/Xbot/XbotAppTemplate/xbot_robot/package.py b/src/Xbot/XbotAppTemplate/xbot_robot/package.py new file mode 100644 index 0000000..2d649c4 --- /dev/null +++ b/src/Xbot/XbotAppTemplate/xbot_robot/package.py @@ -0,0 +1,49 @@ +""" +提供访问应用数据的功能,如获取元素、访问全局变量、获取资源文件等功能 + +```python +# 获取名称为Button的选择器 +package.selector('Button') +# 获取名称为Img的图像选择器 +package.image_selector('Img') +# 以文本形式获取名称为names.txt的资源文件 +package.resources.get_text('names.txt') +# 以二进制形式获取名称为users.xlsx的资源文件 +package.resources.get_bytes('users.xlsx') +# 设置全局变量 +package.variables['g_var1'] = 123 +# 获取全局变量 +package.variables['g_var1'] +``` +""" + +from xbot.selector import SelectorStore, ImageSelectorStore +from xbot.primitives import VariableDict, ResourceReader, _sdmodules + +import os + + +_path = os.path.dirname(__file__) +_sdmodules[_path] = globals() +_selector_store = SelectorStore(_path) +_image_selector_store = ImageSelectorStore(_path) + + +def selector(name): + """ + 从元素库中获取指定名称的选择器 + * @param name, 元素名称 + * @return `Selector`、`TableSelector`, 返回选择器对象 + """ + return _selector_store(name) + +def image_selector(name): + """ + 从图像库中获取指定名称的图像选择器 + * @param name, 元素名称 + * @return `ImageSelector`, 返回图像选择器对象 + """ + return _image_selector_store(name) + +resources = ResourceReader(__loader__, _path) +variables = VariableDict() \ No newline at end of file diff --git a/src/Xbot/XbotAppTemplate/xbot_robot/resources/aocc.yaml b/src/Xbot/XbotAppTemplate/xbot_robot/resources/aocc.yaml new file mode 100644 index 0000000..37eb1d3 --- /dev/null +++ b/src/Xbot/XbotAppTemplate/xbot_robot/resources/aocc.yaml @@ -0,0 +1,22 @@ +# 如果配置中必填项有一个为空, 以流程代码传递的参数为准 +# 如果Config目录下有此配置文件, aocc模块流程参数以配置文件为准 + +# 流程编号(必填) +Processid: "87df5e45-1a63-4d1a-97b5-baffeab20851" +# 流程名称(必填) +ProcessName: "test - jianxin" +#管理端类型(必填) AA或i-search,默认为 yingdao +Software: "yingdao" +#管理端地址(必填) +CR: "21.64.212.172" +# 机器人名称为空则自动获取用户和机器名拼接机器人名称 +RobotName: "uat_test6@yd" +#机器人ip为空则自动获取本机IP地址 +Robotip: "" +# AOCC接口开关(必填): 为True表示与AOCC通信,为False表示流程不与AOCC交互,默认为True +Switch: True +#AOCC通信超时重试次数(必填--超时重试):当AOCC接口调用超时,尝试重发多少次,默认为3次 +TimeoutRetry: 3 +#AOCC通信失败重试次数 (必填--失败重试):当AOCC接口不通时,尝试重发多少次,默认为3次 +failedRetry: 3 + diff --git a/src/Xbot/XbotAppTemplate/xbot_robot/selectorsV2.xml b/src/Xbot/XbotAppTemplate/xbot_robot/selectorsV2.xml new file mode 100644 index 0000000..a4228f5 --- /dev/null +++ b/src/Xbot/XbotAppTemplate/xbot_robot/selectorsV2.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/Xbot/XbotFlow.py b/src/Xbot/XbotFlow.py new file mode 100644 index 0000000..0610547 --- /dev/null +++ b/src/Xbot/XbotFlow.py @@ -0,0 +1,248 @@ +from abc import abstractmethod +from dataclasses import dataclass, field +from typing import Optional, List, Dict, Any, Union, Literal +import json +import os.path +import re +import enum +import uuid + +from Xbot.Blockly.Field import Field +from Xbot.FlowParameter import FieldValueKind, DirectionKind +from Xbot.Blockly import Variable, XbotBlock + +class FlowKind(enum.Enum): + VISUAL = "Visual" + CODE = "Code" + +class ParameterDirection(str, enum.Enum): + IN = "In" + OUT = "Out" + +class ParameterKind(str, enum.Enum): + TEXT = "Text" + EXPRESSION = "Expression" + +@dataclass +class FlowParameter: + name: str + direction: str # "In" 或 "Out" + type: str # 数据类型,如 "str", "int", "bool" 等 + value: str = "" # 默认值 + description: str = "" + kind: str = "Text" # "Text" 或 "Expression" + + def to_dict(self) -> Dict[str, Any]: + """转换为字典表示""" + return { + "name": self.name, + "direction": self.direction, + "type": self.type, + "value": self.value, + "description": self.description, + "kind": self.kind + } + +@dataclass +class XbotFlow: + name: str + filename: str + kind: str = "Visual" + opened: bool = False + groupName: Optional[str] = None + memo: Optional[str] = None + blocks: List[XbotBlock] = field(default_factory=list) + parameters: List[FlowParameter] = field(default_factory=list) + dev_dir: Optional[str] = None + local_vars: list[str] = field(default_factory=list) + project = None + + block_imports: list[str] = field(default_factory=list) + + def load_flow_json(self, project_dir: str) -> None: + """从flow.json文件加载流程定义 + + Args: + project_dir: 项目根目录 + """ + # 在.dev目录下查找flow.json + dev_dir = os.path.join(project_dir, ".dev") + flow_path = os.path.join(dev_dir, f"{self.filename}.flow.json") + + if not os.path.exists(flow_path): + print(f"警告: 流程文件不存在: {flow_path}") + return + + with open(flow_path, 'r', encoding='utf-8') as f: + data = json.load(f) + self.memo = data.get('memo', '') + + # 加载blocks + self.blocks = [] + for block_data in data.get('blocks', []): + block = XbotBlock.from_dict(block_data) + self.blocks.append(block) + + # 加载parameters + self.parameters = [] + for param_data in data.get('parameters', []): + param = FlowParameter( + name=param_data.get('name', ''), + direction=param_data.get('direction', 'In'), + type=param_data.get('type', 'str'), + value=param_data.get('value', ''), + description=param_data.get('description', ''), + kind=param_data.get('kind', 'Text') + ) + self.parameters.append(param) + + def add_block(self, block_name: str, + inputs: Dict[str, Field] = None, + outputs: Dict[str, Variable]= None, + is_enabled: bool = True, + block_title: Optional[str] = None) -> XbotBlock: + """添加新的代码块""" + block = XbotBlock( + id=str(uuid.uuid4()), + name=block_name, + fields=inputs, + variables=outputs, + isEnabled=is_enabled, + block_title=block_title + ) + self.blocks.append(block) + return block + + def add_parameter(self, name: str, param_type: str = "str", + direction: str = "In", value: str = "", + description: str = "", kind: str = "Text") -> FlowParameter: + """添加流程参数 + + Args: + name: 参数名称 + param_type: 参数类型,如 "str", "int", "bool" 等 + direction: 参数方向,"In"表示输入参数,"Out"表示输出参数 + value: 参数默认值 + description: 参数描述 + kind: 参数种类,"Text"或"Expression" + + Returns: + FlowParameter: 新添加的参数 + """ + param = FlowParameter( + name=name, + direction=DirectionKind(direction), + type=param_type, + value=value, + description=description, + kind=kind + ) + self.parameters.append(param) + return param + + def add_input_parameter(self, name: str, param_type: str = "str", + value: str = "", description: str = "", + kind: str = "Text") -> FlowParameter: + """添加输入参数(便捷方法)""" + return self.add_parameter(name, param_type, "In", value, description, kind) + + def add_output_parameter(self, name: str, param_type: str = "str", + value: str = "", description: str = "", + kind: str = "Text") -> FlowParameter: + """添加输出参数(便捷方法)""" + return self.add_parameter(name, param_type, "Out", value, description, kind) + + def get_parameter_by_name(self, name: str) -> Optional[FlowParameter]: + """通过名称获取参数 + + Args: + name: 参数名称 + + Returns: + Optional[FlowParameter]: 找到的参数,如果不存在则返回None + """ + for param in self.parameters: + if param.name == name: + return param + return None + + def add_block_import(self, import_content: str): + for import_line in import_content.split('\n'): + import_line = import_line.strip("\r") + if import_line is not None and len(import_line) > 0: + self.block_imports.append(import_line) + + def get_block_import(self) -> list[str]: + return self.block_imports + + def get_input_parameters(self) -> List[FlowParameter]: + """获取所有输入参数""" + return [param for param in self.parameters if param.direction == "In"] + + def get_output_parameters(self) -> List[FlowParameter]: + """获取所有输出参数""" + return [param for param in self.parameters if param.direction == "Out"] + + def get_block_by_id(self, block_id: str) -> Optional[XbotBlock]: + """通过ID获取代码块 + + Args: + block_id: 块ID + + Returns: + Optional[Block]: 找到的代码块,如果不存在则返回None + """ + for block in self.blocks: + if block.id == block_id: + return block + return None + + def to_dict(self) -> Dict[str, Any]: + """将流程转换为字典格式""" + return { + 'name': self.name, + 'filename': self.filename, + 'memo': self.memo, + 'kind': self.kind.lower(), + 'groupName': self.groupName, + } + + @abstractmethod + def to_disk(self) -> Dict[str, Any]: + """转换为保存到磁盘的字典格式""" + pass + + def save_flow_json(self, project_dir: str) -> None: + """保存流程定义到flow.json文件 + + Args: + project_dir: 项目根目录 + """ + dev_dir = os.path.join(project_dir, ".dev") + if not os.path.exists(dev_dir): + os.makedirs(dev_dir, exist_ok=True) + + flow_path = os.path.join(dev_dir, f"{self.filename}.flow.json") + print(f"保存流程: {flow_path}") + with open(flow_path, 'w', encoding='utf-8') as f: + json.dump(self.to_disk(), f, indent=2, ensure_ascii=False) + + def create_flow(self): + """创建流程文件""" + if not self.dev_dir: + raise ValueError("dev_dir不能为空") + + template = self.to_dict() + flow_file = os.path.join(self.dev_dir, f"{self.filename}.flow.json") + with open(flow_file, "w", encoding="utf-8") as f: + json.dump(template, f, indent=2, ensure_ascii=False) + + @classmethod + def create(cls, name: str, filename: str, kind: str, **kwargs): + """创建合适类型的流程对象""" + if kind.lower() == FlowKind.CODE.value.lower(): + from .CodeFlow import CodeFlow + return CodeFlow(name=name, filename=filename, kind=FlowKind.CODE.value, **kwargs) + else: + from .VisualFlow import VisualFlow + return VisualFlow(name=name, filename=filename, kind=FlowKind.VISUAL.value, **kwargs) \ No newline at end of file diff --git a/src/Xbot/XbotProject.py b/src/Xbot/XbotProject.py new file mode 100644 index 0000000..f1a5a87 --- /dev/null +++ b/src/Xbot/XbotProject.py @@ -0,0 +1,405 @@ +from dataclasses import dataclass, field +from typing import List, Optional, Dict, Any +from enum import Enum +import json +import uuid +import os.path +from .XbotFlow import XbotFlow +from .XbotFlow import FlowKind + + +class FlowKind(Enum): + VISUAL = "Visual" + CODE = "Code" + + +@dataclass +class FlowGroup: + name: str + + +@dataclass +class CustomItems: + gifUrl: Optional[str] = None + videoUrl: str = "" + imageUrl: str = "" + imageName: str = "" + + +@dataclass +class XbotProject: + name: str + uuid: str = field(default_factory=lambda: str(uuid.uuid4())) + icon: Optional[str] = None + version: str = "1" + tags: str = "" + software: Optional[str] = None + software_title: Optional[str] = None + package_version: int = 2 + description: Optional[str] = None + instruction: str = "" + use_latest_pip: bool = False + videoName: str = "" + startup: str = "main" + robot_type: str = "app" + activity_code: Optional[str] = None + main: Optional[XbotFlow] = None # 添加main流程属性 + flows: List[XbotFlow] = field(default_factory=list) + flow_groups: List[FlowGroup] = field(default_factory=list) # 修复这行 + variables: List[Any] = field(default_factory=list) + external_dependencies: List[str] = field(default_factory=list) + internaldependencies: List[Any] = field(default_factory=list) + selectordependencies: List[Any] = field(default_factory=list) + internalautodependencies: List[Any] = field(default_factory=list) + databook_columns: List[Any] = field(default_factory=list) + authority: str = "use" + internalautoupgrade: bool = False + isbrief: bool = False + uia_type: str = "PC" + persist_databook: bool = False + customItems: CustomItems = field(default_factory=CustomItems) + _project_dir: Optional[str] = None + + images: Dict[str, Any] = field(default_factory=dict) + + + def _post_init(self): + """初始化后处理""" + if self.main: + self.main.project = self + + for flow in self.flows: + flow.project = self + + def create_new_flow( + self, + name: str, + filename: str, + kind: str = FlowKind.VISUAL.value, + groupName: Optional[str] = None, + ) -> XbotFlow: + """添加新的流程""" + flow = XbotFlow.create( + name=name, filename=filename, kind=kind, groupName=groupName + ) + flow.project = self + if name == "main": + self.main = flow + else: + self.flows.append(flow) + + return flow + + def add_exist_flow(self, flow: XbotFlow) -> XbotFlow: + """添加已存在的流程""" + if flow.name == "main": + self.main = flow + else: + self.flows.append(flow) + flow.project = self + return flow + + def create_code_flow( + self, name: str, code: str = "", groupName: Optional[str] = None + ) -> XbotFlow: + """创建代码类型流程(便捷方法)""" + flow = self.create_new_flow( + name=name, filename=name, kind=FlowKind.CODE.value, groupName=groupName + ) + flow.set_code(code) + return flow + + def add_flow_group(self, name: str) -> None: + """添加新的流程组""" + group = FlowGroup(name=name) + self.flow_groups.append(group) + + def add_global_variable( + self, + name: str, + type="any", + value: str = "", + desc: str = "any", + kind: str = "Expression", + ) -> None: + """添加全局变量""" + self.variables.append( + {"name": name, "value": value, "kind": kind, "type": type, "desc": desc} + ) + + def global_variable_exist(self, name: str) -> bool: + for i in self.variables: + if i['name'] == name: + return True + return False + + + def add_external_dependency(self, dependency: str) -> None: + """添加外部依赖""" + if dependency not in self.external_dependencies: + self.external_dependencies.append(dependency) + + def add_internal_dependency(self, dependency: str) -> None: + """添加内部组件依赖 + + Args: + dependency: 依赖标识符,格式如 'activity_f4d5de04==23.11.1' + """ + if dependency not in self.internaldependencies: + self.internaldependencies.append(dependency) + # 添加自动更新依赖 + component_name = dependency.split("==")[0] + if component_name not in self.internalautodependencies: + self.internalautodependencies.append(component_name) + + def remove_internal_dependency(self, component_name: str) -> None: + """移除内部组件依赖 + + Args: + component_name: 组件名称,如 'activity_f4d5de04' + """ + # 移除指定版本的依赖 + self.internaldependencies = [ + dep + for dep in self.internaldependencies + if not dep.startswith(component_name + "==") + ] + # 移除自动更新依赖 + if component_name in self.internalautodependencies: + self.internalautodependencies.remove(component_name) + + def get_internal_dependencies(self) -> Dict[str, str]: + """获取内部组件依赖的版本映射 + + Returns: + Dict[str, str]: 组件名称到版本号的映射 + """ + result = {} + for dep in self.internaldependencies: + if "==" in dep: + name, version = dep.split("==") + result[name] = version + return result + + def add_image(self, image_name: str, image_file: str) -> None: + self.images[image_file] = { + "filepath" : fr'resources\images\{image_file}', + "similarity": "85", + "scalingfactor": "1.0", + "adaptive": "True", + "graying": "False", + "sourcetype": "screenshot", + "name": image_name, + 'filename': image_file + } + + def get_images(self) -> dict[Any]: + return self.images + + def project_dir(self) -> str: + return self._project_dir + + def to_dict(self) -> dict: + """将项目配置转换为字典格式""" + flows_data = [] + if self.main: + flows_data.append(self.main.to_dict()) + flows_data.extend([flow.to_dict() for flow in self.flows]) + + return { + "uuid": self.uuid, + "name": self.name, + "icon": self.icon, + "version": self.version, + "tags": self.tags, + "software": self.software, + "software_title": self.software_title, + "package_version": self.package_version, + "description": self.description, + "instruction": self.instruction, + "use_latest_pip": self.use_latest_pip, + "videoName": self.videoName, + "startup": self.startup, + "robot_type": self.robot_type, + "activity_code": self.activity_code, + "flows": flows_data, + "flow_groups": [vars(group) for group in self.flow_groups], + "variables": self.variables, + "external_dependencies": self.external_dependencies, + "internaldependencies": self.internaldependencies, + "selectordependencies": self.selectordependencies, + "internalautodependencies": self.internalautodependencies, + "databook_columns": self.databook_columns, + "authority": self.authority, + "internalautoupgrade": self.internalautoupgrade, + "isbrief": self.isbrief, + "uia_type": self.uia_type, + "persist_databook": self.persist_databook, + "customItems": vars(self.customItems), + } + + def save(self, filepath: str) -> None: + """保存项目配置到package.json""" + with open(filepath, "w", encoding="utf-8") as f: + json.dump(self.to_dict(), f, indent=2, ensure_ascii=False) + + def save_all(self, project_dir: str) -> None: + """保存项目所有内容,包括配置文件和所有流程 + + Args: + project_dir: 项目根目录 + """ + # 保存package.json + package_json = os.path.join(project_dir, "package.json") + self.save(package_json) + + # 保存所有流程 + if self.main: + self.main.save_flow_json(project_dir) + + for flow in self.flows: + flow.save_flow_json(project_dir) + + # 为全局变量生成初始化代码并保存到package.py + self._save_variables_init_code(project_dir) + self._save_image_v2_file() + + def _save_variables_init_code(self, project_dir: str) -> None: + """生成全局变量初始化代码,并保存到package.py文件末尾 + + Args: + project_dir: 项目根目录 + + Raises: + FileNotFoundError: 当package.py文件不存在时抛出异常 + """ + package_py = os.path.join(project_dir, "package.py") + + # 检查package.py文件是否存在 + if not os.path.exists(package_py): + raise FileNotFoundError(f"package.py文件不存在: {package_py}") + + # 生成变量初始化代码 + var_init_lines = [] + for var in self.variables: + var_name = var.get("name", "") + var_value = var.get("value", "") + + # 根据变量类型格式化值 + var_type = var.get("type", "any").lower() + if var_type in ["string", "str"] and not ( + var_value.startswith("'") or var_value.startswith('"') + ): + # 字符串类型需要加引号 + var_value = f"'{var_value}'" + + var_init_lines.append(f"variables['{var_name}'] = {var_value}") + + # 读取现有文件内容 + with open(package_py, "r", encoding="utf-8") as f: + content = f.read() + + # 添加变量初始化代码 + if var_init_lines: + # 在文件末尾添加变量初始化代码 + content += "\n\n# 全局变量初始化\n" + for line in var_init_lines: + content += f"{line}\n" + + # 写回文件 + with open(package_py, "w", encoding="utf-8") as f: + f.write(content) + + print(f"已将 {len(var_init_lines)} 个全局变量的初始化代码添加到 package.py") + + @classmethod + def load(cls, project_dir: str) -> "XbotProject": + """从项目目录加载 XBot 项目配置""" + package_json = os.path.join(project_dir, "package.json") + + if not os.path.exists(package_json): + raise FileNotFoundError(f"项目配置文件不存在: {package_json}") + + try: + with open(package_json, "r", encoding="utf-8") as f: + data = json.load(f) + + # 确保必需的字段存在 + if "name" not in data: + raise ValueError("项目配置缺少必需的name字段") + + # 修改流程加载逻辑 + flows = [] + main_flow = None + for flow_data in data.pop("flows", []): + kind = flow_data.get("kind", FlowKind.VISUAL.value) + flow = XbotFlow.create(**flow_data) + flow.load_flow_json(project_dir) + + if flow.name == "main": + main_flow = flow + else: + flows.append(flow) + + flow_groups = [ + FlowGroup(**group) for group in data.pop("flow_groups", []) + ] + custom_items = CustomItems(**data.pop("customItems", {})) + + # 创建项目实例 + project = cls( + name=data.pop("name"), + flows=flows, + main=main_flow, # 设置main流程 + flow_groups=flow_groups, + customItems=custom_items, + **data, + ) + project._project_dir = project_dir + print(f"已加载项目 '{project.name}' (UUID: {project.uuid})") + print(f"包含主流程: {project.main.name if project.main else 'None'}") + print(f"包含 {len(project.flows)} 个子流程:") + for flow in project.flows: + print( + f" - {flow.name} ({flow.kind})" + + (f" [组: {flow.groupName}]" if flow.groupName else "") + ) + + return project + + except json.JSONDecodeError as e: + raise ValueError(f"项目配置文件格式错误: {e}") + except Exception as e: + raise RuntimeError(f"加载项目失败: {e}") + + def _save_image_v2_file(self): + image_v2_path = os.path.join(self._project_dir, "imagesV2.xml") + + image_content = [] + image_content.append('') + image_content.append('') + image_content.append(' ') + for image in self.images.values(): + image_name = image["name"] + image_path = image["filepath"] + image_similarity = image["similarity"] + image_content.append(f' ') + image_content.append(' ') + image_content.append('') + + with open(image_v2_path, 'w', encoding='utf-8') as f: + f.write("\n".join(image_content)) + pass + + def get_image_name(self, image_file_name: str) -> str: + if image_file_name in self.images: + return self.images[image_file_name]['name'] + return "" + + def set_image_fuzzy(self, image_file_name: str, fuzzy: str) -> None: + '''设置相似度''' + try: + if image_file_name in self.images: + self.images[image_file_name]['similarity'] = int(float(fuzzy) * 100) + except Exception as e: + pass diff --git a/src/Xbot/__init__.py b/src/Xbot/__init__.py new file mode 100644 index 0000000..d116973 --- /dev/null +++ b/src/Xbot/__init__.py @@ -0,0 +1,5 @@ +from .XbotProject import XbotProject +from .XbotFlow import XbotFlow +from .Blockly.XbotBlock import XbotBlock + +__all__ = ['XbotProject', 'XbotFlow', 'XbotBlock', 'ValueRef', 'BlockInput'] \ No newline at end of file diff --git a/src/Xbot/__pycache__/CodeFlow.cpython-310.pyc b/src/Xbot/__pycache__/CodeFlow.cpython-310.pyc new file mode 100644 index 0000000..2885cdf Binary files /dev/null and b/src/Xbot/__pycache__/CodeFlow.cpython-310.pyc differ diff --git a/src/Xbot/__pycache__/FlowParameter.cpython-310.pyc b/src/Xbot/__pycache__/FlowParameter.cpython-310.pyc new file mode 100644 index 0000000..385d29a Binary files /dev/null and b/src/Xbot/__pycache__/FlowParameter.cpython-310.pyc differ diff --git a/src/Xbot/__pycache__/ShadowBotPaths.cpython-310.pyc b/src/Xbot/__pycache__/ShadowBotPaths.cpython-310.pyc new file mode 100644 index 0000000..46b4e71 Binary files /dev/null and b/src/Xbot/__pycache__/ShadowBotPaths.cpython-310.pyc differ diff --git a/src/Xbot/__pycache__/VisualFlow.cpython-310.pyc b/src/Xbot/__pycache__/VisualFlow.cpython-310.pyc new file mode 100644 index 0000000..39dc78b Binary files /dev/null and b/src/Xbot/__pycache__/VisualFlow.cpython-310.pyc differ diff --git a/src/Xbot/__pycache__/XbotAppCreator.cpython-310.pyc b/src/Xbot/__pycache__/XbotAppCreator.cpython-310.pyc new file mode 100644 index 0000000..5755c57 Binary files /dev/null and b/src/Xbot/__pycache__/XbotAppCreator.cpython-310.pyc differ diff --git a/src/Xbot/__pycache__/XbotFlow.cpython-310.pyc b/src/Xbot/__pycache__/XbotFlow.cpython-310.pyc new file mode 100644 index 0000000..d3c93b5 Binary files /dev/null and b/src/Xbot/__pycache__/XbotFlow.cpython-310.pyc differ diff --git a/src/Xbot/__pycache__/XbotProject.cpython-310.pyc b/src/Xbot/__pycache__/XbotProject.cpython-310.pyc new file mode 100644 index 0000000..9d730ec Binary files /dev/null and b/src/Xbot/__pycache__/XbotProject.cpython-310.pyc differ diff --git a/src/Xbot/__pycache__/__init__.cpython-310.pyc b/src/Xbot/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000..c5beb17 Binary files /dev/null and b/src/Xbot/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/Xbot/__pycache__/bot_import.cpython-310.pyc b/src/Xbot/__pycache__/bot_import.cpython-310.pyc new file mode 100644 index 0000000..8b2279d Binary files /dev/null and b/src/Xbot/__pycache__/bot_import.cpython-310.pyc differ diff --git a/src/Xbot/bot_import.py b/src/Xbot/bot_import.py new file mode 100644 index 0000000..22b3e4e --- /dev/null +++ b/src/Xbot/bot_import.py @@ -0,0 +1,33 @@ +import os +import sqlite3 +import uuid + +#TODO(huifu): 演示的用用户ID +USER_ID = "757424674936492032" + + +def get_xbot_user_app_dir(user_id): + local_app_data = os.environ.get('LOCALAPPDATA') + return os.path.join(local_app_data, "ShadowBot", "users", user_id) + + +def insert_new_app(app_id, user_id, app_name): + user_db_file = get_xbot_db_file(user_id) + conn = sqlite3.connect(user_db_file) + cursor = conn.cursor() + cursor.execute('INSERT INTO developmentsync_apps_v2 (uuid, name, robotType, isSynchronized) VALUES (?,?,?,?)', (app_id, app_name, "app", 0)) + conn.commit() + conn.close() + + +def get_xbot_db_file(user_id): + user_db_file = os.path.join(get_xbot_user_app_dir(user_id), "user.db3") + if not os.path.exists(user_db_file): + raise RuntimeError(f"can not file shadow bot db file: {user_db_file}") + return user_db_file + + +if __name__ == "__main__": + uuid_str = str(uuid.uuid4()) + print(f"start insert app : {uuid_str}") + insert_new_app(str(uuid.uuid4()), USER_ID, f"test-{uuid_str}") diff --git a/src/assert/block_settings/asset.blocks.json b/src/assert/block_settings/asset.blocks.json new file mode 100644 index 0000000..4129512 --- /dev/null +++ b/src/assert/block_settings/asset.blocks.json @@ -0,0 +1,77 @@ +{ + "types": [], + "blocks": [ + { + "name": "asset.get_asset", + "title": "获取资产", + "icon": "BlockIcons/36-1.png", + "comment": "获取%asset_name%的资产值", + "description": "获取资产信息", + "function": "xbot_visual.asset.get_asset", + "settingsControl": "ShadowBot.Shell.Console.BlockSettings.Controls.Asset.GetAssetControl, ShadowBot.Shell.Console", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/获取资产.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Asset.GetAssetHandler" + } + ], + "inputs": [ + { + "name": "asset_name", + "label": "资产名称", + "required": true, + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "asset_type", + "label": "资产类型", + "required": true, + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "encrypt_flag", + "label": "资产值加密标志", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "value", + "label": "保存普通资产值至", + "variableLabel": "资产值", + "tips": "输入一个变量用来保存普通资产的资产值", + "name": "value", + "type": "str" + }, + { + "id": "user_name", + "label": "保存凭证资产用户名至", + "variableLabel": "凭证用户名", + "tips": "输入一个变量用来保存凭证资产的用户名", + "name": "user_name", + "type": "str" + }, + { + "id": "password", + "label": "保存凭证资产密码至", + "variableLabel": "凭证密码", + "tips": "输入一个变量用来保存凭证资产的密码,获取的凭证资产密码为加密文本,会在使用填写密码框指令时被自动解密", + "name": "password", + "type": "str" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/base64.blocks.json b/src/assert/block_settings/base64.blocks.json new file mode 100644 index 0000000..91ff6c9 --- /dev/null +++ b/src/assert/block_settings/base64.blocks.json @@ -0,0 +1,101 @@ +{ + "types": [], + "blocks": [ + { + "name": "base64.encode", + "function": "xbot_visual.base64.encode", + "title": "Base64编码", + "description": "Base64编码", + "comment": "Base64编码%source%,将编码结果保存到%base64_encode_result%", + "icon": "BlockIcons/15-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/base64编解码/base64编码.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Base64.EncodeHandler" + } + ], + "inputs": [ + { + "name": "source", + "label": "内容", + "required": true, + "tips": "输入待编码的内容", + "type": "any", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "output_string", + "label": "", + "required": true, + "tips": "输出字符串", + "type": "bool", + "default": "13:True", + "editor": { + "label": "输出字符串", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "base64_encode_result", + "label": "保存编码结果至", + "variableLabel": "Base64编码结果", + "tips": "输入一个名字,用来保存Base64编码结果", + "type": "any", + "name": "base64_encode_result" + } + ] + }, + { + "name": "base64.decode", + "function": "xbot_visual.base64.decode", + "title": "Base64解码", + "description": "Base64解码", + "comment": "Base64解码%source%,将解码结果保存到%base64_decode_result%", + "icon": "BlockIcons/15-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/base64编解码/base64解码.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Base64.DecodeHandler" + } + ], + "inputs": [ + { + "name": "source", + "label": "待解码内容", + "required": true, + "tips": "输入待解码的内容", + "type": "any", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "output_string", + "label": "", + "required": true, + "tips": "输出字符串", + "type": "bool", + "default": "13:True", + "editor": { + "label": "输出字符串", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "base64_decode_result", + "label": "保存解码结果至", + "variableLabel": "base64解码结果", + "tips": "输入一个名字,用来保存base64解码结果", + "type": "any", + "name": "base64_decode_result" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/buildin_types.json b/src/assert/block_settings/buildin_types.json new file mode 100644 index 0000000..7c024cc --- /dev/null +++ b/src/assert/block_settings/buildin_types.json @@ -0,0 +1,142 @@ +[ + { + "name": "any", + "localName": "任意类型", + "group_order": "6" + }, + { + "name": "int", + "localName": "整数", + "pythonName": "int", + "group": "Common", + "group_order": "2", + "methods": [ + { + "display": "转字符串", + "function": "str($0)", + "type": "str" + } + ] + }, + { + "name": "float", + "localName": "小数", + "pythonName": "float", + "group_order": "7", + "methods": [ + { + "display": "转字符串", + "function": "str($0)", + "type": "str" + }, + { + "display": "取整数部分", + "function": "int($0)", + "type": "int" + } + ] + }, + { + "name": "bool", + "localName": "布尔值", + "pythonName": "bool", + "group": "Common", + "group_order": "3" + }, + { + "name": "str", + "localName": "字符串", + "pythonName": "str", + "group": "Common", + "group_order": "1", + "methods": [ + { + "display": "删除两端空格", + "function": "$0.strip()", + "type": "str" + }, + { + "display": "转数字(整数)", + "function": "int($0)", + "type": "int" + }, + { + "display": "转数字(小数)", + "function": "float($0)", + "type": "float" + } + ] + }, + { + "name": "list", + "localName": "列表", + "pythonName": "list,set,tuple", + "group": "Common", + "group_order": "4", + "methods": [ + { + "display": "列表第$1项", + "function": "$0[--$1]", + "type": "any", + "params": [ + { + "name": "$1", + "default": "1" + } + ], + "editor": "spin" + }, + { + "display": "列表倒数第$1项", + "function": "$0[-$1]", + "type": "any", + "params": [ + { + "name": "$1", + "default": "1" + } + ], + "editor": "spin" + }, + { + "display": "列表长度", + "function": "len($0)", + "type": "int" + } + ] + }, + { + "name": "dict", + "localName": "字典", + "group": "Common", + "pythonName": "dict", + "group_order": "5" + }, + { + "name": "file", + "localName": "文件路径", + "pythonName": "str" + }, + { + "name": "directory", + "localName": "文件夹路径", + "pythonName": "str" + }, + { + "name": "bytes", + "localName": "二进制数据", + "pythonName": "bytes", + "methods": [ + { + "display": "转字符串", + "function": "str($0)", + "type": "str" + } + ] + }, + { + "name": "datetime", + "localName": "日期时间", + "pythonName": "datetime.datetime" + } +] \ No newline at end of file diff --git a/src/assert/block_settings/chatgpt.blocks.json b/src/assert/block_settings/chatgpt.blocks.json new file mode 100644 index 0000000..84c4860 --- /dev/null +++ b/src/assert/block_settings/chatgpt.blocks.json @@ -0,0 +1,212 @@ +{ + "types": [], + "blocks": [ + { + "name": "chatgpt.completions", + "icon": "BlockIcons/23-8.png", + "description": "可通过自然语言对话让AI完成原创写作、检查纠错、客服对话、翻译等任务", + "comment": "通过%ai_engine%GPT引擎,提问内容%question%,将结果保存到%chatgpt_result%", + "title": "影刀GPT", + "keywords": "Chat", + "function": "xbot_visual.chatgpt.completions", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/chatgpt.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.ChatGPT.ChatGPTControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.ChatGPT.ChatGPTHandler" + } + ], + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择AI引擎类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "model", + "label": "模型", + "required": false, + "tips": "调用的AI模型版本,请仔细确认价格后切换", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀GPT-3.5", + "value": "gpt35_turbo" + }, + { + "display": "影刀GPT-4.0", + "value": "gpt-4" + } + ] + } + }, + { + "name": "use_knowledge", + "label": "扩展能力", + "required": false, + "tips": "选择知识库,让GPT生成更懂业务的回答", + "type": "bool", + "default": "13:False", + "editor": { + "kind": "checkbox", + "label": "知识库" + } + }, + { + "name": "knowledge", + "label": "知识库", + "required": false, + "tips": "选择知识库,让GPT生成更懂业务的回答", + "type": "str", + "editor": { + "kind": "select" + } + }, + { + "name": "prompt", + "label": "角色定义", + "tips": "定义GPT的角色和回答要求。如:扮演影刀客服,回答要专业", + "type": "str", + "required": false, + "editor": { + "kind": "textbox", + "placeholder": "选填,定义角色与回答要求" + } + }, + { + "name": "question", + "label": "提问", + "tips": "最多可输入1600字,请勿包含敏感词", + "type": "str", + "required": true, + "editor": { + "kind": "textbox", + "placeholder": "最多可输入1600字,请勿包含敏感词" + } + }, + { + "name": "maxWords", + "label": "最大回答字数", + "required": false, + "category": "advanced", + "tips": "默认值为 -1,代表不限制", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认不限制" + } + }, + { + "name": "temperature", + "label": "创意性参数", + "required": false, + "category": "advanced", + "tips": "在0-2之间值越高越有创意性", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "选填,范围0-2,默认为1,值越高越有创意性" + } + } + ], + "outputs": [ + { + "id": "chatgpt_result", + "label": "返回结果保存至", + "variableLabel": "gpt文本", + "tips": "指定一个变量,该变量用于保存返回的文本", + "type": "str", + "name": "gpt_result" + } + ] + }, + { + "name": "dynamic.magic", + "icon": "Png/Magic/icon_magicaction2.png", + "statement": "programing.empty", + "description": "通过文字描述生成处理类指令,包括列表、文本、时间日期、逻辑等", + "comment": "", + "title": "魔法指令", + "function": "", + "helpUrl": "yddoc/language/zh-cn/指令文档/魔法指令/魔法指令说明.html", + "inputs": [], + "outputs": [], + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Magic.MagicHandler" + } + ] + }, + { + "name": "ai.power", + "statement": "ai.power", + "icon": "BlockIcons/ai_power.png", + "description": "在影刀中调用并执行AI Power应用,增强AI自动化的场景与能力", + "comment": "执行AI应用%flowId%,将结果保存到%ai_power_result%", + "title": "AI应用", + "keywords": "", + "function": "xbot_visual.chatgpt.ai_power", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能AI/AI应用.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.AIPower.AIPowerControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.AIPower.AIPowerBlockHandler" + } + ], + "inputs": [ + { + "name": "flowId", + "label": "选择应用", + "required": true, + "tips": "从“我的AI应用”列表中选择一个应用", + "type": "str", + "editor": { + "kind": "select" + } + }, + { + "name": "inputs", + "label": "输入参数", + "required": false, + "tips": "输入参数列表", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "outputs", + "label": "输出参数", + "required": false, + "tips": "输出参数列表", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "ai_power_result", + "label": "输出结果保存至", + "tips": "", + "name": "ai_power_result", + "type": "dict" + } + ] + } + ] +} diff --git a/src/assert/block_settings/clipboard.blocks.json b/src/assert/block_settings/clipboard.blocks.json new file mode 100644 index 0000000..4918a37 --- /dev/null +++ b/src/assert/block_settings/clipboard.blocks.json @@ -0,0 +1,83 @@ +{ + "types": [], + "blocks": [ + { + "name": "clipboard.get_text", + "function": "xbot_visual.win32.clipboard_get_text", + "title": "获取剪切板文本", + "keywords": "剪贴板", + "description": "这个指令用来获取剪切板文本内容", + "comment": "获取剪切板中的文本内容,将结果保存到%clipboard_text%", + "icon": "BlockIcons/24-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/剪切板/获取剪切板内容.html", + "outputs": [ + { + "id": "clipboard_text", + "label": "保存剪切板文本至", + "variableLabel": "剪切板文本", + "tips": "获取剪切板中文本内容", + "type": "str", + "name": "clipboard_text" + } + ] + }, + { + "name": "clipboard.set_text", + "function": "xbot_visual.win32.clipboard_set_text", + "title": "设置剪切板内容", + "keywords": "剪贴板", + "description": "这个指令用来设置剪切板内容", + "comment": "将内容源%text%设置到剪切板中", + "icon": "BlockIcons/24-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/剪切板/设置剪切板内容.html", + "inputs": [ + { + "name": "text", + "label": "内容源", + "required": true, + "tips": "请输入要设置到剪切板中的文本内容", + "type": "str", + "editor": { + "kind": "memoedit" + } + } + ] + }, + { + "name": "clipboard.clear", + "function": "xbot_visual.win32.clipboard_clear", + "title": "清空剪切板", + "keywords": "剪贴板", + "description": "这个指令用来清空剪切板内容", + "comment": "清空当前剪切板中的内容", + "icon": "BlockIcons/24-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/剪切板/清空剪切板.html" + }, + { + "name": "clipboard.set_file", + "function": "xbot_visual.win32.clipboard_set_file", + "title": "将文件添加到剪切板", + "keywords": "剪贴板", + "description": "这个指令用来将文件添加到剪切板中,可用于文件的快捷发送", + "comment": "将文件%file_path%添加到剪切板中", + "icon": "BlockIcons/24-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/剪切板/将文件添加到剪切板.html", + "inputs": [ + { + "name": "file_path", + "label": "文件路径", + "required": true, + "tips": "请输入资源文件名或文件名列表", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件(.*)|*.*" + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/code.template.py b/src/assert/block_settings/code.template.py new file mode 100644 index 0000000..86f9e3c --- /dev/null +++ b/src/assert/block_settings/code.template.py @@ -0,0 +1,13 @@ +# 使用提醒: +# 1. xbot包提供软件自动化、数据表格、Excel、日志、AI等功能 +# 2. package包提供访问当前应用数据的功能,如获取元素、访问全局变量、获取资源文件等功能 +# 3. 当此模块作为流程独立运行时执行main函数 +# 4. 可视化流程中可以通过"调用模块"的指令使用此模块 + +import xbot +from xbot import print, sleep +from .import package +from .package import variables as glv + +def main(args): + pass \ No newline at end of file diff --git a/src/assert/block_settings/csv.blocks.json b/src/assert/block_settings/csv.blocks.json new file mode 100644 index 0000000..ddbf0ce --- /dev/null +++ b/src/assert/block_settings/csv.blocks.json @@ -0,0 +1,176 @@ +{ + "types": [], + "blocks": [ + { + "name": "csv.read", + "function": "xbot_visual.csv.read", + "title": "读取CSV数据", + "description": "读取CSV数据", + "comment": "读取%csv_path%文件,并将读取结果保存到%row_values%", + "icon": "BlockIcons/29-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/csv读写/读取csv数据.html", + "inputs": [ + { + "name": "csv_path", + "label": "CSV文件路径", + "required": true, + "tips": "输入CSV文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "CSV文件 (.csv)|*.csv" + } + } + }, + { + "name": "encoding", + "label": "文件编码", + "required": true, + "default": "10:UTF-8", + "defaultDisplay": "UTF-8", + "tips": "选择文本编码格式,UTF-8-SIG为带有 BOM 的 UTF-8", + "type": "str", + "editor": { + "kind": "editselect", + "options": [ + "ANSI", + "UTF-8", + "UTF-8-SIG" + ] + } + }, + { + "name": "delimiter", + "label": "内容分隔符", + "required": false, + "tips": "选择内容分隔符,默认为逗号", + "type": "str", + "defaultDisplay": "逗号", + "editor": { + "kind": "select", + "options": [ + { + "display": "逗号", + "value": "," + }, + { + "display": "分号", + "value": ";" + }, + { + "display": "冒号", + "value": ":" + }, + { + "display": "空格", + "value": " " + }, + { + "display": "Tab键", + "value": "\t" + } + ] + } + }, + { + "name": "first_row_is_header", + "label": "", + "required": true, + "tips": "CSV文件首行是否是列头", + "type": "bool", + "default": "13:False", + "editor": { + "label": "首行是列头", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "row_values", + "label": "保存行数据至", + "variableLabel": "CSV数据", + "tips": "输入一个名字,用来保存读取的行数据", + "type": "list>", + "name": "row_values" + } + ] + }, + { + "name": "csv.write", + "function": "xbot_visual.csv.write", + "title": "数据写入CSV", + "description": "数据写入CSV", + "comment": "将%values%通过%write_way%方式写入到%csv_path%", + "icon": "BlockIcons/29-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/csv读写/数据写入csv.html", + "inputs": [ + { + "name": "csv_path", + "label": "CSV文件路径", + "required": true, + "tips": "输入CSV文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "CSV文件 (.csv)|*.csv" + } + } + }, + { + "name": "encoding", + "label": "文件编码", + "required": true, + "default": "10:UTF-8", + "defaultDisplay": "UTF-8", + "tips": "选择文本编码格式", + "type": "str", + "editor": { + "kind": "editselect", + "options": [ + "ANSI", + "UTF-8", + "UTF-8-SIG" + ] + } + }, + { + "name": "write_way", + "label": "写入方式", + "required": true, + "default": "10:overwrite", + "defaultDisplay": "覆盖写入", + "tips": "选择写入方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "追加写入", + "value": "append" + }, + { + "display": "覆盖写入", + "value": "overwrite" + } + ] + } + }, + { + "name": "values", + "label": "行数据", + "required": true, + "tips": "输入待写入CSV文件的行数据", + "type": "list>", + "editor": { + "kind": "textbox" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/database.blocks.json b/src/assert/block_settings/database.blocks.json new file mode 100644 index 0000000..e061d8a --- /dev/null +++ b/src/assert/block_settings/database.blocks.json @@ -0,0 +1,250 @@ +{ + "types": [ + { + "name": "xbot.database", + "localName": "数据库连接", + "pythonName": "xbot.ado.Database", + "props": [] + } + ], + "blocks": [ + { + "name": "database.connect", + "icon": "BlockIcons/25-1.png", + "description": "使用数据库连接字符串连接到数据库", + "comment": "使用%conn_str%数据库连接字符串创建数据库连接对象,并保存到%database%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Database.ConnectControl, ShadowBot.Shell.Development", + "title": "连接数据库", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/数据库/连接数据库.html", + "function": "xbot_visual.database.connect", + "inputs": [ + { + "name": "conn_str", + "label": "连接字符串", + "required": true, + "tips": "输入数据库连接字符串", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "Custom" + } + } + } + ], + "outputs": [ + { + "id": "database", + "label": "保存数据库连接对象至", + "variableLabel": "数据库连接", + "tips": "指定一个变量名称,该变量用于存储数据库连接对象", + "type": "xbot.database", + "name": "database" + } + ] + }, + { + "name": "database.close", + "icon": "BlockIcons/25-3.png", + "description": "关闭数据库", + "comment": "关闭数据库连接%database%", + "title": "关闭数据库", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/数据库/关闭数据库.html", + "function": "xbot_visual.database.close", + "inputs": [ + { + "name": "database", + "label": "数据库连接对象", + "required": true, + "tips": "输入数据库连接对象", + "type": "xbot.database", + "editor": { + "kind": "select", + "useVariableOptions": true + } + } + ] + }, + { + "name": "database.exec", + "icon": "BlockIcons/25-2.png", + "description": "在指定数据库中,执行Insert、Update、Delete、Select等SQL语句", + "comment": "在%database%中执行SQL:%sql%,结果保存到%recordset%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Database.ExecControl, ShadowBot.Shell.Development", + "title": "执行SQL语句", + "keywords": "查询;修改;删除;插入;Insert;Update;Delete;Select", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/数据库/查询数据库.html", + "function": "xbot_visual.database.exec", + "inputs": [ + { + "name": "connect_way", + "label": "连接方式", + "required": true, + "default": "10:database", + "defaultDisplay": "数据库连接对象", + "tips": "选择一个数据库连接方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "数据库连接对象", + "value": "database" + }, + { + "display": "数据库连接字符串", + "value": "conn_str" + } + ] + } + }, + { + "name": "database", + "label": "数据库连接对象", + "required": false, + "tips": "选择数据库连接对象", + "type": "xbot.database", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "conn_str", + "label": "数据库连接字符串", + "required": false, + "tips": "请输入数据库连接字符串", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "Custom" + } + } + }, + { + "name": "sql", + "label": "数据库查询语句", + "required": true, + "tips": "请输入数据库查询语句", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "timeout_seconds", + "label": "超时秒数", + "required": true, + "tips": "请输入数据库查询超时秒数", + "type": "int", + "default": "10:30", + "editor": { + "kind": "textbox" + } + }, + { + "name": "result_toString", + "label": "", + "category": "advanced", + "type": "bool", + "tips": "若勾选,查询结果的每一个值会转成文本格式输出,否则保留原格式输出", + "default": "13:True", + "editor": { + "label": "以文本格式输出", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "recordset", + "label": "保存查询结果至", + "variableLabel": "数据库查询结果", + "tips": "指定一个变量名称,该变量用于存储数据库查询结果", + "type": "list>", + "name": "recordset" + } + ] + }, + { + "name": "database.batch_insert", + "icon": "BlockIcons/25-4.png", + "description": "将多组数据一次性插入到一张表中,结果为全部正确或全部失败", + "comment": "在%database%中执行批量插入%sql%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Database.BatchInsertControl, ShadowBot.Shell.Development", + "title": "数据库批量插入数据", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/数据库/数据库批量插入数据.html", + "function": "xbot_visual.database.batch_insert", + "inputs": [ + { + "name": "connect_way", + "label": "连接方式", + "required": true, + "default": "10:database", + "defaultDisplay": "数据库连接对象", + "tips": "选择一个数据库连接方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "数据库连接对象", + "value": "database" + }, + { + "display": "数据库连接字符串", + "value": "conn_str" + } + ] + } + }, + { + "name": "database", + "label": "数据库连接对象", + "required": false, + "tips": "选择数据库连接对象", + "type": "xbot.database", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "conn_str", + "label": "数据库连接字符串", + "required": false, + "tips": "请输入数据库连接字符串", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "Custom" + } + } + }, + { + "name": "sql", + "label": "数据库插入语句", + "required": true, + "tips": "请输入数据库插入语句", + "type": "str", + "editor": { + "kind": "memoedit", + "placeholder": "例:INSERT INTO `test` 或 INSERT INTO `test` (`id`, `name`)" + } + }, + { + "name": "data", + "label": "待插入数据", + "required": true, + "tips": "请输入需要批量插入的数据,格式为二维列表", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/datetime.blocks.json b/src/assert/block_settings/datetime.blocks.json new file mode 100644 index 0000000..36c4e50 --- /dev/null +++ b/src/assert/block_settings/datetime.blocks.json @@ -0,0 +1,583 @@ +{ + "types": [ + { + "name": "xbot_visual.datetime.DateTimeParts", + "localName": "日期时间详情", + "props": [ + { + "name": "year", + "type": "int", + "label": "年份" + }, + { + "name": "month", + "type": "int", + "label": "月份" + }, + { + "name": "day", + "type": "int", + "label": "天数" + }, + { + "name": "hour", + "type": "int", + "label": "小时" + }, + { + "name": "minute", + "type": "int", + "label": "分钟" + }, + { + "name": "second", + "type": "int", + "label": "秒数" + }, + { + "name": "weekday", + "type": "int", + "label": "星期" + }, + { + "name": "lastday_of_month", + "type": "int", + "label": "当月最后一天" + }, + { + "name": "week_of_year", + "type": "int", + "label": "当年第几周" + }, + { + "name": "day_of_year", + "type": "int", + "label": "当年第几天" + } + ] + } + ], + "blocks": [ + { + "name": "datetime.now", + "function": "xbot_visual.datetime.now", + "title": "获取当前日期时间", + "description": "获取当前日期时间", + "comment": "获取当前日期时间,将结果保存到%datetime_instance%", + "icon": "BlockIcons/17-4.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/日期时间/获取当前时间.html", + "outputs": [ + { + "id": "datetime_instance", + "label": "保存当前日期时间至", + "variableLabel": "当前的日期时间对象", + "tips": "输入一个变量,用来保存当前日期时间", + "type": "datetime", + "name": "current_datetime" + } + ] + }, + { + "name": "datetime.difference", + "function": "xbot_visual.datetime.difference", + "title": "获取时间间隔", + "description": "获取时间间隔", + "comment": "获取%begin_datetime%到%end_datetime%间隔的%unit%数,将结果保存至%datetime_difference%", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Datetime.DifferenceHandler" + } + ], + "icon": "BlockIcons/17-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/日期时间/获取时间间隔.html", + "inputs": [ + { + "name": "begin_datetime", + "label": "开始时间", + "required": false, + "tips": "输入开始时间。若日期是文本,只支持常用格式,如:2020-02-02、2020/02/02 02:02:02、2020年2月2日 2时2分2秒等", + "type": "any", + "editor": { + "kind": "textbox", + "placeholder": "日期时间对象或文本。若空,则为系统的当前时间" + } + }, + { + "name": "end_datetime", + "label": "结束时间", + "required": false, + "tips": "输入结束时间。若日期是文本,只支持常用格式,如:2020-02-02、2020/02/02 02:02:02、2020年2月2日 2时2分2秒等", + "type": "datetime", + "editor": { + "kind": "textbox", + "placeholder": "日期时间对象或文本。若空,则为系统的当前时间" + } + }, + { + "name": "unit", + "label": "时间间隔单位", + "required": true, + "default": "10:second", + "defaultDisplay": "秒", + "tips": "选择时间间隔的时间单位", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "秒", + "value": "second" + }, + { + "display": "分钟", + "value": "minute" + }, + { + "display": "小时", + "value": "hour" + }, + { + "display": "天", + "value": "day" + } + ] + } + } + ], + "outputs": [ + { + "id": "datetime_difference", + "label": "保存时间间隔至", + "variableLabel": "时间间隔", + "tips": "输入一个变量,用来保存时间间隔", + "type": "int", + "name": "datetime_difference" + } + ] + }, + { + "name": "datetime.add", + "function": "xbot_visual.datetime.add", + "title": "增加/减少时间", + "description": "在指定日期时间上进行时间增加或者减少,支持文本格式的日期", + "comment": "将%datetime%%timeway%%duration%%unit%,将结果保存到%datetime_instance%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Datetime.AddControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Datetime.AddHandler" + } + ], + "icon": "BlockIcons/17-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/日期时间/增加时间.html", + "inputs": [ + { + "name": "datetime", + "label": "原日期时间", + "required": false, + "tips": "输入日期时间。若日期是文本,只支持常用格式,如: 2020-02-02、2020/02/02 02:02:02、2020年2月2日 2时2分2秒等", + "type": "any", + "editor": { + "kind": "textbox", + "placeholder": "日期时间对象或文本。若空,为系统的当前时间" + } + }, + { + "name": "timeway", + "label": "调整方式", + "required": true, + "default": "10:increase", + "defaultDisplay": "增加", + "tips": "选择增加时间或者减少时间", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "增加", + "value": "increase" + }, + { + "display": "减少", + "value": "decrease" + } + ] + } + }, + { + "name": "duration", + "label": "时间长度", + "required": true, + "tips": "输入时间长度", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "unit", + "label": "时间单位", + "required": true, + "default": "10:second", + "defaultDisplay": "秒", + "tips": "选择时间单位", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "秒", + "value": "second" + }, + { + "display": "分钟", + "value": "minute" + }, + { + "display": "小时", + "value": "hour" + }, + { + "display": "天", + "value": "day" + }, + { + "display": "月", + "value": "month" + }, + { + "display": "年", + "value": "year" + } + ] + } + }, + { + "name": "output_text", + "label": "", + "required": false, + "default": "13:False", + "tips": "若勾选,指明该指令的输出为新日期的文本格式,否则为日期时间对象", + "type": "bool", + "editor": { + "label": "输出日期时间的文本", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "datetime_instance", + "label": "保存新的日期时间至", + "variableLabel": "更改时间后的日期时间对象", + "tips": "输入一个名字,用来保存更改后的日期时间", + "type": "datetime", + "name": "datetime_instance" + }, + { + "id": "datetime_text", + "label": "保存新的日期文本至", + "variableLabel": "更改时间后的日期时间文本", + "tips": "输入一个名字,用来保存更改后的日期时间的文本", + "type": "str", + "name": "datetime_text" + } + ] + }, + { + "name": "datetime.from_string", + "function": "xbot_visual.datetime.from_string", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Datetime.FromStringControl, ShadowBot.Shell.Development", + "title": "转换到日期时间", + "keywords": "文本转换", + "description": "将文本转换成日期时间,默认采用%Y-%m-%d的时间格式", + "comment": "将%text%按%format%格式转换成日期时间,并将结果保存到%datetime_instance%", + "icon": "BlockIcons/17-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/日期时间/转换到日期时间.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Datetime.FromStringHandler" + } + ], + "inputs": [ + { + "name": "text", + "label": "文本", + "required": true, + "tips": "输入待转换到日期时间的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_custom_format", + "label": "", + "required": true, + "tips": "是否使用自定义格式", + "type": "bool", + "default": "13:False", + "editor": { + "label": "使用自定义格式", + "kind": "checkbox" + } + }, + { + "name": "format", + "label": "时间格式", + "required": false, + "tips": "设置待转换文本的日期时间格式。自定义的时间格式请参考Python日期时间相关文档。", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "datetime_instance", + "label": "保存日期时间至", + "variableLabel": "文本转换后的日期时间对象", + "tips": "输入一个名字,用来保存转换后的日期时间", + "type": "datetime", + "name": "datetime_instance" + } + ] + }, + { + "name": "datetime.to_string", + "function": "xbot_visual.datetime.to_string", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Datetime.ToStringControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Datetime.ToStringHandler" + } + ], + "title": "日期时间转换为文本", + "keywords": "星期;格式化", + "description": "将日期时间转换到文本", + "comment": "将%datetime%按%format%格式转换成文本,将结果保存到%text%", + "icon": "BlockIcons/17-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/日期时间/时间转换到文本.html", + "inputs": [ + { + "name": "datetime", + "label": "日期时间", + "required": false, + "tips": "输入待转换日期。若日期是文本,只支持常用格式,如: 2020-02-02、2020/02/02 02:02:02、2020年2月2日 2时2分2秒等", + "type": "any", + "editor": { + "kind": "textbox", + "placeholder": "日期时间对象或文本。若空,为系统的当前时间" + } + }, + { + "name": "format", + "label": "时间格式", + "required": true, + "tips": "设置待转换文本的日期时间格式。自定义的时间格式请参考Python日期时间相关文档。", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "text", + "label": "保存文本至", + "variableLabel": "日期时间转换后的文本", + "tips": "输入一个名字,用来保存转换后的文本", + "type": "str", + "name": "text" + } + ] + }, + { + "name": "datetime.get_parts", + "function": "xbot_visual.datetime.get_parts", + "title": "获取时间详细信息", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Datetime.DetailHandler" + } + ], + "keywords": "日期时间;年月日时分秒;星期;当月最后一天;当年第几周;当年第几天", + "description": "获取日期时间的年、月、日、时、分、秒、星期、当月最后一天、当年第几周、当年第几天", + "comment": "获取%datetime%的时间详细信息,将结果保存到%datetime_parts%", + "icon": "BlockIcons/17-6.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/日期时间/获取时间详细信息.html", + "inputs": [ + { + "name": "datetime", + "label": "日期时间", + "required": false, + "tips": "输入日期时间。若日期是文本,只支持常用格式,如: 2020-02-02、2020/02/02 02:02:02、2020年2月2日 2时2分2秒等", + "type": "any", + "editor": { + "kind": "textbox", + "placeholder": "日期时间对象或文本。若空,为系统的当前时间" + } + } + ], + "outputs": [ + { + "id": "datetime_parts", + "label": "保存日期时间数据至", + "variableLabel": "时间的详情数据", + "tips": "输入一个名字,用来保存获得的年月日时分秒数据", + "required": true, + "type": "xbot_visual.datetime.DateTimeParts", + "name": "datetime_parts" + } + ] + }, + { + "name": "datetime.to_timestamp", + "function": "xbot_visual.datetime.to_timestamp", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Datetime.ToTimestampControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Datetime.ToTimestampHandler" + } + ], + "title": "日期时间转换为时间戳", + "keywords": "星期;格式化", + "description": "将日期时间转换为时间戳", + "comment": "将%datetime%转换成%timestamp_level%时间戳,将结果保存到%timestamp%", + "icon": "BlockIcons/17-7.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/日期时间/日期时间转换为时间戳.html", + "inputs": [ + { + "name": "datetime", + "label": "日期时间", + "required": false, + "tips": "输入待转换日期。若日期是文本,只支持常用格式,如: 2020-02-02、2020/02/02 02:02:02、2020年2月2日 2时2分2秒等", + "type": "any", + "editor": { + "kind": "textbox", + "placeholder": "日期时间对象或文本。若空,为系统的当前时间" + } + }, + { + "name": "timestamp_level", + "label": "时间戳级别", + "required": true, + "default": "10:second", + "defaultDisplay": "秒级", + "tips": "选择时间戳级别,分别为秒级,毫秒级,微秒级", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "秒级", + "value": "second" + }, + { + "display": "毫秒级", + "value": "millisecond" + }, + { + "display": "微秒级", + "value": "microsecond" + } + ] + } + } + ], + "outputs": [ + { + "id": "timestamp", + "label": "保存时间戳至", + "variableLabel": "日期时间转换后的时间戳", + "tips": "输入一个变量名,用来保存转换后的时间戳", + "type": "str", + "name": "timestamp" + } + ] + }, + { + "name": "datetime.from_timestamp", + "function": "xbot_visual.datetime.from_timestamp", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Datetime.FromTimestampControl, ShadowBot.Shell.Development", + "title": "时间戳转换为日期时间", + "description": "将时间戳转换为日期时间,默认采用秒级时间戳", + "comment": "将%timestamp%按%timestamp_level%时间戳转换成日期时间,将结果保存到%datetime_instance%", + "icon": "BlockIcons/17-8.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/日期时间/时间戳转换为日期时间.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Datetime.FromTimestampHandler" + } + ], + "inputs": [ + { + "name": "timestamp", + "label": "时间戳", + "required": true, + "tips": "输入待转换到日期时间的时间戳", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timestamp_level", + "label": "时间戳级别", + "required": true, + "default": "10:second", + "defaultDisplay": "秒级", + "tips": "选择时间戳级别,分别为秒级,毫秒级,微秒级", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "秒级", + "value": "second" + }, + { + "display": "毫秒级", + "value": "millisecond" + }, + { + "display": "微秒级", + "value": "microsecond" + } + ] + } + }, + { + "name": "output_text", + "label": "", + "required": false, + "default": "13:False", + "tips": "若勾选,指明该指令的输出为日期时间文本格式(采用默认格式%Y-%m-%d %H:%M:%S),否则为日期时间对象", + "type": "bool", + "editor": { + "label": "输出日期时间的文本", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "datetime_instance", + "label": "保存日期时间至", + "variableLabel": "时间戳转换后的日期时间对象", + "tips": "输入一个变量名,用来保存转换后的日期时间", + "type": "datetime", + "name": "datetime_instance" + }, + { + "id": "datetime_text", + "label": "保存日期文本至", + "variableLabel": "时间戳转换后的日期时间文本", + "tips": "输入一个变量名,用来保存转换后的日期时间的文本", + "type": "str", + "name": "datetime_text" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/dialog.blocks.json b/src/assert/block_settings/dialog.blocks.json new file mode 100644 index 0000000..80c25e4 --- /dev/null +++ b/src/assert/block_settings/dialog.blocks.json @@ -0,0 +1,926 @@ +{ + "types": [], + "blocks": [ + { + "name": "dialog.show_alert", + "icon": "BlockIcons/11-1.png", + "description": "打开消息对话框", + "comment": "打开消息对话框%message%", + "title": "打开消息对话框", + "function": "xbot_visual.dialog.show_alert", + "inputs": [ + { + "name": "title", + "label": "对话框标题", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "message", + "label": "对话框内容", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "dialog.show_confirm", + "icon": "BlockIcons/11-2.png", + "description": "打开确认对话框", + "comment": "打开确认对话框%message%", + "title": "打开确认对话框", + "function": "xbot_visual.dialog.show_confirm", + "inputs": [ + { + "name": "title", + "label": "对话框标题", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "message", + "label": "对话框内容", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "confirm_result", + "label": "确认结果", + "tips": "指定一个变量名称,该变量用于保存确认结果,bool类型", + "name": "confirm_result", + "type": "bool" + } + ] + }, + { + "name": "dialog.show_custom_message_box", + "icon": "BlockIcons/11-2.png", + "description": "打开信息对话框", + "comment": "打开信息对话框%message%,将点击按钮名保存到%button_result%", + "title": "打开信息对话框", + "helpUrl": "yddoc/language/zh-cn/指令文档/对话框/打开信息对话框.html", + "video": { + "time": "05:32" + }, + "function": "xbot_visual.dialog.show_message_box", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.MessageBox.CustomMessageBox, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dialog.ShowCustomMessageBoxHandler" + } + ], + "inputs": [ + { + "name": "title", + "label": "对话框标题", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "message", + "label": "对话框内容", + "required": true, + "type": "str", + "editor": { + "kind": "memoEdit" + } + }, + { + "name": "buttons", + "label": "对话框按钮", + "required": true, + "default": "10:确定", + "defaultDisplay": "确定", + "tips": "选择对话框按钮", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "确定", + "value": "确定" + }, + { + "display": "是-否", + "value": "是|否" + }, + { + "display": "确定-取消", + "value": "确定|取消" + }, + { + "display": "是-否-取消", + "value": "是|否|取消" + } + ] + } + }, + { + "name": "default_button", + "label": "默认选中按钮", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "use_wait_timeout", + "label": "", + "required": false, + "tips": "当对话框超过设定时间没有点击按钮时,自动点击默认按钮", + "type": "bool", + "default": "13:False", + "editor": { + "label": "超时自动点击默认按钮", + "kind": "checkbox" + } + }, + { + "name": "wait_seconds", + "label": "超时秒数", + "required": false, + "tips": "设置对话框在没有用户点击时,自动关闭的超时秒数", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "button_result", + "label": "按钮名称", + "tips": "指定一个变量名称,该变量用于保存点击的按钮名称", + "variableLabel": "按钮名称", + "name": "pressed_button", + "type": "str" + } + ] + }, + { + "name": "dialog.show_custom_dialog", + "icon": "BlockIcons/11-3.png", + "description": "打开自定义对话框", + "comment": "打开自定义对话框,将输入结果保存到%dialog_result%", + "title": "打开自定义对话框", + "helpUrl": "yddoc/language/zh-cn/指令文档/对话框/打开自定义对话框.html", + "video": { + "time": "08:39" + }, + "function": "xbot_visual.dialog.show_custom_dialog", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Dialog.CustomDialogControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dialog.ShowCustomDialogBlockHandler" + } + ], + "inputs": [ + { + "name": "settings", + "label": "对话框配置", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "dialog_title", + "label": "对话框标题", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "default_btn", + "label": "默认选中按钮", + "required": true, + "default": "10:确定", + "defaultDisplay": "确定", + "tips": "超时自动点击时默认点击的按钮", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "确定", + "value": "确定" + }, + { + "display": "取消", + "value": "取消" + } + ] + } + }, + { + "name": "is_auto_click", + "label": "", + "required": false, + "tips": "当对话框超过设定时间没有点击按钮时,自动点击默认按钮", + "type": "bool", + "default": "13:False", + "editor": { + "label": "超时自动点击默认按钮", + "kind": "checkbox" + } + }, + { + "name": "timeout", + "label": "超时秒数", + "required": false, + "tips": "设置对话框在没有用户点击时,自动关闭的超时秒数", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "globals", + "label": "全局变量集合", + "default": "13:globals()", + "type": "dict", + "editor": { + "kind": "textbox" + } + }, + { + "name": "locals", + "label": "局部变量集合", + "default": "13:locals()", + "type": "dict", + "editor": { + "kind": "textbox" + } + }, + { + "name": "storage_key", + "label": "指令ID", + "default": "13:`block_id`", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "dialog_result", + "label": "保存用户输入结果至", + "tips": "指定一个变量名称,该变量用于保存用户输入结果,如果用户取消对话框则返回None否则返回dict对象", + "name": "dialog_result", + "type": "dict" + } + ] + }, + { + "name": "dialog.show_workbook_dialog", + "icon": "BlockIcons/11-2.png", + "description": "弹出数据表格,可对数据表格进行填写或Excel导入操作", + "comment": "打开标题为%title%的数据表格对话框,将输入结果保存到数据表格中,将点击按钮名保存到%button_result%", + "title": "打开数据表格对话框", + "keywords": "Excel导入", + "helpUrl": "yddoc/language/zh-cn/指令文档/对话框/打开数据表格对话框.html", + "video": { + "time": "02:49" + }, + "function": "xbot_visual.dialog.show_workbook_dialog", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.MessageBox.DataBookDialog, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "title", + "label": "对话框标题", + "tips": "对话框的标题", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "message", + "label": "提示说明", + "tips": "为数据表格的使用方法进行说明,让使用者更加容易理解", + "type": "str", + "editor": { + "kind": "memoEdit" + } + } + ], + "outputs": [ + { + "id": "button_result", + "label": "按钮名称", + "tips": "指定一个变量名称,该变量用于保存点击的按钮名称", + "variableLabel": "按钮名称", + "name": "pressed_button", + "type": "str" + } + ] + }, + { + "name": "dialog.show_input_dialog", + "icon": "BlockIcons/11-4.png", + "description": "打开输入对话框", + "comment": "打开标题为%title%的输入对话框,将输入结果保存到%input_dialog%", + "title": "打开输入对话框", + "helpUrl": "yddoc/language/zh-cn/指令文档/对话框/打开输入对话框.html", + "function": "xbot_visual.dialog.show_input_dialog", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.MessageBox.InputDialog, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dialog.ShowInputDialogBlockHandler" + } + ], + "inputs": [ + { + "name": "title", + "label": "对话框标题", + "tips": "对话框标题", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "label", + "label": "对话框说明", + "tips": "对话框说明", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "type", + "label": "输入框类型", + "tips": "输入框类型", + "required": true, + "type": "str", + "default": "10:input", + "defaultDisplay": "文本框", + "editor": { + "kind": "select", + "options": [ + { + "display": "文本框", + "value": "input" + }, + { + "display": "密码框", + "value": "password" + }, + { + "display": "多行文本框", + "value": "multiInput" + } + ] + } + }, + { + "name": "value", + "label": "默认值", + "tips": "默认值", + "type": "str", + "category": "advanced", + "editor": { + "kind": "textbox" + } + }, + { + "name": "storage_key", + "label": "指令ID", + "default": "13:`block_id`", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "input_dialog", + "label": "保存用户输入结果至", + "tips": "指定一个变量名称,该变量用于保存用户输入结果,如果用户取消对话框则返回None否则返回dict对象", + "name": "input_dialog", + "type": "dict" + } + ] + }, + { + "name": "dialog.show_datetime_dialog", + "icon": "BlockIcons/11-5.png", + "description": "打开日期时间对话框", + "comment": "打开标题为%title%的日期时间对话框,将输入的日期时间保存到%datetime_dialog%", + "title": "打开日期时间对话框", + "helpUrl": "yddoc/language/zh-cn/指令文档/对话框/打开日期时间对话框.html", + "function": "xbot_visual.dialog.show_datetime_dialog", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.MessageBox.DatetimeDialog, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dialog.ShowDateTimeDialogBlockHandler" + } + ], + "inputs": [ + { + "name": "title", + "tips": "对话框标题", + "label": "对话框标题", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "label", + "label": "对话框说明", + "tips": "对话框说明", + "type": "str", + "category": "advanced", + "editor": { + "kind": "textbox" + } + }, + { + "name": "kind", + "tips": "时间类型", + "label": "时间类型", + "required": true, + "default": "10:date", + "defaultDisplay": "时间", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "时间", + "value": "date" + }, + { + "display": "时间段", + "value": "dateRange" + } + ] + } + }, + { + "name": "format", + "label": "时间格式", + "tips": "时间格式", + "required": true, + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "value": "yyyy-MM-dd", + "display": "年-月-日" + }, + { + "value": "yyyy-MM-dd HH:mm:ss", + "display": "年-月-日 时:分:秒" + }, + { + "value": "yyyy/MM/dd", + "display": "年/月/日" + }, + { + "value": "yyyy/MM/dd HH:mm:ss", + "display": "年/月/日 时:分:秒" + }, + { + "value": "MM-dd-yyyy", + "display": "月-日-年" + }, + { + "value": "MM-dd-yyyy HH:mm:ss", + "display": "月-日-年 时:分:秒" + }, + { + "value": "MM/dd/yyyy", + "display": "月/日/年" + }, + { + "value": "MM/dd/yyyy HH:mm:ss", + "display": "月/日/年 时:分:秒" + } + ] + } + }, + { + "name": "begin_date", + "label": "默认时间", + "tips": "如果输入的数据无法转为时间格式则取当前时间日期", + "type": "datetime", + "editor": { + "kind": "textbox" + } + }, + { + "name": "end_date", + "label": "结束时间", + "tips": "如果输入的数据无法转为时间格式则取当前时间日期", + "type": "datetime", + "editor": { + "kind": "textbox" + } + }, + { + "name": "storage_key", + "label": "指令ID", + "default": "13:`block_id`", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "datetime_dialog", + "label": "保存时间设置结果至", + "tips": "指定一个变量名称,该变量用于保存时间设置结果,如果用户取消对话框则返回None否则返回dict对象", + "name": "datetime_dialog", + "type": "dict" + } + ] + }, + { + "name": "dialog.show_select_dialog", + "icon": "BlockIcons/11-6.png", + "description": "打开选择对话框", + "comment": "打开标题为%title%的%select_model%对话框,将选择结果保存到%select_dialog%", + "title": "打开选择对话框", + "helpUrl": "yddoc/language/zh-cn/指令文档/对话框/打开选择对话框.html", + "function": "xbot_visual.dialog.show_select_dialog", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.MessageBox.SelectDialog, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dialog.ShowSelectDialogBlockHandler" + } + ], + "inputs": [ + { + "name": "title", + "label": "对话框标题", + "tips": "对话框标题", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "label", + "label": "对话框说明", + "tips": "对话框说明", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "select_type", + "label": "选择框类型", + "tips": "选择框类型", + "required": true, + "default": "10:combobox", + "defaultDisplay": "下拉框", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "下拉框", + "value": "combobox" + }, + { + "display": "列表", + "value": "list" + } + ] + } + }, + { + "name": "select_model", + "label": "选择模式", + "tips": "选择模式", + "required": true, + "default": "10:single", + "defaultDisplay": "单选", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单选", + "value": "single" + }, + { + "display": "多选", + "value": "multi" + } + ] + } + }, + { + "name": "values", + "label": "选项列表", + "tips": "选项列表,每行代表一个选项", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "is_selected_first", + "label": "", + "tips": "默认选中第一项", + "required": true, + "default": "13:True", + "type": "bool", + "editor": { + "kind": "checkbox", + "label": "默认选中第一项" + } + }, + { + "name": "storage_key", + "label": "指令ID", + "default": "13:`block_id`", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "select_dialog", + "label": "保存用户选择结果至", + "tips": "指定一个变量名称,该变量用于保存用户选择结果,如果用户取消对话框则返回None否则返回dict对象", + "name": "select_dialog", + "type": "dict" + } + ] + }, + { + "name": "dialog.show_select_file_dialog", + "icon": "BlockIcons/11-7.png", + "description": "打开选择文件对话框", + "comment": "打开标题为%title%的选择文件对话框,将文件路径保存到%select_file_dialog%", + "title": "打开选择文件对话框", + "helpUrl": "yddoc/language/zh-cn/指令文档/对话框/打开选择文件对话框.html", + "function": "xbot_visual.dialog.show_select_file_dialog", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dialog.ShowSelectFileBlockHandler" + } + ], + "inputs": [ + { + "name": "title", + "label": "对话框标题", + "tips": "对话框标题", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "folder", + "label": "默认文件夹", + "tips": "默认打开的文件夹路径", + "type": "str", + "category": "advanced", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "filter", + "label": "文件类型", + "tips": "文件类型", + "default": "10:所有文件 (.*)|*.*", + "type": "str", + "editor": { + "kind": "editselect", + "options": [ + "所有文件|*.*", + "Excel文件|*.xls;*.xlsx", + "Word文件|*.doc;*.docx", + "文本文件|*.txt", + "图像文件|*.png;*.jpg;*.bmp", + "PPT文件|*.ppt;*.pptx", + "压缩文件|*.zip;*.rar" + ] + } + }, + { + "name": "is_multi", + "label": "", + "tips": "允许选择多个文件", + "type": "bool", + "default": "13:False", + "editor": { + "kind": "checkbox", + "label": "允许多选" + } + }, + { + "name": "is_checked_exists", + "label": "", + "tips": "检查文件是否存在", + "type": "bool", + "default": "13:False", + "editor": { + "kind": "checkbox", + "label": "检查文件是否存在" + } + } + ], + "outputs": [ + { + "id": "select_file_dialog", + "label": "保存文件选择结果至", + "tips": "指定一个变量名称,该变量用于保存文件选择结果,如果用户取消对话框则返回None否则返回dict对象", + "name": "select_file_dialog", + "type": "dict" + } + ] + }, + { + "name": "dialog.show_select_folder_dialog", + "icon": "BlockIcons/11-8.png", + "description": "打开选择文件夹对话框", + "comment": "打开标题为%title%的选择文件夹对话框,将文件夹路径保存到%select_folder_dialog%", + "title": "打开选择文件夹对话框", + "helpUrl": "yddoc/language/zh-cn/指令文档/对话框/打开选择文件夹对话框.html", + "function": "xbot_visual.dialog.show_select_folder_dialog", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dialog.ShowSelectFolderBlockHandler" + } + ], + "inputs": [ + { + "name": "title", + "label": "对话框标题", + "tips": "对话框标题", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "folder", + "label": "默认路径", + "tips": "默认打开的文件夹路径", + "type": "str", + "category": "advanced", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + } + ], + "outputs": [ + { + "id": "select_folder_dialog", + "label": "保存文件夹选择结果至", + "tips": "指定一个变量名称,该变量用于保存文件夹选择结果,如果用户取消对话框则返回None否则返回dict对象", + "name": "select_folder_dialog", + "type": "dict" + } + ] + }, + { + "name": "dialog.show_notifycation", + "icon": "BlockIcons/11-5.png", + "description": "打开或关闭消息提示框", + "comment": "在屏幕%placement%打开或关闭%level%信息%message%", + "title": "消息通知", + "keywords": "弹框;消息提示", + "helpUrl": "yddoc/language/zh-cn/指令文档/对话框/消息通知.html", + "function": "xbot_visual.dialog.show_notifycation", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Dialog.NotifycationControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "operation_kind", + "label": "操作", + "default": "10:show", + "defaultDisplay": "打开消息通知", + "tips": "可选择打开消息通知或关闭消息通知", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "打开消息通知", + "value": "show" + }, + { + "display": "关闭消息通知", + "value": "close" + } + ] + } + }, + { + "name": "level", + "label": "消息类型", + "default": "10:info", + "defaultDisplay": "信息", + "tips": "提示框展示的信息的类型,类型有:信息、警告、错误", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "信息", + "value": "info" + }, + { + "display": "警告", + "value": "warning" + }, + { + "display": "错误", + "value": "error" + } + ] + } + }, + { + "name": "placement", + "label": "消息位置", + "default": "10:top", + "defaultDisplay": "顶部", + "tips": "提示框展示时再屏幕上的位置,位置有:顶部、底部、右下", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "顶部", + "value": "top" + }, + { + "display": "底部", + "value": "bottom" + }, + { + "display": "右下角", + "value": "rightBottom" + } + ] + } + }, + { + "name": "message", + "label": "消息内容", + "tips": "提示框要展示给用户的信息", + "type": "str", + "editor": { + "kind": "memoEdit" + } + }, + { + "name": "timeout", + "label": "关闭超时时间(秒)", + "category": "advanced", + "default": "10:3", + "tips": "通知信息展示时长,默认展示3秒", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 1 + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/dictionary.blocks.json b/src/assert/block_settings/dictionary.blocks.json new file mode 100644 index 0000000..1e94745 --- /dev/null +++ b/src/assert/block_settings/dictionary.blocks.json @@ -0,0 +1,239 @@ +{ + "types": [], + "blocks": [ + { + "name": "dictionary.create", + "function": "xbot_visual.dictionary.create", + "title": "新建字典", + "description": "新建空的字典", + "comment": "新建字典,将字典对象保存到%dict_instance%", + "icon": "BlockIcons/28-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/字典操作/新建字典.html", + "outputs": [ + { + "id": "dict_instance", + "label": "保存字典对象至", + "variableLabel": " 新建的字典对象", + "tips": "输入一个名字,用来保存新建的字典", + "type": "dict", + "name": "dict_instance" + } + ] + }, + { + "name": "dictionary.set", + "function": "xbot_visual.dictionary.set", + "title": "设置键值对", + "keywords": "字典", + "description": "这个指令用于在字典中设置一对键值,若键名已存在则修改值", + "comment": "在字典%dict%中设置新的键值对(%key%,%value%)", + "icon": "BlockIcons/28-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/字典操作/设置键值对.html", + "inputs": [ + { + "name": "dict", + "label": "字典", + "required": true, + "tips": "输入字典变量", + "type": "dict", + "editor": { + "kind": "textbox" + } + }, + { + "name": "key", + "label": "键名", + "required": true, + "tips": "输入键名", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "value", + "label": "值", + "required": true, + "tips": "输入键值", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "dictionary.get_value", + "function": "xbot_visual.dictionary.get_value", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Dictionary.GetValueControl, ShadowBot.Shell.Development", + "title": "获取键值", + "keywords": "字典", + "description": "这个指令用于在字典中获取键值", + "comment": "在字典%dict%中获取%key%键的值,将结果保存到%value_instance%", + "icon": "BlockIcons/28-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/字典操作/获取键值.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dictionary.GetValueHandler" + } + ], + "inputs": [ + { + "name": "dict", + "label": "字典", + "required": true, + "tips": "输入字典变量", + "type": "dict", + "editor": { + "kind": "textbox" + } + }, + { + "name": "key", + "label": "键名", + "required": true, + "tips": "输入键名", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "key_not_exist_process_way", + "label": "键不存在时", + "required": true, + "default": "10:raise_error", + "defaultDisplay": "报错", + "tips": "当输入的键不存在时,选择一种处理方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "报错", + "value": "raise_error" + }, + { + "display": "返回默认值", + "value": "return_default_value" + } + ] + } + }, + { + "name": "default_value", + "label": "默认值", + "required": false, + "tips": "输入默认键值", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "value_instance", + "label": "保存键值至", + "variableLabel": "字典的键值", + "tips": "输入一个名字,用来保存查找到的键值", + "type": "any", + "name": "value_instance" + } + ] + }, + { + "name": "dictionary.get_keys", + "function": "xbot_visual.dictionary.get_keys", + "title": "获取字典键名列表", + "description": "这个指令用于在字典中获取键名列表", + "comment": "在字典%dict%中获取键名列表,将结果保存到%key_list%", + "icon": "BlockIcons/28-4.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/字典操作/获取字典键名列表.html", + "inputs": [ + { + "name": "dict", + "label": "字典", + "required": true, + "tips": "输入字典变量", + "type": "dict", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "key_list", + "label": "保存键名列表至", + "variableLabel": "字典键名列表", + "tips": "输入一个名字,用来保存查找到的键名列表", + "type": "list", + "name": "key_list" + } + ] + }, + { + "name": "dictionary.get_values", + "function": "xbot_visual.dictionary.get_values", + "title": "获取字典值列表", + "description": "这个指令用于在字典中获取值列表", + "comment": "在字典%dict%中获取值列表,将结果保存到%value_list%", + "icon": "BlockIcons/28-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/字典操作/获取字典值列表.html", + "inputs": [ + { + "name": "dict", + "label": "字典", + "required": true, + "tips": "输入字典变量", + "type": "dict", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "value_list", + "label": "保存值列表至", + "variableLabel": "字典键值列表", + "tips": "输入一个名字,用来保存查找到的值列表", + "type": "list", + "name": "value_list" + } + ] + }, + { + "name": "dictionary.pop", + "function": "xbot_visual.dictionary.pop", + "title": "删除字典键值对", + "description": "这个指令用于在字典中删除键值对", + "comment": "在字典%dict%中删除键名为%key%的键值对", + "icon": "BlockIcons/28-6.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/字典操作/删除字典键值对.html", + "inputs": [ + { + "name": "dict", + "label": "字典", + "required": true, + "tips": "输入字典变量", + "type": "dict", + "editor": { + "kind": "textbox" + } + }, + { + "name": "key", + "label": "待删除的键名", + "required": true, + "tips": "输入待删除的键名", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/dir.blocks.json b/src/assert/block_settings/dir.blocks.json new file mode 100644 index 0000000..0249d0b --- /dev/null +++ b/src/assert/block_settings/dir.blocks.json @@ -0,0 +1,747 @@ +{ + "types": [], + "blocks": [ + { + "name": "dir.if_exist", + "statement": "workflow.if", + "function": "xbot_visual.dir.if_exist", + "title": "IF 文件夹存在", + "description": "判断文件夹是否存在", + "comment": "如果文件夹%path%%expect_exist%,则执行以下操作", + "indent": "1", + "scope": "1", + "isCondition": true, + "icon": "BlockIcons/19-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/if文件夹存在.html", + "video": { + "time": "00:36" + }, + "inputs": [ + { + "name": "path", + "label": "文件夹路径", + "required": true, + "tips": "输入或选择文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "expect_exist", + "label": "文件夹是否", + "required": true, + "default": "10:exist", + "defaultDisplay": "存在", + "tips": "选择预期的文件夹是否存在", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "存在", + "value": "exist" + }, + { + "display": "不存在", + "value": "no_exist" + } + ] + } + } + ] + }, + { + "name": "dir.make", + "function": "xbot_visual.dir.make", + "title": "创建文件夹", + "description": "创建指定路径的文件夹", + "comment": "创建文件夹%path%", + "icon": "BlockIcons/19-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/创建文件夹.html", + "inputs": [ + { + "name": "path", + "label": "路径", + "required": true, + "tips": "输入或选择文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + } + ] + }, + { + "name": "dir.makedir", + "function": "xbot_visual.dir.makedir", + "title": "创建文件夹", + "description": "创建文件夹", + "comment": "在%parent%下新建文件夹%name%,将新建的文件夹路径保存到%new_folder%", + "icon": "BlockIcons/19-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/创建文件夹.html", + "inputs": [ + { + "name": "parent", + "label": "父文件夹目录", + "required": true, + "tips": "输入或选择要在其中创建新文件夹的文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "name", + "label": "新文件夹名称", + "required": true, + "tips": "要创建的文件夹名称", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "new_folder", + "label": "保存新文件夹路径至", + "variableLabel": "创建的新文件夹路径", + "tips": "输入一个名字,用于保存新建的文件夹路径", + "type": "str", + "name": "new_folder" + } + ] + }, + { + "name": "dir.remove", + "function": "xbot_visual.dir.remove", + "title": "删除文件夹", + "description": "删除文件夹,包括该文件夹下所有的子文件和文件", + "comment": "删除文件夹%path%", + "icon": "BlockIcons/19-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/删除文件夹.html", + "inputs": [ + { + "name": "path", + "label": "要删除的文件夹", + "required": true, + "tips": "输入或选择要删除的文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + } + ] + }, + { + "name": "dir.find_files", + "function": "xbot_visual.dir.find_files", + "title": "获取文件列表", + "keywords": "检索文件", + "description": "在文件夹中检索文件", + "comment": "获取文件夹%path%下符合%patterns%命名规则的文件列表,将文件列表保存到%file_paths%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Dir.FindFilesControl, ShadowBot.Shell.Development", + "icon": "BlockIcons/19-4.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件/获取文件列表.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dir.FindFilesHandler" + } + ], + "inputs": [ + { + "name": "path", + "label": "文件夹", + "required": true, + "tips": "输入或选择文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "patterns", + "label": "文件名匹配规则", + "required": true, + "tips": "输入文件名匹配规则,允许使用通配符,比如“图片*”或“图片?”,多个规则用逗号分割,比如:规则1,规则2", + "type": "str", + "default": "10:*.*", + "editor": { + "kind": "textbox" + } + }, + { + "name": "find_subdir", + "label": "", + "required": true, + "tips": "是否查找子文件夹下的文件", + "type": "bool", + "default": "13:False", + "editor": { + "label": "查找子文件夹", + "kind": "checkbox" + } + }, + { + "name": "skip_hidden_file", + "label": "", + "required": true, + "tips": "是否忽略隐藏的文件", + "type": "bool", + "default": "13:False", + "editor": { + "label": "忽略隐藏的文件", + "kind": "checkbox" + } + }, + { + "name": "is_sort", + "label": "", + "required": true, + "tips": "指定文件列表排序规则", + "type": "bool", + "default": "13:False", + "editor": { + "label": "指定文件列表排序规则", + "kind": "checkbox" + } + }, + { + "name": "sort_by", + "label": "排序因素", + "required": false, + "default": "10:name", + "defaultDisplay": "文件名称", + "tips": "选择文件列表排序因素", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "文件名称", + "value": "name" + }, + { + "display": "文件大小", + "value": "size" + }, + { + "display": "文件创建时间", + "value": "create_time" + }, + { + "display": "文件最后修改时间", + "value": "last_modify_time" + } + ] + } + }, + { + "name": "sort_way", + "label": "排序方式", + "required": false, + "default": "10:increase", + "defaultDisplay": "递增", + "tips": "选择文件列表排序方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "递增", + "value": "increase" + }, + { + "display": "递减", + "value": "decrease" + } + ] + } + } + ], + "outputs": [ + { + "id": "file_paths", + "label": "保存文件列表至", + "variableLabel": "获取的文件列表", + "tips": "输入一个名字,用来保存文件列表", + "type": "list", + "name": "file_paths" + } + ] + }, + { + "name": "dir.find_subdirs", + "function": "xbot_visual.dir.find_subdirs", + "title": "获取文件夹列表", + "keywords": "子文件夹", + "description": "获取指定路径文件夹下的子文件夹", + "comment": "获取文件夹%path%下的子文件夹,将文件夹列表保存到%dir_paths%", + "icon": "BlockIcons/19-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/获取文件夹列表.html", + "inputs": [ + { + "name": "path", + "label": "文件夹路径", + "required": true, + "tips": "输入或选择文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "patterns", + "label": "子文件夹名称匹配规则", + "required": true, + "tips": "输入子文件夹名称匹配规则,允许使用通配符,比如“图片*”或“图片?”,多个规则用逗号分割,比如:规则1,规则2", + "type": "str", + "default": "10:*", + "editor": { + "kind": "textbox" + } + }, + { + "name": "find_subdir", + "label": "", + "required": true, + "tips": "是否递归查找子文件夹", + "type": "bool", + "default": "13:False", + "editor": { + "label": "递归查找子文件夹", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "dir_paths", + "label": "保存文件夹列表至", + "variableLabel": "获取的文件夹列表", + "tips": "输入一个名字,用来保存文件夹列表", + "type": "list", + "name": "dir_paths" + } + ] + }, + { + "name": "dir.selected_dirs_or_files", + "function": "xbot_visual.dir.selected_dirs_or_files", + "title": "获取选中文件(夹)列表", + "description": "获取当前激活文件资源管理器(若激活桌面则目标为桌面)中选中的文件、文件夹列表", + "comment": "获取当前激活的文件夹中选中的文件和文件夹列表,将结果保存到%dir_or_file_paths%", + "icon": "BlockIcons/19-11.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/获取选中文件(夹)列表.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dir.SelectedDirsOrFilesHandler" + } + ], + "inputs": [ + { + "name": "file_type", + "label": "获取类型", + "required": true, + "tips": "选择要获取的选中类型,支持获取选中的文件、文件夹或所有选中项", + "type": "str", + "default": "10:all", + "defaultDisplay": "文件和文件夹", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "文件和文件夹", + "value": "all" + }, + { + "display": "文件", + "value": "file" + }, + { + "display": "文件夹", + "value": "folder" + } + ] + } + } + ], + "outputs": [ + { + "id": "dir_or_file_paths", + "label": "保存文件、文件夹列表至", + "variableLabel": "选中的文件(夹)列表", + "tips": "输入一个名字,用来保存文件、文件夹列表", + "type": "list", + "name": "dir_or_file_paths" + } + ] + }, + { + "name": "dir.open", + "function": "xbot_visual.dir.open", + "title": "打开文件夹", + "description": "打开文件夹,如果为文件路径,会在打开文件夹后选中文件", + "comment": "打开文件夹并选中文件%folder_file_path%", + "icon": "BlockIcons/19-12.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/打开文件夹.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Dir.OpenDirHandler" + } + ], + "inputs": [ + { + "name": "folder_file_path", + "label": "文件(夹)路径", + "required": true, + "tips": "输入要打开的文件夹路径,如果为文件路径,会打开文件夹并选中文件", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + } + ] + }, + { + "name": "dir.empty", + "function": "xbot_visual.dir.empty", + "title": "清空文件夹", + "description": "删除文件夹下的所有文件和子文件夹,但保留文件夹本身", + "comment": "清空文件夹%path%", + "icon": "BlockIcons/19-6.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/清空文件夹.html", + "inputs": [ + { + "name": "path", + "label": "要清空的文件夹", + "required": true, + "tips": "输入或选择要清空的文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + } + ] + }, + { + "name": "dir.copy", + "function": "xbot_visual.dir.copy", + "title": "拷贝文件夹", + "keywords": "复制文件夹", + "description": "将源文件夹拷贝到目标文件夹", + "comment": "将源文件夹%source_dir_path%拷贝到目标文件夹%copyto_dir_path%,将拷贝后的文件夹路径保存到%dir_path%", + "icon": "BlockIcons/19-7.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/拷贝文件夹.html", + "inputs": [ + { + "name": "source_dir_path", + "label": "要拷贝的文件夹", + "required": true, + "tips": "输入或选择要拷贝的文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "copyto_dir_path", + "label": "目标文件夹", + "required": true, + "tips": "输入目标文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "copy_way", + "label": "如果文件存在", + "required": true, + "default": "10:overwrite", + "defaultDisplay": "覆盖", + "tips": "对目标文件夹中已存在的文件,选择覆盖还是不执行拷贝", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖", + "value": "overwrite" + }, + { + "display": "不要拷贝", + "value": "not_overwrite" + }, + { + "display": "自动添加后缀", + "value": "save_as" + } + ] + } + } + ], + "outputs": [ + { + "id": "dir_path", + "label": "拷贝后的文件夹路径", + "variableLabel": "拷贝后的文件夹路径", + "tips": "输入一个名字,用来保存拷贝后的文件夹路径", + "type": "str", + "name": "dir_path" + } + ] + }, + { + "name": "dir.move", + "function": "xbot_visual.dir.move", + "title": "移动文件夹", + "description": "将源文件夹移动到目标文件夹下", + "comment": "将源文件夹%source_dir_path%移动到目标文件夹%moveto_dir_path%下,将移动后的文件路径保存到%dir_path%", + "icon": "BlockIcons/19-8.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/移动文件夹.html", + "inputs": [ + { + "name": "source_dir_path", + "label": "要移动的文件夹", + "required": true, + "tips": "输入或选择要移动的文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "moveto_dir_path", + "label": "目标文件夹", + "required": true, + "tips": "输入或选择目标文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + } + ], + "outputs": [ + { + "id": "dir_path", + "label": "移动后的文件夹路径", + "variableLabel": "移动后的文件夹路径", + "tips": "输入一个名字,用来保存移动后的文件夹路径", + "type": "str", + "name": "dir_path" + } + ] + }, + { + "name": "dir.get_special_dir", + "function": "xbot_visual.dir.get_special_dir", + "title": "获取系统文件夹路径", + "description": "获取系统文件夹路径", + "comment": "获取系统文件夹%special_dir_name%路径,将系统文件夹路径保存到%dir_path%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Dir.GetSpecialDirControl, ShadowBot.Shell.Development", + "icon": "BlockIcons/19-9.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/获取系统文件夹路径.html", + "inputs": [ + { + "name": "special_dir_name", + "label": "系统文件夹名称", + "required": true, + "default": "10:DesktopDirectory", + "defaultDisplay": "文件夹名称", + "tips": "选择系统文件夹名称", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "临时", + "value": "TEMP" + }, + { + "display": "桌面", + "value": "DesktopDirectory" + }, + { + "display": "应用程序数据", + "value": "ApplicationData" + }, + { + "display": "常见应用程序数据", + "value": "CommonApplicationData" + }, + { + "display": "本地应用程序数据", + "value": "LocalApplicationData" + }, + { + "display": "Cookies", + "value": "Cookies" + }, + { + "display": "收藏夹", + "value": "Favorites" + }, + { + "display": "历史", + "value": "History" + }, + { + "display": "Internet 缓存", + "value": "InternetCache" + }, + { + "display": "程序", + "value": "Programs" + }, + { + "display": "音乐", + "value": "MyMusic" + }, + { + "display": "图片", + "value": "MyPictures" + }, + { + "display": "最近", + "value": "Recent" + }, + { + "display": "发送到", + "value": "SendTo" + }, + { + "display": "开始菜单", + "value": "StartMenu" + }, + { + "display": "启动", + "value": "Startup" + }, + { + "display": "系统", + "value": "System" + }, + { + "display": "模板", + "value": "Templates" + }, + { + "display": "个人", + "value": "Personal" + }, + { + "display": "程序文件", + "value": "ProgramFiles" + }, + { + "display": "常见程序文件", + "value": "CommonProgramFiles" + }, + { + "display": "系统", + "value": "Windows" + }, + { + "display": "下载", + "value": "Downloads" + } + ] + } + } + ], + "outputs": [ + { + "id": "dir_path", + "label": "系统文件夹路径", + "variableLabel": "系统文件夹路径", + "tips": "输入一个名字,用来保存系统文件夹路径", + "type": "str", + "name": "dir_path" + } + ] + }, + { + "name": "dir.rename", + "function": "xbot_visual.dir.rename", + "title": "文件夹重命名", + "description": "文件夹重命名", + "comment": "将文件夹%path%重命名为%new_name%,将新的文件夹路径保存到%new_dir_path%", + "icon": "BlockIcons/19-10.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件夹/文件夹重命名.html", + "inputs": [ + { + "name": "path", + "label": "要重命名的文件夹", + "required": true, + "tips": "输入或选择要重命名的文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "new_name", + "label": "新文件夹名称", + "required": true, + "tips": "输入新的文件夹名称", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "new_dir_path", + "label": "新的文件夹路径", + "variableLabel": "重命名后的文件夹路径", + "tips": "输入一个名字,用来保存新的文件夹路径", + "type": "str", + "name": "new_dir_path" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/email.blocks.json b/src/assert/block_settings/email.blocks.json new file mode 100644 index 0000000..fea5c5f --- /dev/null +++ b/src/assert/block_settings/email.blocks.json @@ -0,0 +1,519 @@ +{ + "types": [ + { + "name": "xbot_visual_email_mailmessage", + "localName": "邮件", + "pythonName": "xbot_visual._core.xbot_visual_email_mailmessage", + "props": [ + { + "name": "sender", + "type": "str", + "label": "发件人" + }, + { + "name": "receiver", + "type": "str", + "label": "收件人" + }, + { + "name": "subject", + "type": "str", + "label": "主题" + }, + { + "name": "text_body", + "type": "str", + "label": "正文" + }, + { + "name": "html_body", + "type": "str", + "label": "HTML正文" + }, + { + "name": "time", + "type": "str", + "label": "时间" + }, + { + "name": "attachment", + "type": "str", + "label": "附件路径" + } + ] + } + ], + "blocks": [ + { + "name": "email.send_email", + "icon": "BlockIcons/13-1.png", + "description": "发送邮件", + "comment": "发送邮件到%to%", + "title": "发送邮件", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/邮件/发送邮件.html", + "function": "xbot_visual.email.send_email", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Email.SendEmailControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Email.SendEmailHandler" + } + ], + "inputs": [ + { + "name": "sender", + "label": "发件人", + "required": true, + "tips": "邮件发件人", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "sender_display_name", + "label": "发件人名称", + "required": false, + "tips": "邮件发送人名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "to", + "label": "收件人", + "required": true, + "tips": "邮件收件人,多个收件人用“;”分隔。", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "cc", + "label": "抄送", + "required": false, + "tips": "邮件抄送,多个抄送用“;”分隔。", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "bcc", + "label": "密送", + "required": false, + "tips": "邮件密送,多个密送用“;”分隔。", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "subject", + "label": "主题", + "required": true, + "tips": "邮件主题", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "body", + "label": "正文", + "required": true, + "tips": "邮件正文", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "body_is_html", + "label": "", + "required": false, + "tips": "正文是HTML格式", + "type": "bool", + "default": "13:False", + "editor": { + "label": "HTML格式", + "kind": "checkbox" + } + }, + { + "name": "attachments", + "label": "邮件附件", + "required": false, + "tips": "邮件附件,多个附件用“;”分隔。", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "All Files (*.*)|*.*" + } + } + }, + { + "name": "select_smtp_server", + "label": "SMTP服务器", + "required": true, + "category": "advanced", + "default": "10:qq_smtp", + "defaultDisplay": "QQ邮箱", + "tips": "选择一个SMTP服务器", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "QQ邮箱", + "value": "qq_smtp" + }, + { + "display": "126邮箱", + "value": "126_smtp" + }, + { + "display": "163邮箱", + "value": "163_smtp" + }, + { + "display": "Google邮箱", + "value": "gmail_smtp" + }, + { + "display": "Outlook邮箱", + "value": "outlook_smtp" + }, + { + "display": "iCloud邮箱", + "value": "iCloud_smtp" + }, + { + "display": "其他", + "value": "other_smtp" + } + ] + } + }, + { + "name": "smtp_server", + "label": "指定的SMTP服务器", + "category": "advanced", + "tips": "输入指定的SMTP服务器地址", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "smtp_port", + "label": "指定的SMTP端口", + "default": "10:465", + "category": "advanced", + "tips": "输入指定的SMTP端口", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "use_ssl", + "label": "", + "required": true, + "category": "advanced", + "tips": "使用SSL连接SMTP服务器", + "type": "bool", + "default": "13:False", + "editor": { + "label": "使用SSL", + "kind": "checkbox" + } + }, + { + "name": "smtp_server_authentication", + "label": "", + "required": false, + "category": "advanced", + "tips": "SMTP服务器需要身份验证", + "type": "bool", + "default": "13:False", + "editor": { + "label": "SMTP服务器需要身份验证", + "kind": "checkbox" + } + }, + { + "name": "user_name", + "label": "用户名", + "required": false, + "category": "advanced", + "tips": "SMTP服务器身份验证的用户名", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "password", + "label": "授权码", + "required": false, + "category": "advanced", + "tips": "SMTP服务器验证身份的授权码", + "type": "str", + "editor": { + "kind": "password" + } + } + ] + }, + { + "name": "email.retrieve_email", + "icon": "BlockIcons/13-2.png", + "description": "从指定的邮箱中获取邮件,收取邮件", + "comment": "获取%mail_kind%%username%中文件夹%folder_name%的前%top%封邮件,将邮件列表保存到%mailmessage_list%", + "title": "获取邮件", + "keywords": "收取邮件;收邮件", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/邮件/获取邮件.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Email.RetrieveEmailControl, ShadowBot.Shell.Development", + "function": "xbot_visual.email.retrieve_email", + "inputs": [ + { + "name": "mail_kind", + "label": "邮箱类型", + "required": true, + "default": "10:163", + "defaultDisplay": "163邮箱", + "tips": "选择一个邮箱类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "163邮箱", + "value": "163" + }, + { + "display": "126邮箱", + "value": "126" + }, + { + "display": "qq邮箱", + "value": "qq" + }, + { + "display": "Google邮箱", + "value": "gmail" + }, + { + "display": "Outlook邮箱", + "value": "outlook" + }, + { + "display": "iCloud邮箱", + "value": "iCloud" + }, + { + "display": "其他", + "value": "other_smtp" + }, + { + "display": "自定义邮箱", + "value": "custom" + } + ] + } + }, + { + "name": "address", + "label": "IMAP服务器", + "tips": "输入指定的IMAP服务器地址", + "type": "str", + "editor": { + "placeholder": "如imap.163.com", + "kind": "textbox" + } + }, + { + "name": "port", + "label": "端口号", + "tips": "输入指定的IMAP端口号", + "default": "10:993", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "use_ssl", + "label": "", + "tips": "使用SSL连接IMAP服务器", + "type": "bool", + "default": "13:True", + "editor": { + "label": "使用SSL", + "kind": "checkbox" + } + }, + { + "name": "username", + "label": "邮箱账号", + "tips": "IMAP服务器身份验证的用户名,通常是邮箱账号,以具体邮件服务商的规定为准", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "authcode", + "label": "授权码", + "tips": "IMAP服务器验证身份的授权码,一般需要短信认证开通,部分邮箱为账号密码,以具体邮件服务商的规定为准", + "type": "str", + "editor": { + "kind": "password" + } + }, + { + "name": "only_unread", + "label": "", + "tips": "仅获取未读邮件或者获取所有邮件", + "type": "bool", + "default": "13:True", + "editor": { + "label": "仅未读邮件", + "kind": "checkbox" + } + }, + { + "name": "top", + "label": "邮件数量", + "tips": "获取前N封邮件", + "default": "10:5", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "save_attachments", + "label": "", + "tips": "是否下载邮件的附件", + "type": "bool", + "default": "13:False", + "editor": { + "label": "保存附件", + "kind": "checkbox" + } + }, + { + "name": "attachments_savefolder", + "label": "保存目录", + "tips": "附件的保存目录", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "folder_name_specifc_mode", + "label": "文件夹指定方式", + "tips": "文件夹指定方式", + "type": "str", + "default": "10:default", + "defaultDisplay": "默认", + "category": "advanced", + "editor": { + "kind": "select", + "options": [ + { + "display": "默认", + "value": "default" + }, + { + "display": "动态指定", + "value": "dynamic" + } + ] + } + }, + { + "name": "folder_name", + "label": "文件夹名称", + "tips": "输入指定文件夹的名称", + "category": "advanced", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "mark_as_read", + "label": "", + "tips": "获取邮件后,将邮件标记为已读状态", + "category": "advanced", + "type": "bool", + "default": "13:True", + "editor": { + "label": "标记为已读", + "kind": "checkbox" + } + }, + { + "name": "keyword_in_from", + "label": "发件人中包含的内容", + "tips": "发件人中包含的内容", + "category": "advanced", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "keyword_in_to", + "label": "收件人中包含的内容", + "tips": "收件人中包含的内容", + "category": "advanced", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "keyword_in_subject", + "label": "主题中包含的内容", + "tips": "主题中包含的内容", + "category": "advanced", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "keyword_in_textBody", + "label": "正文中包含的内容", + "tips": "正文中包含的内容", + "category": "advanced", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "mailmessage_list", + "label": "保存邮件列表至", + "variableLabel": "邮件列表", + "tips": "指定一个变量名称,该变量用于存储获取到的邮件列表", + "type": "list", + "name": "mailmessage_list" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/excel.blocks.json b/src/assert/block_settings/excel.blocks.json new file mode 100644 index 0000000..29a1ad0 --- /dev/null +++ b/src/assert/block_settings/excel.blocks.json @@ -0,0 +1,4149 @@ +{ + "types": [ + { + "name": "openpyxl.Workbook", + "localName": "Excel对象", + "pythonName": "xbot.excel.workbook.officeworkbook.OfficeWorkBook,xbot.excel.workbook.comworkbook.ComWorkBook,xbot.excel.workbook.openpyxlworkbook.OpenPyxlWorkBook", + "methods": [ + { + "display": "总行数", + "function": "$0.get_active_sheet().get_row_count()", + "type": "int" + }, + { + "display": "第一个可用行", + "function": "$0.get_active_sheet().get_first_free_row()", + "type": "int" + }, + { + "display": "文件所在位置", + "function": "$0.get_full_name()", + "type": "str" + } + ] + }, + { + "name": "table.row", + "base": "list", + "localName": "一行数据", + "methods": [ + { + "display": "该行第$1列单元格内容", + "function": "$0[--$1]", + "type": "str", + "params": [ + { + "name": "$1", + "default": "A" + } + ], + "editor": "letterspin" + }, + { + "display": "该行倒数第$1个单元格内容", + "function": "$0[-$1]", + "type": "any", + "params": [ + { + "name": "$1", + "default": "1" + } + ], + "editor": "spin" + } + ] + }, + { + "name": "table.column", + "base": "list", + "localName": "一列数据", + "methods": [ + { + "display": "该列第$1个单元格内容", + "function": "$0[--$1]", + "type": "any", + "params": [ + { + "name": "$1", + "default": "1" + } + ], + "editor": "spin" + }, + { + "display": "该列倒数第$1个单元格内容", + "function": "$0[-$1]", + "type": "any", + "params": [ + { + "name": "$1", + "default": "1" + } + ], + "editor": "spin" + } + ] + } + ], + "blocks": [ + { + "name": "excel.launch", + "title": "打开/新建Excel", + "keywords": "打开Excel文件;新建Excel;启动Excel", + "icon": "BlockIcons/9-1.png", + "comment": "%launch_way% %open_filename%,将Excel对象保存到%excel_instance%", + "description": "打开已有Excel文件,或新建Excel,以实现Excel程序的自动化", + "function": "xbot_visual.excel.launch", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.LaunchExcelControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/启动excel.html", + "video": { + "time": "09:51" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.LaunchExcelHandler" + } + ], + "inputs": [ + { + "name": "launch_way", + "label": "启动方式", + "required": true, + "default": "10:open", + "defaultDisplay": "打开已有的Excel", + "tips": "选择要新建一个Excel文件还是打开一个Excel文件", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "新建Excel", + "value": "create" + }, + { + "display": "打开已有的Excel", + "value": "open" + } + ] + } + }, + { + "name": "driver_way", + "label": "驱动方式", + "required": true, + "tips": "选择新建Excel文件或者打开Excel文件的驱动方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "自动检测", + "value": "auto_check" + }, + { + "display": "office", + "value": "office" + }, + { + "display": "wps", + "value": "wps" + }, + { + "display": "openpyxl", + "value": "openpyxl" + } + ] + } + }, + { + "name": "open_filename", + "label": "Excel文件路径", + "required": false, + "tips": "填写或选择要打开的Excel文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "Excel 工作簿|*.xlsx;*.xls;*.xlsm;*.csv" + } + } + }, + { + "name": "save_filename", + "label": "Excel文件路径", + "required": false, + "tips": "填写打开的Excel路径或保存Excel的路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "defaultFileName": "Workbook", + "filter": "Excel 工作簿|*.xlsx;*.xls;*.csv" + } + } + }, + { + "name": "isvisible", + "label": "", + "default": "13:True", + "tips": "此选项并不会限制Excel自动化的能力,只是用于控制可视化操作是否用户可见,如果是非可视化下操作Excel,保存之后必须要关闭Excel", + "type": "bool", + "editor": { + "label": "是否可视化", + "kind": "checkbox" + } + }, + { + "name": "ignoreformula", + "label": "", + "default": "13:False", + "tips": "忽略Excel中的公式,仅读取公式结果,勾选忽略公式打开文件后不允许保存,以防公式丢失。", + "type": "bool", + "editor": { + "label": "忽略公式", + "kind": "checkbox" + } + }, + { + "name": "password", + "label": "打开密码", + "category": "advanced", + "tips": "用于打开加密Excel文件的密码", + "type": "str", + "editor": { + "kind": "password" + } + }, + { + "name": "write_password", + "label": "编辑密码", + "category": "advanced", + "tips": "用于编辑加密Excel文件的密码", + "type": "str", + "editor": { + "kind": "password" + } + }, + { + "name": "update_links", + "label": "", + "default": "13:False", + "tips": "自动更新外部链接,建议勾选可视化", + "type": "bool", + "editor": { + "label": "自动更新外部链接", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "excel_instance", + "label": "保存Excel对象至", + "variableLabel": "打开的Excel对象", + "tips": "该变量保存的是Excel对象,使用此Excel对象可以对Excel进行自动化操作", + "name": "excel_instance", + "type": "openpyxl.Workbook" + } + ] + }, + { + "name": "excel.get_active_workbook", + "title": "获取当前激活的Excel对象", + "comment": "获取当前激活的Excel对象,将对象保存到%excel_instance%", + "description": "获取当前激活的Excel对象", + "icon": "BlockIcons/9-30.png", + "function": "xbot_visual.excel.get_active_workbook", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/获取当前激活的excel.html", + "video": { + "time": "03:32" + }, + "inputs": [], + "outputs": [ + { + "id": "excel_instance", + "label": "保存Excel对象至", + "variableLabel": "激活的Excel对象", + "tips": "该变量保存的是Excel对象,使用此Excel对象可以对Excel进行自动化操作", + "name": "excel_instance", + "type": "openpyxl.Workbook" + } + ] + }, + { + "name": "excel.save", + "title": "保存/另存Excel", + "comment": "%save_way%Excel对象%excel_instance%", + "description": "保存或另存Excel", + "keywords": "保存Excel;另存为Excel;导出Excel", + "icon": "BlockIcons/9-3.png", + "function": "xbot_visual.excel.save", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.SaveExcelControl,ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/保存excel.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.SaveExcelHandler" + } + ], + "inputs": [ + { + "name": "excel_instance", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "save_way", + "label": "保存方式", + "required": true, + "default": "10:save", + "defaultDisplay": "保存", + "tips": "保存对Excel的更改或另存为到新的路径", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "保存", + "value": "save" + }, + { + "display": "另存为", + "value": "saveas" + } + ] + } + }, + { + "name": "filename", + "label": "Excel文件路径", + "tips": "填写或选择要打开的Excel文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "defaultFileName": "Workbook", + "filter": "Excel 工作簿 (.xlsx)|*.xlsx" + } + } + }, + { + "name": "overwrite_file", + "label": "", + "default": "13:True", + "tips": "若文件已存在,又选择不覆盖,会报错提示文件已存在", + "type": "bool", + "editor": { + "label": "如果文件存在则覆盖", + "kind": "checkbox" + } + }, + { + "name": "is_close_after_save", + "label": "", + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "保存后关闭", + "kind": "checkbox" + } + } + ] + }, + { + "name": "excel.close", + "title": "关闭Excel", + "comment": "关闭Excel", + "description": "关闭Excel", + "icon": "BlockIcons/9-44.png", + "function": "xbot_visual.excel.close", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.CloseExcelControl,ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/关闭excel.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.CloseExcelHandler" + } + ], + "inputs": [ + { + "name": "operation", + "label": "操作", + "required": true, + "default": "10:close_specified", + "defaultDisplay": "关闭指定Excel文件", + "tips": "选择要关闭一个指定的Excel文件还是关闭所有Excel文件", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "关闭指定Excel文件", + "value": "close_specified" + }, + { + "display": "关闭所有Excel文件", + "value": "close_all" + } + ] + } + }, + { + "name": "excel_instance", + "label": "Excel对象", + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "close_way", + "label": "关闭方式", + "required": true, + "default": "10:save", + "defaultDisplay": "保存", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "不保存", + "value": "notsave" + }, + { + "display": "保存", + "value": "save" + }, + { + "display": "另存为", + "value": "saveas" + } + ] + } + }, + { + "name": "filename", + "label": "文件路径", + "tips": "填写或选择要打开的Excel文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "defaultFileName": "Workbook", + "filter": "Excel 工作簿 (.xlsx)|*.xlsx" + } + } + }, + { + "name": "overwrite_file", + "label": "", + "default": "13:True", + "tips": "若文件已存在,又选择不覆盖,会报错提示文件已存在", + "type": "bool", + "editor": { + "label": "如果文件存在则覆盖", + "kind": "checkbox" + } + }, + { + "name": "close_process", + "label": "关闭进程", + "required": true, + "default": "10:office", + "defaultDisplay": "office", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "office", + "value": "office" + }, + { + "display": "wps", + "value": "wps" + } + ] + } + }, + { + "name": "task_kill", + "label": "", + "required": true, + "default": "13:True", + "tips": "如果勾选, 将强制结束属于当前用户的指定Excel进程和由它启动的所有子进程", + "type": "bool", + "editor": { + "label": "终止Excel进程", + "kind": "checkbox" + } + } + ] + }, + { + "name": "excel.active", + "title": "激活Sheet页", + "comment": "%mode%激活Excel对象%workbook%中的Sheet页%value%", + "description": "根据Sheet页的名称或位置激活指定的Sheet页", + "keywords": "切换;选择", + "icon": "BlockIcons/9-4.png", + "function": "xbot_visual.excel.active", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/sheet页操作/激活sheet页.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "mode", + "label": "激活方式", + "required": true, + "default": "10:name", + "defaultDisplay": "根据Sheet页的名称", + "tips": "可根据名称或Sheet页中的位置(从1开始)", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据Sheet页的名称", + "value": "name" + }, + { + "display": "根据Sheet页的位置", + "value": "index" + } + ] + } + }, + { + "name": "value", + "label": "Sheet页的名称/位置", + "required": true, + "tips": "填写要打开激活的Sheet页的名称或位置(从1开始)", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "excel.create_sheet", + "title": "添加Sheet页", + "comment": "在Excel对象%workbook%中添加一个Sheet页,%create_way%,命名为%sheet_name%", + "description": "在Excel对象中添加一个新的sheet页,可以指定在头部添加或尾部添加", + "icon": "BlockIcons/9-10.png", + "function": "xbot_visual.excel.create_sheet", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/sheet页操作/添加sheet页.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "请选择一个已打开的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "required": true, + "tips": "请输入待添加的Sheet页名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "create_way", + "label": "添加方式", + "required": true, + "default": "10:first", + "defaultDisplay": "作为第一个sheet页", + "tips": "选择添加位置", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "作为第一个sheet页", + "value": "first" + }, + { + "display": "作为最后一个sheet页", + "value": "last" + } + ] + } + } + ] + }, + { + "name": "excel.remove_row", + "title": "删除Excel行", + "keywords": "删除行", + "comment": "删除Excel对象%workbook%工作表中的第%index%行", + "description": "删除行", + "icon": "BlockIcons/9-20.png", + "function": "xbot_visual.excel.remove_row", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/删除行.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "index", + "label": "行号", + "required": true, + "tips": "输入行号,多行用1,2,3或1:3,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,多行用1,2,3或1:3,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.remove_all_rows", + "title": "删除所有行", + "comment": "删除Excel对象%workbook%中的所有行数据", + "description": "删除所有行", + "icon": "BlockIcons/9-11.png", + "function": "xbot_visual.excel.remove_all_rows", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/删除所有行.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.get_row_count", + "title": "读取Excel总行数", + "comment": "读取Excel对象%workbook%中Sheet页%sheet_name%的总行数,将结果保存到%row_count%", + "description": "读取Excel总行数", + "icon": "BlockIcons/9-9.png", + "function": "xbot_visual.excel.get_row_count", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/读取总行数.html", + "video": { + "time": "03:05" + }, + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ], + "outputs": [ + { + "id": "row_count", + "label": "保存总行数至", + "variableLabel": "Excel总行数", + "tips": "指定一个变量名称,该变量用于保存总行数", + "type": "int", + "name": "excel_row_count" + } + ] + }, + { + "name": "excel.write_data_to_workbook", + "title": "写入内容至Excel工作表", + "keywords": "写入Excel", + "icon": "BlockIcons/9-5.png", + "comment": "写入内容到Excel工作表", + "description": "在 Excel 工作表中以写入内容,支持追加、插入或覆盖", + "function": "xbot_visual.excel.write_data_to_workbook", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/写入内容至excel工作表.html", + "video": { + "time": "13:55" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.WriteDataToWorkBookControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.WriteDataToWorkBookHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "write_range", + "label": "写入范围", + "required": true, + "default": "10:area", + "defaultDisplay": "区域", + "tips": "将数据写入到区域(包含单元格)、一行或一列", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "区域", + "value": "area" + }, + { + "display": "行", + "value": "row" + }, + { + "display": "列", + "value": "column" + } + ] + } + }, + { + "name": "write_way", + "label": "写入方式", + "default": "10:append", + "defaultDisplay": "追加一行", + "tips": "支持覆盖、追加、插入", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "追加一行", + "value": "append" + }, + { + "display": "插入一行", + "value": "insert" + }, + { + "display": "覆盖一行", + "value": "override" + } + ] + } + }, + { + "name": "write_column_way", + "label": "写入方式", + "default": "10:override", + "defaultDisplay": "覆盖一列", + "tips": "支持覆盖、追加、插入", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "追加一列", + "value": "append" + }, + { + "display": "插入一列", + "value": "insert" + }, + { + "display": "覆盖一列", + "value": "override" + } + ] + } + }, + { + "name": "row_num", + "label": "行号", + "tips": "输入行号,从1开始,-n表示倒数第n行", + "default": "10:1", + "type": "int", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "column_name", + "label": "列名", + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "begin_row_num", + "label": "起始行号", + "category": "advanced", + "default": "10:1", + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "int", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "begin_column_name", + "label": "起始列名", + "category": "advanced", + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "content", + "label": "写入内容", + "required": true, + "tips": "内容的数据格式需要跟写入范围对应,写入行、列、非单个单元格的区域的内容需要是列表类型", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + }, + { + "name": "write_as_text_cols", + "label": "格式设置为文本的列", + "category": "advanced", + "required": false, + "tips": "纯数字的长文本,写入Excel后会变成科学计数法,比如身份证号码。可在此设置相应列的数字格式为文本。多个列以,分割,比如A,B,C", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "多个列名以,分割,适用于订单号、身份证等纯数字的长文本" + } + } + ] + }, + { + "name": "excel.read_data_from_workbook", + "title": "读取Excel内容", + "keywords": "读取表格内容", + "icon": "BlockIcons/9-12.png", + "comment": "从Excel对象%workbook%中读取单元格(第%cell_row_num%行,第%cell_column_name%列)的内容,将数据保存到%excel_data%", + "description": "从Excel文件中读取内容,支持矩形区域范围读取", + "function": "xbot_visual.excel.read_data_from_workbook", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读取excel内容.html", + "video": { + "time": "05:39" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.ReadDataFromWorkBookControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.ReadDataFromWorkBookHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "read_way", + "label": "读取方式", + "required": true, + "default": "10:cell", + "defaultDisplay": "单元格", + "tips": "可读取单元格、一行、一列、区域内容", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单元格内容", + "value": "cell" + }, + { + "display": "行内容", + "value": "row" + }, + { + "display": "列内容", + "value": "column" + }, + { + "display": "区域内容", + "value": "range" + }, + { + "display": "已使用区域内容", + "value": "used_range" + } + ] + } + }, + { + "name": "range", + "label": "区域", + "tips": "", + "type": "str", + "editor": { + "kind": "excelrange" + } + }, + { + "name": "cell_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "cell_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "area_begin_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "area_begin_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "area_end_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "area_end_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "row_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "get_display_text", + "label": "", + "required": false, + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "获取单元格的值作为纯文本", + "kind": "checkbox" + } + }, + { + "name": "has_header_row", + "label": "", + "required": false, + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "区域第一行包含列名", + "kind": "checkbox" + } + }, + { + "name": "column_column_name", + "label": "列名", + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + }, + { + "name": "using_text", + "label": " ", + "category": "advanced", + "required": false, + "default": "13:False", + "tips": "若不勾选,整数会被读成小数,比如1->1.0,日期格式值会被读成日期对象。若勾选此项,返回的内容为肉眼看到的文本", + "type": "str", + "editor": { + "kind": "checkbox", + "label": "读取单元格显示的内容" + } + }, + { + "name": "text_cols", + "label": "显示内容的列", + "category": "advanced", + "default": "10:", + "tips": "选择哪些列需要显示肉眼可见内容。多个列以逗号分割。\r\n注意!这种读取方法较慢,一列一万行数据,需要13秒", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "多个列名以,分割,若空表示所有列,但读取速度会较慢" + } + }, + { + "name": "clear_space", + "label": " ", + "category": "advanced", + "required": false, + "default": "13:False", + "tips": "若勾选,会自动清除读取内容前后的空格、换行符", + "type": "str", + "editor": { + "kind": "checkbox", + "label": "清除单元格前后空格" + } + } + ], + "outputs": [ + { + "id": "excel_data", + "label": "保存Excel数据对象至", + "variableLabel": "Excel数据对象", + "tips": "指定一个变量名称,该变量用于保存区域数据内容", + "type": "any", + "name": "excel_data" + } + ] + }, + { + "name": "excel.loop_data_from_workbook", + "statement": "excel.forin", + "indent": "1", + "scope": "1", + "isLoop": true, + "title": "循环Excel内容", + "keywords": "循环表格内容", + "icon": "BlockIcons/9-13.png", + "comment": "循环Excel对象%workbook中内容,将每次循环项保存到%loop_item%", + "description": "循环Excel对象的内容,并保存循环项", + "function": "xbot_visual.excel.loop_data_from_workbook_with_return_item_location", + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/循环excel内容.html", + "video": { + "time": "04:05" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.ExcelLoopControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.ExcelLoopHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "loop_way", + "label": "循环方式", + "required": true, + "default": "10:used_range", + "defaultDisplay": "循环已使用区域", + "tips": "可循环连续的行、列或区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "循环区域", + "value": "loop_range" + }, + { + "display": "循环行", + "value": "loop_row" + }, + { + "display": "循环列", + "value": "loop_column" + }, + { + "display": "循环已使用区域", + "value": "used_range" + } + ] + } + }, + { + "name": "range", + "label": "区域", + "tips": "区域", + "type": "str", + "editor": { + "kind": "excelrange" + } + }, + { + "name": "begin_row_num", + "label": "起始行号", + "required": false, + "tips": "循环起始行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "起始行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "end_row_num", + "label": "结束行号", + "required": false, + "tips": "循环结束行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "结束行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "begin_column_name", + "label": "起始列名", + "required": false, + "tips": "循环开始列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "起始列名(支持A或1),-n表示倒数第n列数" + } + }, + { + "name": "end_column_name", + "label": "结束列名", + "required": false, + "tips": "循环结束列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "结束列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "has_header_row", + "label": "", + "required": false, + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "区域第一行包含列名", + "kind": "checkbox" + } + }, + { + "name": "range_begin_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "range_begin_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "range_end_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "range_end_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + }, + { + "name": "using_text", + "label": " ", + "category": "advanced", + "required": false, + "default": "13:False", + "tips": "若不勾选,整数会被读成小数,比如1->1.0,日期格式值会被读成日期对象。若勾选此项,返回的内容为肉眼看到的文本", + "type": "str", + "editor": { + "kind": "checkbox", + "label": "读取单元格显示的内容" + } + }, + { + "name": "text_cols", + "label": "显示内容的列", + "category": "advanced", + "default": "10:", + "tips": "选择哪些列需要显示肉眼可见内容。多个列以逗号分割。\r\n注意!这种读取方法较慢,一列一万行数据,需要13秒", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "多个列名以,分隔,若空表示所有列,但读取速度会较慢" + } + }, + { + "name": "clear_space", + "label": " ", + "category": "advanced", + "required": false, + "default": "13:False", + "tips": "若勾选,会自动清除读取内容前后的空格、换行符", + "type": "str", + "editor": { + "kind": "checkbox", + "label": "清除单元格前后空格" + } + } + ], + "outputs": [ + { + "id": "loop_item", + "label": "当前循环项保存至", + "variableLabel": "当前循环项数据对象", + "tips": "指定一个变量名称,该变量用于保存Excel循环项", + "type": "table.row", + "name": "loop_excel" + }, + { + "id": "loop_item_rownum", + "label": "当前行号保存至", + "variableLabel": "当前循环行的行号", + "tips": "指定一个变量名称,该变量用于保存Excel当前循环项的行号", + "type": "int", + "name": "loop_item_rownum" + }, + { + "id": "loop_item_columnname", + "label": "当前列名保存至", + "variableLabel": "当前循环列的列名", + "tips": "指定一个变量名称,该变量用于保存Excel当前循环项的列名", + "type": "str", + "name": "loop_item_columnname" + } + ] + }, + { + "name": "excel.execute_macro", + "title": "运行Excel宏", + "comment": "在Excel对象%workbook%中运行宏%macro%", + "description": "运行Excel宏", + "icon": "BlockIcons/9-14.png", + "function": "xbot_visual.excel.execute_macro", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/运行excel宏.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "macro", + "label": "宏", + "required": true, + "tips": "请输入在Excel中运行的宏", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "excel.select_range", + "title": "选中区域", + "icon": "BlockIcons/9-15.png", + "comment": "在Excel对象%workbook%中选中区域:从起始单元格(第%begin_row_num%行,第%begin_column_name%列)到末尾单元格(第%end_row_num%行,第%end_column_name%列)", + "description": "在Excel对象中选中区域", + "function": "xbot_visual.excel.select_range", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/选中区域.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.SelectRangeControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.SelectRangeHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "select_way", + "label": "选中方式", + "required": true, + "default": "10:absolute_range", + "defaultDisplay": "区域", + "tips": "指定需要选中的单元格区域范围", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "区域", + "value": "absolute_range" + }, + { + "display": "行", + "value": "row" + }, + { + "display": "列", + "value": "column" + } + ] + } + }, + { + "name": "range", + "label": "区域", + "tips": "区域", + "type": "str", + "editor": { + "kind": "excelrange" + } + }, + { + "name": "begin_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,若选中方式为‘行’,可以填写多行,多行用1,2,3或1:3,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "begin_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1)。若选中方式为‘列’,可以填写多列,多列用A,B,C或A:C,-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "end_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "end_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "row_num", + "label": "行号", + "required": false, + "tips": "输入行号,多行用1,2,3或1:3,-n表示倒数第n行", + "type": "any", + "editor": { + "placeholder": "输入行号,多行用1,2,3或1:3,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列", + "kind": "textbox" + } + } + ] + }, + { + "name": "excel.get_sheet_name", + "statement": "excel.get_sheet_name", + "title": "获取Sheet页名称", + "comment": "在Excel对象%workbook%中获取%sheet_scope%,将结果保存到%sheet_name%", + "description": "获取Sheet页名称", + "icon": "BlockIcons/9-25.png", + "function": "xbot_visual.excel.get_sheet_name", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/sheet页操作/获取sheet页名称.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.GetSheetNameControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.GetSheetNameHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_scope", + "label": "Sheet页范围", + "required": true, + "default": "10:active_sheet", + "defaultDisplay": "当前Sheet页名称", + "tips": "当前激活的Sheet页或全部的Sheet页名称列表,注意两者返回的结果数据类型不同", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "当前Sheet页名称", + "value": "active_sheet" + }, + { + "display": "所有Sheet页名称", + "value": "all_sheet" + } + ] + } + } + ], + "outputs": [ + { + "id": "sheet_name", + "label": "Sheet页名称保存至", + "variableLabel": "Sheet页名称", + "tips": "指定一个变量名称,该变量用于保存Sheet页名称", + "type": "any", + "name": "sheet_name" + }, + { + "id": "sheet_name_list", + "label": "Sheet页名称列表保存至", + "variableLabel": "Sheet页名称", + "tips": "指定一个变量名称,该变量用于保存Sheet页名称列表", + "type": "any", + "name": "sheet_name_list", + "isEnable": false + } + ] + }, + { + "name": "excel.delete_sheet", + "title": "删除Sheet页", + "comment": "在Excel对象%workbook%中删除指定的Sheet页%sheet_name%", + "description": "删除指定的Sheet页", + "icon": "BlockIcons/9-21.png", + "function": "xbot_visual.excel.delete_sheet", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/sheet页操作/删除sheet页.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "required": true, + "tips": "输入待删除的Sheet页名称", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "excel.copy_sheet", + "title": "拷贝Sheet页", + "comment": "在Excel对象%workbook%中拷贝Sheet页%sheet_name%到新的Sheet页%new_sheet_name%", + "description": "拷贝指定的Sheet页", + "icon": "BlockIcons/9-17.png", + "function": "xbot_visual.excel.copy_sheet", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/sheet页操作/拷贝sheet页.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.CopySheetControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.CopySheetHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "源Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "源Sheet页名称", + "required": true, + "tips": "输入待拷贝的Sheet页名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "copy_way", + "label": "拷贝方式", + "required": true, + "default": "10:copy_in_current_workbook", + "defaultDisplay": "当前工作簿内拷贝", + "tips": "请选择拷贝方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "当前工作簿内拷贝", + "value": "copy_in_current_workbook" + }, + { + "display": "拷贝到另外的工作簿", + "value": "copy_to_another_workbook" + } + ] + } + }, + { + "name": "dest_workbook", + "label": "目标Excel对象", + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "new_sheet_name", + "label": "新的Sheet页名称", + "required": true, + "tips": "输入新的Sheet页名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_cover", + "label": "", + "default": "13:False", + "required": true, + "tips": "若新的Sheet页名称存在,勾选后会覆盖原Sheet页,若不勾选,则会提示Sheet页名称已存在", + "type": "bool", + "editor": { + "label": "新的Sheet页存在则覆盖", + "kind": "checkbox" + } + } + ] + }, + { + "name": "excel.get_first_free_row", + "title": "获取第一个可用行", + "comment": "在Excel对象%workbook%中的Sheet页%sheet_name%中获取第一个可用行,将行号保存到%row_num%", + "description": "获取第一个可用行", + "icon": "BlockIcons/9-23.png", + "function": "xbot_visual.excel.get_first_free_row", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/获取第一个可用行.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ], + "outputs": [ + { + "id": "row_num", + "label": "行号保存至", + "variableLabel": "第一个可用行号", + "tips": "指定一个变量名称,该变量用于Sheet页第一个可用行号", + "type": "int", + "name": "row_num" + } + ] + }, + { + "name": "excel.get_first_free_column", + "title": "获取第一个可用列", + "comment": "在Excel对象%workbook%中的Sheet页%sheet_name%中获取第一个可用列,将列名保存到%column_name%", + "description": "获取第一个可用列", + "icon": "BlockIcons/9-22.png", + "function": "xbot_visual.excel.get_first_free_column", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/获取第一个可用列.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ], + "outputs": [ + { + "id": "column_name", + "label": "列名保存至", + "variableLabel": "第一个可用列名", + "tips": "指定一个变量名称,该变量用于Sheet页第一个可用列名", + "type": "str", + "name": "column_name" + } + ] + }, + { + "name": "excel.get_last_column", + "title": "获取最后一列", + "comment": "在Excel对象%workbook%中的Sheet页%sheet_name%中获取最后一列,将列名保存到%last_column_name%", + "description": "获取最后一列的列名", + "icon": "BlockIcons/9-22.png", + "function": "xbot_visual.excel.get_last_column", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/获取最后一列.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ], + "outputs": [ + { + "id": "last_column_name", + "label": "列名保存至", + "variableLabel": "Sheet页列名", + "tips": "指定一个变量名称,该变量用于Sheet页最后一列的列名", + "type": "str", + "name": "last_column_name" + } + ] + }, + { + "name": "excel.insert_row", + "title": "插入行", + "comment": "在Excel对象%workbook%中的第%row_num%行插入%values%", + "description": "插入行", + "icon": "BlockIcons/9-28.png", + "function": "xbot_visual.excel.insert_row", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/插入行.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "row_num", + "label": "行号", + "required": true, + "default": "10:1", + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "values", + "label": "行数据", + "required": true, + "tips": "待插入的行数据", + "type": "list", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "excel.insert_column", + "title": "插入列", + "comment": "在Excel对象%workbook%中的第%column_name%列插入%values%", + "description": "插入列", + "icon": "BlockIcons/9-27.png", + "function": "xbot_visual.excel.insert_column", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/插入列.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "column_name", + "label": "列名", + "required": true, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "values", + "label": "列数据", + "required": true, + "tips": "待插入的行数据", + "type": "list", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "excel.remove_column", + "title": "删除Excel列", + "keywords": "删除列", + "comment": "在Excel对象%workbook%中删除第%column_name%列", + "description": "删除列", + "icon": "BlockIcons/9-19.png", + "function": "xbot_visual.excel.remove_column", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/删除列.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "column_name", + "label": "列名", + "required": true, + "tips": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.get_first_free_row_on_column", + "title": "获取列上第一个可用行", + "comment": "在Excel对象%workbook%中获取第%column_name%列上的第一个可用行,将行号保存到%row_num%", + "description": "获取列上的第一个可用行", + "icon": "BlockIcons/9-24.png", + "function": "xbot_visual.excel.get_first_free_row_on_column", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/获取列上第一个可用行.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "column_name", + "label": "列名", + "required": true, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ], + "outputs": [ + { + "id": "row_num", + "label": "Sheet页行号保存至", + "variableLabel": "列上第一个可用行号", + "tips": "指定一个变量名称,该变量用于Sheet页指定列上的第一个可用行号", + "type": "int", + "name": "row_num" + } + ] + }, + { + "name": "excel.get_first_free_column_on_row", + "title": "获取行上第一个可用列", + "comment": "在Excel对象%workbook%中获取第%row_num%行上的第一个可用列,将列名保存到%column_name%", + "description": "获取行上第一个可用列", + "icon": "BlockIcons/9-24.png", + "function": "xbot_visual.excel.get_first_free_column_on_row", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/获取行上第一个可用列.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "row_num", + "label": "行号", + "required": true, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ], + "outputs": [ + { + "id": "column_name", + "label": "Sheet页列名保存至", + "variableLabel": "行上第一个可用列名", + "tips": "指定一个变量名称,该变量用于Sheet页指定行上的第一个可用列名", + "type": "str", + "name": "column_name" + } + ] + }, + { + "name": "excel.get_selected_range", + "title": "获取选中区域", + "comment": "获取Excel对象%workbook%当前Sheet页选中区域,将起始行号保存到%begin_row_num%,起始列名保存到%beigin_column_name%,结束行号保存到%end_row_num%,结束列名保存到%end_column_name%", + "description": "获取当前Sheet页选中区域", + "icon": "BlockIcons/9-26.png", + "function": "xbot_visual.excel.get_selected_range", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/获取选中区域.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + } + ], + "outputs": [ + { + "id": "begin_row_num", + "label": "起始行号保存至", + "variableLabel": "选中区域起始行号", + "tips": "指定一个变量名称,该变量用于保存选中区域的起始行号", + "type": "int", + "name": "begin_row_num" + }, + { + "id": "beigin_column_name", + "label": "起始列名保存至", + "variableLabel": "选中区域起始列名", + "tips": "指定一个变量名称,该变量用于保存选中区域的起始列名", + "type": "str", + "name": "begin_column_name" + }, + { + "id": "end_row_num", + "label": "结束行号保存至", + "variableLabel": "选中区域结束行号", + "tips": "指定一个变量名称,该变量用于保存选中区域的结束行号", + "type": "int", + "name": "end_row_num" + }, + { + "id": "end_column_name", + "label": "结束列名保存至", + "variableLabel": "选中区域结束列名", + "tips": "指定一个变量名称,该变量用于保存选中区域的结束列名", + "type": "str", + "name": "end_column_name" + } + ] + }, + { + "name": "excel.clear_range", + "title": "清空Excel内容", + "icon": "BlockIcons/9-18.png", + "comment": "从Excel对象%workbook%中清空单元格(第%cell_row_num%行,第%cell_column_name%列)中的内容", + "description": "从Excel文件中清空内容或格式", + "function": "xbot_visual.excel.clear_range", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/清空excel内容.html", + "keywords": "格式,清空表格", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.ClearRangeFromWorkBookControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.ClearRangeFromWorkBookHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "clear_target", + "label": "清除内容", + "default": "13:all", + "tips": "选择清除内容:全部、内容、格式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all" + }, + { + "display": "内容", + "value": "content" + }, + { + "display": "格式", + "value": "format" + } + ] + } + }, + { + "name": "clear_way", + "label": "清空方式", + "required": true, + "default": "10:cell", + "defaultDisplay": "单元格", + "tips": "选择清空的区域,单元格、多行、多列、区域等", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单元格", + "value": "cell" + }, + { + "display": "行内容", + "value": "row" + }, + { + "display": "列内容", + "value": "column" + }, + { + "display": "区域内容", + "value": "range" + }, + { + "display": "已使用区域内容", + "value": "used_range" + } + ] + } + }, + { + "name": "range", + "label": "区域", + "tips": "区域", + "type": "str", + "editor": { + "kind": "excelrange" + } + }, + { + "name": "cell_row_num", + "label": "行号", + "required": false, + "tips": "行号从1开始。若清空方式为‘行内容’,可以填写多行,多行用1,2,3或1:3,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "cell_column_name", + "label": "列名", + "required": false, + "tips": "列名(支持A或1)。若清空方式为‘列内容’,多列用A,B,C或A:C,-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "area_begin_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "area_begin_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "area_end_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "area_end_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "row_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "column_column_name", + "label": "列名", + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.copy_range", + "title": "拷贝Excel内容", + "icon": "BlockIcons/9-16.png", + "keywords": "复制Excel", + "comment": "从Excel对象%workbook%中拷贝单元格(第%cell_row_num%行,第%cell_column_name%列)中的内容", + "description": "从Excel文件中拷贝内容", + "function": "xbot_visual.excel.copy_range", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/拷贝excel内容.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.CopyRangeFromWorkBookControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.CopyRangeFromWorkBookHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "copy_way", + "label": "拷贝方式", + "required": true, + "default": "10:cell", + "defaultDisplay": "单元格", + "tips": "可拷贝单元格、多行、多列或区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单元格", + "value": "cell" + }, + { + "display": "行内容", + "value": "row" + }, + { + "display": "列内容", + "value": "column" + }, + { + "display": "区域内容", + "value": "range" + }, + { + "display": "已使用区域内容", + "value": "used_range" + } + ] + } + }, + { + "name": "range", + "label": "区域", + "tips": "区域", + "type": "str", + "editor": { + "kind": "excelrange" + } + }, + { + "name": "cell_row_num", + "label": "行号", + "required": false, + "tips": "行号从1开始。若拷贝方式为‘行内容’,可以填写多行,多行用1,2,3或1:3,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "cell_column_name", + "label": "列名", + "required": false, + "tips": "列名从A或1开始。拷贝方式为‘列内容’,可以填写多列,多列用A,B,C或A:C,-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "area_begin_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "area_begin_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "area_end_row_num", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "area_end_column_name", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "row_row_num", + "label": "行号", + "required": false, + "tips": "行号", + "type": "any", + "editor": { + "placeholder": "输入行号,多行用1,2,3或1:3,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "column_column_name", + "label": "列名", + "tips": "列名", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.paste_range", + "title": "粘贴Excel内容", + "comment": "在Excel对象%workbook%中单元格(第%row_num%行,第%column_name%列)处粘贴内容", + "description": "将剪切板中内容粘贴到Excel中,内容可通过拷贝Excel指令或者剪切板获取", + "icon": "BlockIcons/9-29.png", + "function": "xbot_visual.excel.paste_range", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/粘贴excel内容.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "row_num", + "label": "单元格行号", + "required": true, + "default": "10:1", + "tips": "待粘贴的单元格行号", + "type": "int", + "editor": { + "placeholder": "输入行号,从1开始", + "kind": "textbox" + } + }, + { + "name": "column_name", + "label": "单元格列名", + "required": true, + "tips": "待粘贴的单元格列名", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1)", + "kind": "textbox" + } + }, + { + "name": "copy_formula", + "label": "", + "default": "13:True", + "tips": "勾选时,表示拷贝单元格公式;未勾选时,表示只拷贝单元格值", + "type": "bool", + "editor": { + "label": "拷贝单元格公式", + "kind": "checkbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.paste_range_ex", + "title": "粘贴Excel内容", + "comment": "在Excel对象%workbook%中单元格(第%row_num%行,第%column_name%列)处粘贴内容", + "description": "粘贴Excel内容", + "icon": "BlockIcons/9-29.png", + "function": "xbot_visual.excel.paste_range_ex", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/粘贴excel内容.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.PasteRangeFromWorkBookHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "row_num", + "label": "单元格行号", + "default": "10:1", + "required": true, + "tips": "待粘贴的单元格行号,从1开始,-n表示倒数第n行", + "type": "int", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "column_name", + "label": "单元格列名", + "required": true, + "tips": "待粘贴的单元格列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "paste_type", + "label": "选择性粘贴", + "required": true, + "default": "10:-4104", + "defaultDisplay": "选择粘贴类型", + "tips": "选择粘贴类型", + "type": "int", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": -4104 + }, + { + "display": "公式", + "value": -4123 + }, + { + "display": "数值", + "value": -4163 + }, + { + "display": "格式", + "value": -4122 + }, + { + "display": "批注", + "value": -4144 + }, + { + "display": "有效性验证", + "value": 6 + }, + { + "display": "所有使用源主题的单元", + "value": 13 + }, + { + "display": "边框除外", + "value": 7 + }, + { + "display": "列宽", + "value": 8 + }, + { + "display": "公式和数字格式", + "value": 11 + }, + { + "display": "值和数字格式", + "value": 12 + }, + { + "display": "所有合并条件格式", + "value": 14 + } + ] + } + }, + { + "name": "paste_special_operation", + "label": "粘贴运算", + "required": true, + "default": "10:-4142", + "defaultDisplay": "选择粘贴运算方式", + "tips": "选择粘贴运算方式", + "type": "int", + "editor": { + "kind": "select", + "options": [ + { + "display": "无", + "value": -4142 + }, + { + "display": "加", + "value": 2 + }, + { + "display": "减", + "value": 3 + }, + { + "display": "乘", + "value": 4 + }, + { + "display": "除", + "value": 5 + } + ] + } + }, + { + "name": "skip_blanks", + "label": "", + "default": "13:False", + "tips": "是否跳过空单元", + "type": "bool", + "editor": { + "label": "跳过空单元", + "kind": "checkbox" + } + }, + { + "name": "transpose", + "label": "", + "default": "13:False", + "tips": "是否转置", + "type": "bool", + "editor": { + "label": "转置", + "kind": "checkbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.remove_duplicate_row", + "title": "删除重复行", + "comment": "在Excel对象%workbook%中根据第%column_name%列删除重复值", + "description": "实现Excel删除重复值功能", + "keywords": "去重", + "icon": "BlockIcons/9-31.png", + "function": "xbot_visual.excel.remove_duplicate_row", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/删除重复行.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "column_name", + "label": "重复值的列名", + "required": false, + "tips": "检查哪些列的重复信息,输入列名(支持A或1),多列用A,B,C或A:C。若不填,表示所有列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),多列用A,B,C或A:C。 若不填,表示所有列" + } + }, + { + "name": "start_row", + "label": "起始的行号", + "required": false, + "tips": "自定义需要删除的起始行号,默认为第一行,-n表示倒数第n行", + "type": "int", + "default": "10:1", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为第一行,-n表示倒数第n行" + } + }, + { + "name": "contain_header", + "label": "", + "default": "13:False", + "tips": "勾选时,表示第一行是标题,不参与重复值计算;不勾选时,表示第一行也参与重复值计算", + "type": "bool", + "editor": { + "label": "数据包含标题", + "kind": "checkbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.rename_sheet", + "title": "重命名Sheet页", + "comment": "在Excel对象%workbook%中将Sheet页%sheet_name%重命名为%new_sheet_name%", + "description": "重命名Sheet页", + "icon": "BlockIcons/9-32.png", + "function": "xbot_visual.excel.rename_sheet", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/sheet页操作/重命名sheet页.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "required": true, + "tips": "输入待修改的Sheet页名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "new_sheet_name", + "label": "新的Sheet页名称", + "required": true, + "tips": "输入新的Sheet页名称", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "excel.refresh_data", + "title": "刷新Excel数据", + "keywords": "刷新表格数据", + "comment": "在Excel对象%workbook%中刷新当前工作簿的所有源,以获取最新的数据", + "description": "刷新Excel数据", + "icon": "BlockIcons/9-33.png", + "function": "xbot_visual.excel.refresh_data", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/刷新excel数据.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + } + ] + }, + { + "name": "excel.insert_row", + "title": "插入空行", + "keywords": "添加行;插入行;新增行", + "comment": "在Excel对象%workbook%中第%row_num%行之前插入%amount%行空行", + "description": "在Excel表格中插入空行", + "icon": "BlockIcons/9-34.png", + "function": "xbot_visual.excel.insert_blank_row", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/插入行.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "row_num", + "label": "在第几行之前", + "required": true, + "default": "10:1", + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "int", + "editor": { + "placeholder": "输入行号,从1开始,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "amount", + "label": "插入几行", + "required": true, + "default": "10:1", + "tips": "插入几行,默认1行", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.insert_column", + "title": "插入空列", + "keywords": "添加列;插入列;新增列", + "comment": "在Excel对象%workbook%中第%column_name%列之前插入%amount%列空列", + "description": "在Excel表格中插入空列", + "icon": "BlockIcons/9-35.png", + "function": "xbot_visual.excel.insert_blank_column", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/插入列.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "column_name", + "label": "在第几列之前", + "required": true, + "tips": "在第几列之前插入,列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "amount", + "label": "插入几列", + "required": true, + "default": "10:1", + "tips": "插入几列,默认1列", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.set_format", + "title": "设置格式", + "icon": "BlockIcons/9-36.png", + "description": "设置单元格格式:数字、对齐、字体、边框、填充、保护", + "comment": "在Excel对象%workbook%中设置单元格格式", + "function": "xbot_visual.excel.set_format", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/设置格式.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.SetFormatControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.SetFormatHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "setting", + "label": "格式设置", + "required": true, + "tips": "可直接在此设置简单的格式,复杂的格式可事先在Excel中设置好,再点击编辑格式内的‘在Excel中指出’提取", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "range_type", + "label": "区域", + "required": true, + "default": "10:cell", + "defaultDisplay": "单元格", + "tips": "指定需要设置格式的区域,单元格、多行、多列、区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单元格", + "value": "cell" + }, + { + "display": "区域", + "value": "range" + }, + { + "display": "行", + "value": "row" + }, + { + "display": "列", + "value": "column" + }, + { + "display": "已使用区域", + "value": "used_range" + } + ] + } + }, + { + "name": "range", + "label": "区域", + "tips": "区域", + "type": "str", + "editor": { + "kind": "excelrange" + } + }, + { + "name": "start_row", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始。若区域为行,可以填写多行,多行用1,2,3或1:3,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "start_column", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1)。若区域为列,可以填写多列,多列用A,B,C或A:C,-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "end_row", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "end_column", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.clear_format", + "title": "清空格式", + "icon": "BlockIcons/9-37.png", + "description": "清空单元格格式", + "comment": "在Excel对象%workbook%中清空单元格格式", + "function": "xbot_visual.excel.clear_fomat", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/清空格式.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.ClearFormatControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.ClearFormatHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "range_type", + "label": "区域", + "required": true, + "default": "10:cell", + "defaultDisplay": "单元格", + "tips": "指定清空格式的区域,单元格、多行、多列、区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单元格", + "value": "cell" + }, + { + "display": "区域", + "value": "range" + }, + { + "display": "行", + "value": "row" + }, + { + "display": "列", + "value": "column" + }, + { + "display": "已使用区域", + "value": "used_range" + } + ] + } + }, + { + "name": "range", + "label": "区域", + "tips": "区域", + "type": "str", + "editor": { + "kind": "excelrange" + } + }, + { + "name": "start_row", + "label": "行号", + "required": false, + "tips": "输入行号从1开始。若区域为行,可以填写多行,多行用1,2,3或1:3,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "start_column", + "label": "列名", + "required": false, + "tips": "输入列名从A或1开始。若区域为列,可以填写多列,多列用A,B,C或A:C,-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名,从A或1开始,-n表示倒数第n列" + } + }, + { + "name": "end_row", + "label": "行号", + "required": false, + "tips": "输入行号,从1开始,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,从1开始,-n表示倒数第n行" + } + }, + { + "name": "end_column", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n行列" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.set_row_height", + "title": "设置行高", + "icon": "BlockIcons/9-38.png", + "description": "设置行高", + "comment": "在Excel对象%workbook%中设置第%row_num%行的高度为%height%", + "function": "xbot_visual.excel.set_row_height", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/设置行高.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.SetRowHeightControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.SetRowHeightHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "row_num", + "label": "行号", + "required": true, + "tips": "输入行号,多行用1,2,3或1:3", + "type": "any", + "editor": { + "placeholder": "输入行号,多行用1,2,3或1:3", + "kind": "textbox" + } + }, + { + "name": "mode", + "label": "方式", + "required": true, + "default": "10:autoFit", + "defaultDisplay": "根据内容自适应高度", + "tips": "两种方式:根据内容自适应高度、指定行高", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据内容自适应高度", + "value": "autoFit" + }, + { + "display": "指定行高", + "value": "specific" + } + ] + } + }, + { + "name": "height", + "label": "行高", + "required": false, + "tips": "行高", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.set_column_width", + "title": "设置列宽", + "icon": "BlockIcons/9-39.png", + "description": "设置列宽", + "comment": "在Excel对象%workbook%中设置第%column_name%列宽度为%width%", + "function": "xbot_visual.excel.set_column_width", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/设置列宽.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.SetColumnWidthControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.SetColumnWidthHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "column_name", + "label": "列名", + "required": true, + "tips": "输入列名(支持A或1),多列用A,B,C", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),多列用A,B,C" + } + }, + { + "name": "mode", + "label": "方式", + "required": true, + "default": "10:autoFit", + "defaultDisplay": "根据内容自适应宽度", + "tips": "两种方式:根据内容自适应宽度、指定列宽", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据内容自适应宽度", + "value": "autoFit" + }, + { + "display": "指定列宽", + "value": "specific" + } + ] + } + }, + { + "name": "width", + "label": "列宽", + "required": false, + "tips": "列宽", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.create_pivot_table", + "title": "新建数据透视表", + "icon": "BlockIcons/9-40.png", + "description": "新建数据透视表", + "comment": "在Excel对象%workbook%中新建数据透视表", + "function": "xbot_visual.excel.create_pivot_table", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/新建数据透视表.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.CreatePivotTableControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "setting", + "label": "透视表设置", + "required": true, + "tips": "在Excel中完成透视表的设置,再点击此处的‘在Excel中指出’提取透视表的配置信息", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "source", + "label": "数据源", + "required": true, + "tips": "设置透视表的数据源", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "excel.refresh_pivot_table", + "title": "刷新数据透视表", + "icon": "BlockIcons/9-41.png", + "description": "刷新数据透视表", + "comment": "在Excel对象%workbook%中刷新数据透视表", + "function": "xbot_visual.excel.refresh_pivot_table", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/刷新数据透视表.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.RefreshPivotTableControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "所在Sheet页名称", + "tips": "透视所在Sheet页名称", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + }, + { + "name": "name_or_index", + "label": "透视表名称或位置", + "required": true, + "default": "10:1", + "tips": "若一个Sheet页中只有一个数据透视表,填1即可,若有多个,可填写透视表名称或位置(从1开始)", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "excel.filter_pivot_table", + "title": "筛选数据透视表", + "icon": "BlockIcons/9-46.png", + "description": "筛选数据透视表", + "comment": "在Excel对象%workbook%中筛选数据透视表,筛选字段为%field_name%,筛选项为%filter_value_list%", + "function": "xbot_visual.excel.filter_pivot_table", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/筛选数据透视表.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.FilterPivotTableControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.FilterPivotTableHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "所在Sheet页名称", + "tips": "透视所在Sheet页名称", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + }, + { + "name": "name_or_index", + "label": "透视表名称或位置", + "required": true, + "default": "10:1", + "tips": "若一个Sheet页中只有一个数据透视表,填1即可,若有多个,可填写透视表名称或位置(从1开始)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "field_name", + "label": "筛选器名称", + "required": true, + "tips": "输入筛选器字段名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "select_type", + "label": "选择方式", + "required": true, + "default": "10:partial", + "defaultDisplay": "部分选择", + "tips": "可选择全部选择和部分选择", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部选择", + "value": "all" + }, + { + "display": "部分选择", + "value": "partial" + } + ] + } + }, + { + "name": "filter_value_list", + "label": "筛选器内容", + "tips": "输入筛选器内容列表", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "excel.add_validation", + "title": "新增数据验证", + "icon": "BlockIcons/9-42.png", + "description": "新增数据验证", + "comment": "在Excel对象%workbook%中新增数据验证", + "function": "xbot_visual.excel.add_validation", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/新增数据验证.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.AddValidationControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.AddValidationHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "setting", + "label": "数据验证设置", + "required": true, + "tips": "在Excel中将数据验证设置完成后,通过点击此处的‘在Excel内指出’提取设置信息", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "range_type", + "label": "区域", + "required": true, + "default": "10:cell", + "defaultDisplay": "单元格", + "tips": "可选择单元格、多行、多列和区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单元格", + "value": "cell" + }, + { + "display": "区域", + "value": "range" + }, + { + "display": "行", + "value": "row" + }, + { + "display": "列", + "value": "column" + }, + { + "display": "已使用区域", + "value": "used_range" + } + ] + } + }, + { + "name": "range", + "label": "区域", + "tips": "区域", + "type": "str", + "editor": { + "kind": "excelrange" + } + }, + { + "name": "start_row", + "label": "行号", + "required": false, + "tips": "输入行号,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,-n表示倒数第n行" + } + }, + { + "name": "start_column", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "end_row", + "label": "行号", + "required": false, + "tips": "输入行号,-n表示倒数第n行", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入行号,-n表示倒数第n行" + } + }, + { + "name": "end_column", + "label": "列名", + "required": false, + "tips": "输入列名(支持A或1),-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),-n表示倒数第n列" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.custom_sort", + "title": "Excel排序", + "keywords": "Excel升序;Excel降序;表格排序", + "icon": "BlockIcons/9-45.png", + "description": "对Excel指定列做升序、降序,或者指定区域做自定义排序操作", + "comment": "在Excel对象%workbook%中新增排序", + "function": "xbot_visual.excel.custom_sort", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/高级指令/excel自定义排序.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.CustomSortControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.CustomSortHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sort_way", + "label": "排序方法", + "required": true, + "default": "10:ascending", + "defaultDisplay": "升序", + "tips": "可选择排序方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "升序", + "value": "ascending" + }, + { + "display": "降序", + "value": "descending" + }, + { + "display": "自定义排序", + "value": "custom_sort" + } + ] + } + }, + { + "name": "sort_column", + "label": "排序列", + "default": "10:", + "required": false, + "tips": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列", + "useVariableOptions": false + } + }, + { + "name": "is_expand_selected_area", + "label": "", + "required": false, + "default": "13:True", + "tips": "", + "type": "bool", + "editor": { + "label": "扩展选定区域", + "kind": "checkbox" + } + }, + { + "name": "is_firstline_notsort", + "label": "", + "required": false, + "default": "13:True", + "tips": "", + "type": "bool", + "editor": { + "label": "首行不参与排序", + "kind": "checkbox" + } + }, + { + "name": "sort_setting", + "label": "自定义排序设置", + "required": false, + "tips": "在Excel中将自定义排序设置完成后,通过点击此处的‘在Excel内指出’提取设置信息", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "range_type", + "label": "区域", + "required": false, + "default": "10:used_range", + "defaultDisplay": "已使用区域", + "tips": "可选择区域,行,列和已使用区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "区域", + "value": "range" + }, + { + "display": "行", + "value": "row" + }, + { + "display": "列", + "value": "column" + }, + { + "display": "已使用区域", + "value": "used_range" + } + ] + } + }, + { + "name": "range", + "label": "区域", + "tips": "区域", + "type": "str", + "editor": { + "kind": "excelrange" + } + }, + { + "name": "start_row", + "label": "行号", + "required": false, + "tips": "起始行号从1开始。若区域为行,可以填写多行,多行用1,2,3或1:3", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "起始行号,从1开始" + } + }, + { + "name": "start_column", + "label": "起始列名", + "required": false, + "tips": "起始列名从A或1开始。若区域为列,可以填写多列,多列用A,B,C或A:C", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "列名,从A或1开始" + } + }, + { + "name": "end_row", + "label": "行号", + "required": false, + "tips": "结束行号,从1开始", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "结束行号,从1开始" + } + }, + { + "name": "end_column", + "label": "列名", + "required": false, + "tips": "结束列名(支持A或1)", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "结束列名,从A或1开始" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + }, + { + "name": "excel.export_to_pdf", + "title": "导出为PDF", + "icon": "BlockIcons/9-43.png", + "description": "导出为PDF", + "comment": "将Excel对象%workbook%导出为PDF文件到%pdf_name%", + "function": "xbot_visual.excel.export_to_pdf", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/导出为pdf.html", + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在的工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + }, + { + "name": "all_sheets", + "label": "", + "default": "13:False", + "tips": "若勾选,导出所有工作表", + "type": "bool", + "editor": { + "label": "全部Sheet页", + "kind": "checkbox" + } + }, + { + "name": "pdf_name", + "label": "PDF保存到", + "tips": "填写要导出的PDF保存的文件名", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "filter": "PDF|*.pdf" + } + } + }, + { + "name": "override", + "label": "", + "default": "13:True", + "tips": "如果PDF文件存在则覆盖,PDF保存路径若不存在会自动创建", + "type": "bool", + "editor": { + "label": "如果文件存在则覆盖", + "kind": "checkbox" + } + } + ] + }, + { + "name": "excel.set_hidden", + "title": "设置行列隐藏", + "icon": "BlockIcons/9-44.png", + "comment": "在Excel对象%workbook%中隐藏第%row_num%行", + "description": "隐藏/取消隐藏Excel行列", + "function": "xbot_visual.excel.set_hidden", + "helpUrl": "yddoc/language/zh-cn/指令文档/excel/读写操作/设置行列隐藏.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Excel.SetHiddenControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Excel.SetHiddenHandler" + } + ], + "inputs": [ + { + "name": "workbook", + "label": "Excel对象", + "required": true, + "tips": "输入一个通过\"新建Excel\"或\"打开Excel\"创建的Excel对象", + "type": "openpyxl.Workbook", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "hidden_property", + "label": "状态", + "required": true, + "default": "10:True", + "defaultDisplay": "隐藏", + "tips": "用于设置Excel行列的隐藏属性", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "隐藏", + "value": "True" + }, + { + "display": "取消隐藏", + "value": "False" + } + ] + } + }, + { + "name": "range_type", + "label": "区域", + "required": true, + "default": "10:row", + "defaultDisplay": "行", + "tips": "指定要隐藏/取消隐藏的行或者列", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "行", + "value": "row" + }, + { + "display": "列", + "value": "column" + } + ] + } + }, + { + "name": "row_num", + "label": "行号", + "tips": "输入行号,多行用1,2,3或1:3,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,多行用1,2,3或1:3,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "column_name", + "label": "列名", + "tips": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "default": "10:", + "tips": "所在工作表名称,选填,默认为当前激活的Sheet页", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "选填,默认为当前激活的Sheet页" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/file.blocks.json b/src/assert/block_settings/file.blocks.json new file mode 100644 index 0000000..ac29d8b --- /dev/null +++ b/src/assert/block_settings/file.blocks.json @@ -0,0 +1,651 @@ +{ + "types": [ + { + "name": "xbot_visual.file.FileParts", + "localName": "文件路径信息", + "props": [ + { + "name": "drive_name", + "type": "str", + "label": "根目录" + }, + { + "name": "directory", + "type": "str", + "label": "父目录" + }, + { + "name": "file_name", + "type": "str", + "label": "文件名称" + }, + { + "name": "file_name_without_extension", + "type": "str", + "label": "文件名称(不带扩展名)" + }, + { + "name": "file_extension", + "type": "str", + "label": "文件扩展名" + } + ] + } + ], + "blocks": [ + { + "name": "file.if_exist", + "statement": "workflow.if", + "function": "xbot_visual.file.if_exist", + "title": "IF 文件存在", + "description": "判断文件是否存在", + "comment": "如果文件%path%%expect_exist%,则执行以下操作", + "indent": "1", + "scope": "1", + "isCondition": true, + "icon": "BlockIcons/18-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/if文件存在.html", + "video": { + "time": "00:47" + }, + "inputs": [ + { + "name": "path", + "label": "文件路径", + "required": true, + "tips": "输入或选择文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + }, + { + "name": "expect_exist", + "label": "文件是否", + "required": true, + "default": "10:exist", + "defaultDisplay": "存在", + "tips": "选择预期的文件是否存在", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "存在", + "value": "exist" + }, + { + "display": "不存在", + "value": "no_exist" + } + ] + } + } + ] + }, + { + "name": "file.remove", + "function": "xbot_visual.file.remove", + "title": "删除文件", + "description": "删除文件,Python模式支持多文件删除,文本模式只支持单文件删除", + "comment": "删除文件%paths%", + "icon": "BlockIcons/18-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件/删除文件.html", + "inputs": [ + { + "name": "paths", + "label": "要删除的文件", + "required": true, + "tips": "输入要删除的文件的路径,若想删除多个文件,切换到Python模式,比如['文件1路径','文件2路径']", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + } + ] + }, + { + "name": "file.read", + "function": "xbot_visual.file.read", + "title": "读取文件", + "description": "读取指定路径文件的内容", + "comment": "读取文件%path%的内容,将内容保存到%file_content%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.File.ReadFile, ShadowBot.Shell.Development", + "icon": "BlockIcons/18-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件/读取文件.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.File.ReadHandler" + } + ], + "inputs": [ + { + "name": "path", + "label": "要读取的文件", + "required": true, + "tips": "输入要读取文件的路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + }, + { + "name": "read_way", + "label": "文件内容保存为", + "required": false, + "default": "10:all_text", + "defaultDisplay": "文本", + "tips": "指定输出的文件内容,可以选择“文本”可以将整个文件保存到一个文本中,选择“列表”按行获取文本内容并存储到列表中,选择“二进制文本”将读取的文本再转为二进制", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "文本", + "value": "all_text" + }, + { + "display": "列表(每行保存为列表一项)", + "value": "lines" + }, + { + "display": "二进制文本", + "value": "bin" + } + ] + } + }, + { + "name": "encoding", + "label": "文件编码", + "required": false, + "default": "10:UTF-8", + "defaultDisplay": "UTF-8", + "tips": "选择文本编码", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "默认", + "value": "default" + }, + { + "display": "ANSI", + "value": "ANSI" + }, + { + "display": "UTF-8", + "value": "UTF-8" + }, + { + "display": "UTF-16", + "value": "UTF-16" + }, + { + "display": "UTF-16 BE", + "value": "utf-16-be" + } + ] + } + } + ], + "outputs": [ + { + "id": "file_content", + "label": "保存文件内容至", + "variableLabel": "读取的文件内容", + "tips": "输入一个名字,用来保存文件内容", + "type": "any", + "name": "file_content" + } + ] + }, + { + "name": "file.write", + "function": "xbot_visual.file.write", + "title": "写入文件", + "description": "将文本内容写入到已有文件,若文件不存在,自动创建文件", + "comment": "将内容%content%覆盖写入到文件%path%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.File.WriteFile, ShadowBot.Shell.Development", + "icon": "BlockIcons/18-4.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件/写入文件.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.File.WriteHandler" + } + ], + "inputs": [ + { + "name": "path", + "label": "要写入的文件", + "required": true, + "tips": "输入文件路径,文件若不存在,会自动创建文件", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + }, + { + "name": "content", + "label": "要写入的内容", + "required": true, + "tips": "待写入文件的内容", + "type": "any", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "write_way", + "label": "如果文件存在", + "required": true, + "default": "10:overwrite", + "defaultDisplay": "覆盖写入", + "tips": "指定当要写入的文件存在时要执行的操作", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖写入", + "value": "overwrite" + }, + { + "display": "追加写入", + "value": "append" + } + ] + } + }, + { + "name": "is_text", + "label": "", + "required": true, + "tips": "文件是文本文件", + "type": "bool", + "default": "13:True", + "editor": { + "label": "文件是文本文件", + "kind": "checkbox" + } + }, + { + "name": "new_line", + "label": "", + "required": false, + "tips": "是否要换新行追加,若否,直接在原内容后面追加", + "type": "bool", + "default": "13:False", + "editor": { + "label": "新行追加", + "kind": "checkbox" + } + }, + { + "name": "encoding", + "label": "文件编码", + "required": false, + "default": "10:UTF-8", + "defaultDisplay": "UTF-8", + "tips": "选择文本编码", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "默认", + "value": "default" + }, + { + "display": "ANSI", + "value": "ANSI" + }, + { + "display": "UTF-8", + "value": "UTF-8" + }, + { + "display": "UTF-16", + "value": "UTF-16" + }, + { + "display": "UTF-16 BE", + "value": "utf-16-be" + } + ] + } + } + ] + }, + { + "name": "file.copy", + "function": "xbot_visual.file.copy", + "title": "拷贝文件", + "keywords": "复制文件", + "description": "拷贝文件,Python模式支持多文件拷贝,文本模式只支持单文件拷贝", + "comment": "将文件%source_file_paths%拷贝到文件夹%copyto_dir_path%,将拷贝后的文件路径列表保存到%file_list%", + "icon": "BlockIcons/18-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件/拷贝文件.html", + "inputs": [ + { + "name": "source_file_paths", + "label": "要拷贝的文件", + "required": true, + "tips": "输入要拷贝文件的路径,若想拷贝多个文件,切换到Python模式,比如['D:\\测试\\11.txt','D:\\测试\\22.txt']", + "type": "any", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + }, + { + "name": "copyto_dir_path", + "label": "目标文件夹", + "required": true, + "tips": "输入目标文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "copy_way", + "label": "如果文件存在", + "required": true, + "default": "10:overwrite", + "defaultDisplay": "覆盖", + "tips": "指定当目标文件夹下已存在同名文件时要执行的操作", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖", + "value": "overwrite" + }, + { + "display": "不要拷贝", + "value": "not_copy" + }, + { + "display": "自动添加后缀", + "value": "save_as" + } + ] + } + } + ], + "outputs": [ + { + "id": "file_list", + "label": "拷贝后的文件路径列表", + "variableLabel": "拷贝后的文件路径列表", + "tips": "输入一个名字,用来保存拷贝后的文件路径列表", + "type": "list", + "name": "file_list" + } + ] + }, + { + "name": "file.move", + "function": "xbot_visual.file.move", + "title": "移动文件", + "description": "移动文件,Python模式支持多文件移动,文本模式只支持单文件移动", + "comment": "将文件%source_file_paths%移动到文件夹%moveto_dir_path%,将移动后的文件路径列表保存到%file_list%", + "icon": "BlockIcons/18-6.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件/移动文件.html", + "inputs": [ + { + "name": "source_file_paths", + "label": "要移动的文件", + "required": true, + "tips": "输入要移动文件的路径,若想移动多个文件,切换到Python模式,比如['D:\\测试\\11.txt','D:\\测试\\22.txt']", + "type": "any", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + }, + { + "name": "moveto_dir_path", + "label": "目标文件夹", + "required": true, + "tips": "输入目标文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "move_way", + "label": "如果文件存在", + "required": true, + "default": "10:overwrite", + "defaultDisplay": "覆盖", + "tips": "指定当目标文件夹下已存在同名文件时要执行的操作", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖", + "value": "overwrite" + }, + { + "display": "不要移动", + "value": "not_copy" + } + ] + } + } + ], + "outputs": [ + { + "id": "file_list", + "label": "移动后的文件路径列表", + "variableLabel": "移动后的文件路径列表", + "tips": "输入一个名字,移动后的文件路径列表", + "type": "list", + "name": "file_list" + } + ] + }, + { + "name": "file.get_file_parts", + "function": "xbot_visual.file.get_file_parts", + "title": "获取文件路径信息", + "description": "获取文件路径的根目录、父目录、文件名、基本文件名和文件扩展名", + "comment": "解析文件%path%信息,将结果保存到%file_parts%", + "icon": "BlockIcons/18-8.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件/获取文件路径信息.html", + "inputs": [ + { + "name": "path", + "label": "文件路径", + "required": true, + "tips": "输入文件路径", + "type": "any", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + } + ], + "outputs": [ + { + "id": "file_parts", + "label": "文件路径信息", + "variableLabel": "文件路径信息", + "tips": "输入一个名字,用来保存文件路径信息", + "type": "xbot_visual.file.FileParts", + "name": "file_parts" + } + ] + }, + { + "name": "file.wait", + "function": "xbot_visual.file.wait", + "title": "等待文件", + "description": "等待文件被创建或者删除", + "comment": "等待文件%path%被%desired_state%,最多等待%timeout%秒", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.File.WaitFileControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.File.WaitFileHandler" + } + ], + "icon": "BlockIcons/18-9.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/等待/等待文件.html", + "video": { + "time": "04:46" + }, + "inputs": [ + { + "name": "path", + "label": "文件路径", + "required": true, + "tips": "输入文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + }, + { + "name": "desired_state", + "label": "等待文件被", + "required": true, + "default": "10:created", + "defaultDisplay": "创建", + "tips": "选择期望的文件状态", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "创建", + "value": "created" + }, + { + "display": "删除", + "value": "deleted" + } + ] + } + }, + { + "name": "is_wait", + "label": "", + "required": true, + "tips": "设置超时时间", + "type": "bool", + "default": "13:True", + "editor": { + "label": "设置超时时间", + "kind": "checkbox" + } + }, + { + "name": "timeout_seconds", + "label": "超时时间(秒)", + "required": false, + "default": "10:20", + "tips": "请输入超时时间(秒),", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "file_wait_result", + "label": "等待结果", + "tips": "如果为True则等待成功,否则等待超时", + "name": "file_wait_result", + "type": "bool" + } + ] + }, + { + "name": "file.rename", + "function": "xbot_visual.file.rename", + "title": "文件重命名", + "description": "文件重命名", + "comment": "将文件%path%重命名为%new_name%,将新的文件路径保存到%new_file_path%", + "icon": "BlockIcons/18-10.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/文件/文件重命名.html", + "inputs": [ + { + "name": "path", + "label": "要重命名的文件", + "required": true, + "tips": "输入或选择要重命名的文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + }, + { + "name": "new_name", + "label": "新的文件名称", + "required": true, + "tips": "新的文件名称", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "new_file_path", + "label": "新的文件路径", + "variableLabel": "重命名后的文件路径", + "tips": "输入一个名字,用来保存新的文件路径", + "type": "str", + "name": "new_file_path" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/ftp.blocks.json b/src/assert/block_settings/ftp.blocks.json new file mode 100644 index 0000000..68ebfcb --- /dev/null +++ b/src/assert/block_settings/ftp.blocks.json @@ -0,0 +1,684 @@ +{ + "types": [ + { + "name": "xbot.ftp.FTPBase", + "localName": "FTP对象" + } + ], + "blocks": [ + { + "name": "ftp.connection", + "function": "xbot_visual.ftp.connection", + "title": "建立FTP连接", + "description": "创建一个文件服务器连接,并返回连接对象", + "comment": "使用输入密码为用户%user_name%建立%server_kind%(%server_ip%:%server_port%)的连接,将连接对象保存到%ftp_instance%", + "icon": "BlockIcons/32-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/建立ftp连接.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.FTP.ConnectionControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.FTP.ConnectionHandler" + } + ], + "inputs": [ + { + "name": "server_kind", + "label": "服务器类型", + "tips": "要创建的连接对象的服务器类型", + "type": "str", + "required": true, + "default": "10:FTP", + "defaultDisplay": "FTP服务器", + "editor": { + "kind": "select", + "options": [ + { + "display": "FTP服务器", + "value": "FTP" + }, + { + "display": "SFTP服务器", + "value": "SFTP" + } + ] + } + }, + { + "name": "server_ip", + "label": "FTP服务器地址", + "required": true, + "tips": "FTP服务器地址", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "server_port", + "label": "FTP服务器端口", + "required": true, + "tips": "FTP服务器端口", + "default": "10:21", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "is_active", + "label": "", + "default": "13:False", + "tips": "通常更推荐使用ftp被动模式。但如果FTP服务器配置为仅支持主动模式或者服务端网络配置不允许被动模式的数据连接,此时客户端就需要使用主动模式。", + "type": "bool", + "editor": { + "kind": "checkbox", + "label": "启用主动模式" + } + }, + { + "name": "ispasv", + "label": "", + "default": "13:False", + "tips": "当客户端和服务端之间存在连接安全问题如存在防火墙导致服务端无法主动创建数据传输连接时可以启用主动连接模式", + "type": "bool", + "editor": { + "kind": "checkbox", + "label": "启用主动连接" + } + }, + { + "name": "login_kind", + "label": "连接方式", + "tips": "连接远程服务器的方式,默认使用密码连接", + "type": "str", + "required": true, + "default": "10:usePassword", + "defaultDisplay": "密码连接", + "editor": { + "kind": "select", + "options": [ + { + "display": "密码连接", + "value": "usePassword" + }, + { + "display": "密钥连接", + "value": "usePrivateKey" + } + ] + } + }, + { + "name": "user_name", + "label": "用户名", + "required": true, + "tips": "用于连接到FTP服务器的用户名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "password", + "label": "密码", + "tips": "用于连接到FTP服务器的用户密码", + "type": "str", + "default": "10:", + "editor": { + "kind": "password" + } + }, + { + "name": "private_key", + "label": "密钥文件", + "tips": "用于连接到服务器的密钥文件", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + }, + { + "name": "timeout", + "label": "连接超时时间", + "tips": "FTP连接的超时时间,默认超时时间10s,设置为-1表示一直等待,0表示不等待", + "required": true, + "category": "advanced", + "default": "10:10", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "ftp_instance", + "label": "保存FTP连接对象至", + "tips": "指定一个变量名称,该变量用于保存FTP连接对象", + "name": "ftp_instance", + "type": "xbot.ftp.FTPBase" + } + ] + }, + { + "name": "ftp.disconnection", + "function": "xbot_visual.ftp.disconnection", + "title": "断开FTP连接", + "description": "断开当前FTP连接", + "comment": "断开当前%ftp%连接", + "icon": "BlockIcons/32-12.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/断开ftp连接.html", + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "需要断开连接的FTP对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + } + ] + }, + { + "name": "ftp.get_ftp_files", + "function": "xbot_visual.ftp.get_ftp_files", + "title": "获取全部文件", + "description": "获取FTP服务端当前路径下的全部文件和子文件夹", + "comment": "获取FTP连接%ftp%中当前工作路径下的全部文件和子文件夹,将结果保存到%files_result%", + "icon": "BlockIcons/32-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/获取全部文件.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.FTP.GetFTPFilesBlockHandler" + } + ], + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "需要获取文件和文件夹信息的FTP连接对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + } + ], + "outputs": [ + { + "id": "files_result", + "label": "保存返回的文件至", + "tips": "指定一个变量名称,该变量用于保存返回的文件和子文件数据", + "name": "files_result", + "type": "dict" + } + ] + }, + { + "name": "ftp.change_workspace_path", + "function": "xbot_visual.ftp.change_workspace_path", + "title": "切换工作路径", + "description": "切换FTP连接的工作路径", + "comment": "切换FTP连接%ftp%中的工作路径到%new_remote_path%", + "icon": "BlockIcons/32-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/切换工作路径.html", + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "需要切换工作路径的ftp连接对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + }, + { + "name": "new_remote_path", + "label": "工作路径", + "tips": "需要切换到的新工作路径", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "ftp.download_files", + "function": "xbot_visual.ftp.download_files", + "title": "文件下载(ftp)", + "keywords": "下载文件;FTP下载", + "description": "将FTP远程服务器指定路径下的一个或多个文件下载到本地指定的路径下", + "comment": "将FTP连接%ftp%中的文件%download_files%下载到本地路径%local_path%中,如果本地存在同名文件则%download_mode%", + "icon": "BlockIcons/32-4.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/文件下载.html", + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "要下载的文件的ftp连接对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + }, + { + "name": "download_files", + "label": "远程文件(文件列表)", + "tips": "需要下载的文件或文件列表", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "local_path", + "label": "本地路径", + "tips": "远程文件将要下载到本地的路径", + "required": true, + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "download_mode", + "label": "下载模式", + "tips": "需要下载的文件在本地文件夹存在时的处理方式", + "type": "str", + "required": true, + "default": "10:overwrite", + "defaultDisplay": "覆盖", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖", + "value": "overwrite" + }, + { + "display": "放弃下载", + "value": "notdownload" + }, + { + "display": "自动生成文件名", + "value": "uniquename" + } + ] + } + } + ] + }, + { + "name": "ftp.download_folders", + "function": "xbot_visual.ftp.download_folders", + "title": "文件夹下载(ftp)", + "keywords": "下载文件夹;FTP下载", + "description": "将FTP远程服务器指定路径下的一个或多个文件夹下载到本地指定的路径下", + "comment": "将FTP连接%ftp%中的文件夹%remote_paths%下载到本地路径%local_path%中", + "icon": "BlockIcons/32-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/文件夹下载.html", + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "要下载的文件夹的ftp连接对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + }, + { + "name": "remote_paths", + "label": "远程文件夹(文件夹列表)", + "tips": "下载文件夹的远程路径,不填则默认下载当前工作路径", + "required": true, + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "local_path", + "label": "本地路径", + "tips": "文件夹下载保存的本地路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "download_mode", + "label": "子文件存在时", + "tips": "需要下载的文件夹中子文件在本地文件夹存在时的处理方式", + "type": "str", + "required": true, + "default": "10:overwrite", + "defaultDisplay": "覆盖", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖", + "value": "overwrite" + }, + { + "display": "放弃下载", + "value": "notdownload" + }, + { + "display": "自动生成文件名", + "value": "uniquename" + } + ] + } + } + ] + }, + { + "name": "ftp.uoload_files", + "function": "xbot_visual.ftp.upload_files", + "title": "文件上传(ftp)", + "keywords": "上传文件;FTP上传", + "description": "将本地一个或多个文件上传到FTP远程服务的指定路径下", + "comment": "将本地文件%local_files%上传到FTP连接%ftp%中指定的路径%remote_path%下,如果远程路径下存在同名文件则%upload_mode%", + "icon": "BlockIcons/32-6.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/文件上传.html", + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "文件要上传到的FTP连接对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + }, + { + "name": "remote_path", + "label": "远程路径", + "tips": "文件要上传到远程服务器的路径,不填则默认上传到当前工作路径", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "local_files", + "label": "本地文件(文件列表)", + "tips": "要上传的本地文件或文件列表", + "required": true, + "type": "any", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.*)|*.*" + } + } + }, + { + "name": "upload_mode", + "label": "上传模式", + "tips": "要上传的文件在远程服务器上存在时的处理方式", + "type": "str", + "required": true, + "default": "10:overwrite", + "defaultDisplay": "覆盖", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖", + "value": "overwrite" + }, + { + "display": "放弃上传", + "value": "notupload" + }, + { + "display": "自动生成文件名", + "value": "uniquename" + } + ] + } + } + ] + }, + { + "name": "ftp.upload_folders", + "function": "xbot_visual.ftp.upload_folders", + "title": "文件夹上传(ftp)", + "keywords": "上传文件夹;FTP上传", + "description": "将本地一个或多个文件夹上传到FTP远程服务的指定路径下", + "comment": "将本地文件夹%local_folders%上传到FTP连接%ftp%中", + "icon": "BlockIcons/32-7.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/文件夹上传.html", + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "文件夹要上传到的FTP连接对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + }, + { + "name": "remote_path", + "label": "远程路径", + "tips": "本地文件夹需要上传到的远程路径,不填则默认上传到当前工作路径", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "local_folders", + "label": "本地文件夹(文件夹列表)", + "tips": "需要上传到远程服务器的本地的一个或多个文件夹", + "required": true, + "type": "any", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "upload_mode", + "label": "子文件存在时", + "tips": "要上传的文件夹中子文件在远程服务器上存在时的处理方式", + "type": "str", + "required": true, + "default": "10:overwrite", + "defaultDisplay": "覆盖", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖", + "value": "overwrite" + }, + { + "display": "放弃上传", + "value": "notupload" + }, + { + "display": "自动生成文件名", + "value": "uniquename" + } + ] + } + } + ] + }, + { + "name": "ftp.delete_files", + "function": "xbot_visual.ftp.delete_files", + "title": "文件删除(ftp)", + "keywords": "删除文件", + "description": "删除远程路径指定的一个或多个文件", + "comment": "删除FTP连接%ftp%中的文件%remote_files%", + "icon": "BlockIcons/32-8.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/文件删除.html", + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "需要删除文件的FTP远程连接对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + }, + { + "name": "remote_files", + "label": "删除的文件(文件列表)", + "tips": "需要删除的远程文件名称", + "required": true, + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "ftp.rename_file", + "function": "xbot_visual.ftp.rename_file", + "title": "文件重命名(ftp)", + "description": "重命名远程服务器的文件", + "comment": "将FTP连接%ftp%中的文件%remote_file%重命名为%new_name%", + "icon": "BlockIcons/32-9.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/文件重命名.html", + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "需要重命名文件的FTP远程连接对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + }, + { + "name": "remote_file", + "label": "远程文件", + "tips": "需要重命名的远程文件", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "new_name", + "label": "新名称", + "tips": "远程文件重命名后的名称", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "ftp.creat_directory", + "function": "xbot_visual.ftp.creat_directory", + "title": "创建文件夹(ftp)", + "description": "在远程服务器上创建文件夹", + "comment": "在FTP连接%ftp%中创建文件夹%new_remote_path%", + "icon": "BlockIcons/32-10.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/创建文件夹.html", + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "需要创建文件夹的FTP连接对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + }, + { + "name": "new_remote_path", + "label": "新文件夹", + "tips": "需要创建的文件夹名称", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "ftp.delete_folder", + "function": "xbot_visual.ftp.delete_folder", + "title": "删除文件夹(ftp)", + "description": "删除远程服务器上的文件夹", + "comment": "删除FTP连接%ftp%中的文件夹%remote_path%", + "icon": "BlockIcons/32-11.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/ftp/删除文件夹.html", + "inputs": [ + { + "name": "ftp", + "label": "FTP连接对象", + "tips": "需要删除文件夹的FTP连接对象", + "required": true, + "type": "xbot.ftp.FTPBase", + "editor": { + "useVariableOptions": true, + "kind": "select" + } + }, + { + "name": "remote_path", + "label": "远程文件夹", + "tips": "需要删除的文件夹名称,不填则默认删除当前工作路径", + "required": true, + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/image.blocks.json b/src/assert/block_settings/image.blocks.json new file mode 100644 index 0000000..4cb1709 --- /dev/null +++ b/src/assert/block_settings/image.blocks.json @@ -0,0 +1,628 @@ +{ + "types": [], + "blocks": [ + { + "name": "image.wait", + "icon": "BlockIcons/22-3.png", + "description": "等待目标图像出现或消失,再继续执行流程", + "comment": "等待%window_kind%中图像%template_images%出现,最多等待%timeout%秒", + "title": "等待图像", + "keywords": "等待图片", + "function": "xbot_visual.image.wait", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Image.WaitImageControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Image.WaitImageHandler" + } + ], + "helpUrl": "yddoc/language/zh-cn/指令文档/等待/等待图像.html", + "video": { + "time": "06:01" + }, + "inputs": [ + { + "name": "window_kind", + "label": "搜索范围", + "required": true, + "default": "10:screen", + "defaultDisplay": "整个屏幕", + "tips": "搜索范围", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "整个屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "currentactivatewindow" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "required": false, + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "wait_mode", + "label": "等待方式", + "required": true, + "default": "10:appear", + "defaultDisplay": "等待目标图像出现", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "等待目标图像出现", + "value": "appear" + }, + { + "display": "等待目标图像消失", + "value": "disappear" + } + ] + } + }, + { + "name": "template_images", + "label": "目标图像", + "tips": "可从图像库选择多张图,其中任一张\"出现/消失\",则继续执行流程", + "required": true, + "type": "str", + "editor": { + "kind": "images" + } + }, + { + "name": "is_wait_all_images", + "label": "", + "required": true, + "default": "13:False", + "tips": "等待所有图像或者只等待其中一张", + "type": "bool", + "editor": { + "label": "等待全部图像出现(消失)后再执行", + "kind": "checkbox" + } + }, + { + "name": "iswait", + "label": "", + "required": true, + "default": "13:True", + "tips": "设置等待超时时间,超时后流程将自动往下继续执行", + "type": "bool", + "editor": { + "label": "设置超时时间", + "kind": "checkbox" + } + }, + { + "name": "timeout", + "label": "超时时间(秒)", + "default": "10:20", + "tips": "设置最大等待时间", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "wait_result", + "label": "等待结果", + "tips": "如果为True则等待成功,否则等待超时", + "name": "image_wait_result", + "type": "bool" + } + ] + }, + { + "name": "image.hover", + "icon": "BlockIcons/22-2.png", + "description": "鼠标悬停在图像上", + "comment": "在%window_kind%中搜索图像%template_images%,将鼠标移动到图像%anchor_type%位置", + "title": "鼠标悬停在图像上", + "keywords": "悬浮;图片;图形", + "function": "xbot_visual.image.hover", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/鼠标悬停在图像上.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Image.HoverImageControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Image.HoverImageHandler" + } + ], + "inputs": [ + { + "name": "window_kind", + "label": "搜索范围", + "required": true, + "default": "10:screen", + "defaultDisplay": "整个屏幕", + "tips": "搜索范围", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "整个屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "currentactivatewindow" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "required": false, + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "template_images", + "label": "目标图像", + "tips": "可从图像库选择多张图,其中任一张\"出现/消失\",则继续执行流程", + "required": true, + "type": "str", + "editor": { + "kind": "images" + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": true, + "tips": "支持点击元素中心位置(元素矩形区域的中心点)、随机位置(自动随机指定元素矩形范围内的点)、自定义位置(手动指定目标点)", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "label": "目标图像的部位", + "default": "10:middleCenter", + "tips": "选择你要将鼠标移动到图像的哪个部位上", + "required": true, + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "超时时间(秒)", + "default": "10:5", + "tips": "设置最大等待时间", + "category": "advanced", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "delay_after", + "label": "执行后延迟(秒)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + } + ] + }, + { + "name": "image.click", + "icon": "BlockIcons/22-1.png", + "description": "点击图像", + "keywords": "点击图片", + "comment": "在%window_kind%中搜索图像%template_images%,%button%%clicks%点击%anchor_type%位置", + "title": "点击图像", + "function": "xbot_visual.image.click", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/点击图像.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Image.ClickImageControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Image.ClickImageHandler" + } + ], + "inputs": [ + { + "name": "window_kind", + "label": "搜索范围", + "required": true, + "default": "10:screen", + "defaultDisplay": "整个屏幕", + "tips": "搜索范围", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "整个屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "currentactivatewindow" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "required": false, + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "template_images", + "label": "目标图像", + "tips": "可从图像库选择多张图,其中任一张\"出现/消失\",则继续执行流程", + "required": true, + "type": "str", + "editor": { + "kind": "images" + } + }, + { + "name": "anchor_type", + "label": "目标图像的部位", + "required": true, + "tips": "支持点击元素中心位置(元素矩形区域的中心点)、随机位置(自动随机指定元素矩形范围内的点)、自定义位置(手动指定目标点)", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点位置", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "label": "目标图像的部位", + "default": "10:middleCenter", + "tips": "选择你要将鼠标移动到图像的哪个部位上", + "required": true, + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "clicks", + "label": "点击次数", + "required": true, + "default": "10:click", + "defaultDisplay": "单击", + "tips": "选择点击的方式是单击还是双击", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单击", + "value": "click" + }, + { + "display": "双击", + "value": "dbclick" + } + ] + } + }, + { + "name": "button", + "label": "鼠标", + "required": true, + "default": "10:left", + "defaultDisplay": "鼠标左键", + "tips": "选择用于触发点击的鼠标按键", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "鼠标左键", + "value": "left" + }, + { + "display": "鼠标右键", + "value": "right" + } + ] + } + }, + { + "name": "keys", + "label": "键盘", + "required": true, + "default": "10:null", + "defaultDisplay": "无", + "category": "advanced", + "tips": "在点击时需要按下的键盘功能键", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "无", + "value": "null" + }, + { + "display": "Alt", + "value": "alt" + }, + { + "display": "Ctrl", + "value": "ctrl" + }, + { + "display": "Shift", + "value": "shift" + }, + { + "display": "Win", + "value": "win" + } + ] + } + }, + { + "name": "move_mouse", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "是否显示鼠标移动轨迹", + "type": "bool", + "editor": { + "label": "显示鼠标移动轨迹", + "kind": "checkbox" + } + }, + { + "name": "timeout", + "label": "超时时间(秒)", + "default": "10:5", + "tips": "设置最大等待时间", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "delay_after", + "label": "执行后延迟(秒)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + } + ] + }, + { + "name": "image.exist", + "statement": "workflow.if", + "icon": "BlockIcons/22-3.png", + "description": "判断目标图像是否存在", + "comment": "在%window_kind%中,是否%exist_mode%目标图像%template_images%", + "title": "IF 图像存在", + "keywords": "图片存在", + "function": "xbot_visual.image.exist", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Image.ExistImageControl, ShadowBot.Shell.Development", + "indent": "1", + "scope": "1", + "isCondition": true, + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/if图像存在.html", + "video": { + "time": "02:11" + }, + "inputs": [ + { + "name": "window_kind", + "label": "搜索范围", + "required": true, + "default": "10:screen", + "defaultDisplay": "整个屏幕", + "tips": "可选择整个屏幕或指定的窗口", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "整个屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "currentactivatewindow" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "required": false, + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "exist_mode", + "label": "查找方式", + "required": true, + "default": "10:exist", + "defaultDisplay": "存在", + "tips": "指定查找范围内指定的图像存在or不存在", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "存在", + "value": "exist" + }, + { + "display": "不存在", + "value": "notexist" + } + ] + } + }, + { + "name": "template_images", + "label": "目标图像", + "tips": "可从图像库选择多张图像", + "required": true, + "type": "str", + "editor": { + "kind": "images" + } + }, + { + "name": "is_find_all_images", + "label": "", + "required": true, + "default": "13:False", + "tips": "检测所有图像或者只检测其中一张", + "type": "bool", + "editor": { + "label": "全部图像存在(不存在)后再执行", + "kind": "checkbox" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/json.blocks.json b/src/assert/block_settings/json.blocks.json new file mode 100644 index 0000000..7709874 --- /dev/null +++ b/src/assert/block_settings/json.blocks.json @@ -0,0 +1,67 @@ +{ + "types": [], + "blocks": [ + { + "name": "json.to_text", + "function": "xbot_visual.json.to_text", + "title": "Json转换成文本", + "description": "将Json对象转换成文本", + "comment": "将Json对象%json_obj%转换成文本,将结果保存到%text_instance%", + "icon": "BlockIcons/16-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/json转换/转换成文本.html", + "inputs": [ + { + "name": "json_obj", + "label": "Json对象", + "required": true, + "tips": "输入待转换成文本的Json对象", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "text_instance", + "label": "保存文本至", + "variableLabel": "Json转换后的文本", + "tips": "输入一个名字,用来保存Json对象转换成的文本", + "type": "str", + "name": "text_instance" + } + ] + }, + { + "name": "json.to_json", + "function": "xbot_visual.json.to_json", + "title": "转换成Json对象", + "description": "这个指令用于将输入的文本转换成Json对象", + "comment": "将文本%text%转换成Json对象,将对象保存到%json_instance%", + "icon": "BlockIcons/16-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/json转换/转换成json对象.html", + "inputs": [ + { + "name": "text", + "label": "文本", + "required": true, + "tips": "输入待转换成Json对象的文本", + "type": "str", + "editor": { + "kind": "memoedit" + } + } + ], + "outputs": [ + { + "id": "json_instance", + "label": "保存Json对象至", + "variableLabel": "文本转换后的Json对象", + "tips": "输入一个名字,用来保存转换得到的Json对象", + "type": "any", + "name": "json_instance" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/list.blocks.json b/src/assert/block_settings/list.blocks.json new file mode 100644 index 0000000..ff34032 --- /dev/null +++ b/src/assert/block_settings/list.blocks.json @@ -0,0 +1,605 @@ +{ + "types": [], + "blocks": [ + { + "name": "list.create", + "function": "xbot_visual.list.create", + "title": "新建列表", + "description": "新建空的列表,列表为多个数据的数组,例如列表:[\"中国\",\"美国\",\"法国\"]", + "comment": "新建列表,将列表对象保存到%list_instance%", + "icon": "BlockIcons/14-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/新建列表.html", + "outputs": [ + { + "id": "list_instance", + "label": "保存列表对象至", + "variableLabel": "新建的列表对象", + "tips": "输入一个名字,用来保存新建的列表", + "type": "list", + "name": "list_instance" + } + ] + }, + { + "name": "list.clear", + "function": "xbot_visual.list.clear", + "title": "清空列表", + "description": "这个指令用于清空列表", + "comment": "清空列表对象%lst%", + "icon": "BlockIcons/14-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/清空列表.html", + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "list.append_or_insert", + "function": "xbot_visual.list.append_or_insert", + "title": "列表插入一项", + "description": "在列表指定位置插入一项", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.List.ListInsertControl, ShadowBot.Shell.Development", + "comment": "在列表对象%lst%中增加新的一项%elem%", + "icon": "BlockIcons/14-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/列表添加一项.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.List.ListInsertHandler" + } + ], + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "insert_way", + "label": "插入方式", + "required": true, + "default": "10:append", + "defaultDisplay": "末尾追加", + "tips": "在列表的末尾或指定位置插入新的一项", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "末尾追加", + "value": "append" + }, + { + "display": "指定位置", + "value": "insert" + } + ] + } + }, + { + "name": "index", + "label": "插入到", + "required": false, + "default": "10:0", + "tips": "输入待插入的位置。正着数:第一项填写0,第二项填写1,以此类推;倒着数:倒数第一项填写-1,倒数第二项填写-2,以此类推。插入后原项将后移。", + "type": "int", + "editor": { + "placeholder": "0表示第1项,1表示第2项...支持负数,-n表示倒数第n项", + "kind": "textbox" + } + }, + { + "name": "elem", + "label": "插入项内容", + "required": true, + "tips": "输入待插入的项内容", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "list.set_elem", + "function": "xbot_visual.list.set_elem", + "title": "修改列表指定位置项的值", + "description": "这个指令用于修改列表指定位置的值", + "comment": "修改列表对象%lst%中第%index%项的值为%elem%", + "icon": "BlockIcons/14-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/修改列表指定位置的值.html", + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "index", + "label": "项位置", + "required": true, + "tips": "输入项位置。正着数:第一项填写0,第二项填写1,依次类推;倒着数:倒数第一项填写-1;倒数第二项填写-2,依次类推。", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "elem", + "label": "修改项", + "required": true, + "tips": "修改列表指定位置项内容", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "list.get_elem", + "function": "xbot_visual.list.get_elem", + "title": "获取列表指定位置项", + "description": "这个指令用于获取列表中指定位置的一项", + "comment": "获取列表对象%lst%中第%index%项的内容,将结果保存到%list_instance%", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.List.UseOutputTypeByInputListItemTypeHandler", + "settings": { + "inputName": "lst", + "outputName": "list_instance" + } + } + ], + "icon": "BlockIcons/14-4.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/获取列表指定位置项.html", + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "index", + "label": "项位置", + "required": true, + "tips": "输入项位置。正着数:第一项填写0,第二项填写1,依次类推;倒着数:倒数第一项填写-1;倒数第二项填写-2,依次类推。", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "list_instance", + "label": "保存列表项至", + "variableLabel": "列表项", + "tips": "输入一个名字,用来保存查找到的列表项", + "type": "any", + "name": "element_instance" + } + ] + }, + { + "name": "list.get_index", + "function": "xbot_visual.list.get_index", + "title": "获取列表指定项的位置", + "description": "获取指定项在列表中的位置,列表位置从0开始排序,0为第1项,1为第2项,依次类推", + "comment": "获取列表%lst%中内容为%elem%项的位置,将结果保存到%element_index%", + "icon": "BlockIcons/14-13.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/获取列表指定项的位置.html", + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "elem", + "label": "指定项的值", + "required": true, + "tips": "输入列表指定项的值", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "element_index", + "label": "保存位置至", + "variableLabel": "列表位置", + "tips": "输入一个名字,用来保存查找到的指定项在列表中的位置", + "type": "int", + "name": "element_index" + } + ] + }, + { + "name": "list.remove", + "function": "xbot_visual.list.remove", + "title": "删除列表一项", + "description": "这个指令用于删除列表中指定的一项", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.List.ListRemove, ShadowBot.Shell.Development", + "comment": "删除列表对象%lst%中第%index%项", + "icon": "BlockIcons/14-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/删除列表一项.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.List.ListRemoveHandler" + } + ], + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "remove_way", + "label": "删除方式", + "required": true, + "default": "10:index", + "defaultDisplay": "按位置删除", + "tips": "在'hellow world'中如果要删除第一个字母'o'选择下表删除需要输入下标4(下标从0开始计数),如果要删除全部的‘o’选择按内容删除则输入字母‘o'", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "按位置删除", + "value": "index" + }, + { + "display": "按内容删除", + "value": "elem" + } + ] + } + }, + { + "name": "elem", + "label": "待删除的内容", + "required": false, + "tips": "输入待删除的内容", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "index", + "label": "待删除的位置", + "required": false, + "tips": "输入删除的位置。正着数:第一项填写0,第二项填写1,依次类推;倒着数:倒数第一项填写-1;倒数第二项填写-2,依次类推。", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "list.sort", + "function": "xbot_visual.list.sort", + "title": "列表排序", + "description": "这个指令用于列表排序", + "comment": "按%sort_way%排序列表对象%lst%", + "icon": "BlockIcons/14-7.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/列表排序.html", + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "sort_way", + "label": "排序方式", + "required": true, + "default": "10:descend", + "defaultDisplay": "降序", + "tips": "选择升序或者降序排序列表", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "降序", + "value": "descend" + }, + { + "display": "升序", + "value": "ascend" + } + ] + } + } + ] + }, + { + "name": "list.shuffle", + "function": "xbot_visual.list.shuffle", + "title": "列表随机排序", + "description": "这个指令用于列表随机排序", + "comment": "随机排序列表对象%lst%", + "icon": "BlockIcons/14-8.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/列表随机排序.html", + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "list.extend", + "function": "xbot_visual.list.extend", + "title": "合并列表", + "description": "这个指令用于合并列表", + "comment": "合并列表%lst1%和%lst2%到新的列表,将结果保存到%list_instance%", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.List.ExtendBlockHandler", + "settings": { + "inputList1": "lst1", + "inputList2": "lst2", + "outputList": "list_instance" + } + } + ], + "icon": "BlockIcons/14-9.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/合并列表.html", + "inputs": [ + { + "name": "lst1", + "label": "列表1", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "lst2", + "label": "列表2", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "list_instance", + "label": "保存列表对象至", + "variableLabel": "合并后的列表对象", + "tips": "输入一个名字,用来保存新建的列表", + "type": "list", + "name": "list_instance" + } + ] + }, + { + "name": "list.reverse", + "function": "xbot_visual.list.reverse", + "title": "反转列表", + "description": "这个指令用于反转列表", + "comment": "反转列表对象%lst%", + "icon": "BlockIcons/14-10.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/反转列表.html", + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "list.remove_duplicate", + "function": "xbot_visual.list.remove_duplicate", + "title": "列表去重", + "description": "这个指令用于删除列表中重复的项", + "comment": "删除列表对象%lst%中的重复项", + "icon": "BlockIcons/14-11.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/列表去重.html", + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "list.get_duplicate", + "function": "xbot_visual.list.get_duplicate", + "title": "获取两个列表的相同项", + "description": "这个指令用于获取两个列表的相同项", + "comment": "获取列表%lst1%和%lst2%相同的项,将结果保存到%list_instance%", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.List.UseOutputTypeByInputListTypeHandler", + "settings": { + "inputName": "lst1", + "outputName": "list_instance" + } + } + ], + "icon": "BlockIcons/14-12.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/获取两个列表的相同项.html", + "inputs": [ + { + "name": "lst1", + "label": "列表1", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "lst2", + "label": "列表2", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "list_instance", + "label": "保存列表对象至", + "variableLabel": "两列表的相同项", + "tips": "输入一个名字,用来保存新建的列表", + "type": "list", + "name": "list_instance" + } + ] + }, + { + "name": "list.remove_list", + "function": "xbot_visual.list.remove_list", + "title": "过滤列表中的多项", + "description": "这个指令用于过滤列表中的多项", + "comment": "在列表对象%lst1%中过滤列表对象%lst2%所包含的项,将结果保存到新的列表对象%list_instance%", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.List.UseOutputTypeByInputListTypeHandler", + "settings": { + "inputName": "lst1", + "outputName": "list_instance" + } + } + ], + "icon": "BlockIcons/14-6.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/过滤列表中的多项.html", + "inputs": [ + { + "name": "lst1", + "label": "列表1", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "lst2", + "label": "列表2", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "list_instance", + "label": "保存列表对象至", + "variableLabel": "过滤后的列表对象", + "tips": "输入一个名字,用来保存新建的列表", + "type": "list", + "name": "list_instance" + } + ] + }, + { + "name": "list.get_len", + "function": "xbot_visual.list.get_len", + "title": "获取列表长度", + "description": "这个指令用于获取列表长度", + "comment": "获取列表对象%lst%的长度,将结果保存到%list_len%", + "icon": "BlockIcons/14-6.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/列表操作/获取列表长度.html", + "inputs": [ + { + "name": "lst", + "label": "列表", + "required": true, + "tips": "输入列表变量", + "type": "list", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "list_len", + "label": "保存列表长度至", + "variableLabel": "列表长度", + "tips": "输入一个名字,用来保存列表长度", + "type": "int", + "name": "list_len" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/mobile.blocks.json b/src/assert/block_settings/mobile.blocks.json new file mode 100644 index 0000000..ee28fef --- /dev/null +++ b/src/assert/block_settings/mobile.blocks.json @@ -0,0 +1,445 @@ +{ + "types": [ + { + "name": "xbot._mobile.session.DeviceSession", + "localName": "手机连接对象", + "methods": [ + { + "display": "udid", + "function": "$0.get_udid()", + "type": "str" + } + ] + } + ], + "blocks": [ + { + "name": "mobile.connect_device", + "title": "连接手机", + "icon": "BlockIcons/27-3.png", + "comment": "连接指定的手机,将连接对象保存到%session%", + "description": "与指定或者所有手机建立连接", + "function": "xbot_visual.mobile.connect_device", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Mobile.ConnectDeviceControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Mobile.ConnectDeviceHandler" + } + ], + "helpUrl": "yddoc/language/zh-cn/指令文档/手机操作自动化/连接手机.html", + "inputs": [ + { + "name": "connect_source", + "label": "连接对象", + "required": true, + "tips": "", + "type": "str", + "default": "10:specific", + "defaultDisplay": "指定手机", + "editor": { + "kind": "select", + "options": [ + { + "display": "指定手机", + "value": "specific" + }, + { + "display": "运行时手动选择", + "value": "runtime_dynamic" + }, + { + "display": "运行时连接的一台手机", + "value": "runtime_auto" + }, + { + "display": "运行时连接的所有手机", + "value": "all" + } + ] + } + }, + { + "name": "connect_mode", + "label": "连接模式", + "required": true, + "tips": "Appium:某些应用的输入框会无法输入(如“闲鱼”),需借助 AdbKeyBoard 输入法实现\r\nUiautomator2:稳定性高,但不支持安卓9及以上版本读写剪贴板,需借助 Clipper 剪贴板 APP 实现", + "type": "str", + "default": "10:appium", + "defaultDisplay": "Appium", + "editor": { + "kind": "select", + "options": [ + { + "display": "Appium", + "value": "appium" + }, + { + "display": "Uiautomator2", + "value": "u2" + } + ] + } + }, + { + "name": "ingore_failed_device", + "label": "", + "tips": "若勾选,连接失败的手机将添加到连接失败列表中,反之则抛出异常", + "type": "str", + "default": "13:True", + "editor": { + "kind": "checkbox", + "label": "忽略连接失败的手机" + } + }, + { + "name": "auto_unlock", + "label": "", + "category": "advanced", + "type": "bool", + "tips": "若勾选,连接时会自动解锁", + "default": "13:False", + "editor": { + "label": "连接时自动解锁", + "kind": "checkbox" + } + }, + { + "name": "unlockType", + "label": "锁屏方式", + "category": "advanced", + "type": "str", + "tips": "锁屏方式", + "default": "10:pin", + "editor": { + "kind": "select", + "options": [ + { + "display": "数字密码", + "value": "pin" + }, + { + "display": "图案密码", + "value": "pattern" + }, + { + "display": "复杂密码", + "value": "password" + } + ] + } + }, + { + "name": "mobile_password", + "label": "", + "category": "advanced", + "type": "str", + "tips": "手机锁屏密码", + "editor": { + "kind": "password" + } + }, + { + "name": "custom_name", + "label": "自定义手机名称", + "tips": "请先到设备管理器页面配置手机连接信息", + "type": "str", + "editor": { + "kind": "select", + "options": [] + } + } + ], + "outputs": [ + { + "id": "session", + "label": "保存连接对象至", + "variableLabel": "手机连接对象", + "tips": "该变量保存的是手机连接对象,使用此对象可以对移动手机进行自动化操作", + "name": "device_session", + "type": "xbot._mobile.session.DeviceSession" + }, + { + "id": "session_list", + "label": "保存连接对象列表至", + "variableLabel": "手机连接对象列表", + "tips": "该变量保存的是手机连接对象,使用此对象可以对移动手机进行自动化操作", + "name": "device_session_list", + "type": "list" + }, + { + "id": "failed_sessions", + "label": "保存连接失败列表至", + "variableLabel": "手机udid", + "tips": "该变量保存的是连接失败手机编号", + "name": "failed_udid_list", + "type": "list" + } + ] + }, + { + "name": "mobile.connect", + "title": "连接手机", + "icon": "BlockIcons/27-3.png", + "comment": "连接指定的手机,将连接对象保存到%session%", + "description": "与指定手机建立连接", + "function": "xbot_visual.mobile.connect", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Mobile.ConnectControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Mobile.ConnectHandler" + } + ], + "helpUrl": "yddoc/language/zh-cn/指令文档/手机操作自动化/连接手机.html", + "inputs": [ + { + "name": "connect_source", + "label": "连接来源", + "required": true, + "tips": "", + "type": "str", + "default": "10:current", + "defaultDisplay": "当前连接的手机", + "editor": { + "kind": "select", + "options": [ + { + "display": "当前连接的手机", + "value": "current" + }, + { + "display": "指定的手机", + "value": "assign" + } + ] + } + }, + { + "name": "connect_kind", + "label": "连接类型", + "required": true, + "tips": "", + "type": "str", + "default": "10:local", + "defaultDisplay": "本地连接", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地连接", + "value": "local" + }, + { + "display": "动态连接", + "value": "dynamic" + } + ] + } + }, + { + "name": "connect_mode", + "label": "连接模式", + "required": true, + "tips": "Appium:某些应用的输入框会无法输入(如“闲鱼”),需借助 AdbKeyBoard 输入法实现\r\nUiautomator2:稳定性高,但不支持安卓9及以上版本读写剪贴板,需借助 Clipper 剪贴板 APP 实现", + "type": "str", + "default": "10:appium", + "defaultDisplay": "Appium", + "editor": { + "kind": "select", + "options": [ + { + "display": "Appium", + "value": "appium" + }, + { + "display": "Uiautomator2", + "value": "u2" + } + ] + } + }, + { + "name": "auto_unlock", + "label": "", + "category": "advanced", + "type": "bool", + "tips": "若勾选,连接时会自动解锁", + "default": "13:False", + "editor": { + "label": "连接时自动解锁", + "kind": "checkbox" + } + }, + { + "name": "unlockType", + "label": "锁屏方式", + "category": "advanced", + "type": "str", + "tips": "锁屏方式", + "default": "10:pin", + "editor": { + "kind": "select", + "options": [ + { + "display": "数字密码", + "value": "pin" + }, + { + "display": "图案密码", + "value": "pattern" + }, + { + "display": "复杂密码", + "value": "password" + } + ] + } + }, + { + "name": "mobile_password", + "label": "", + "category": "advanced", + "type": "str", + "tips": "手机锁屏密码", + "editor": { + "kind": "password" + } + }, + { + "name": "custom_name", + "label": "自定义手机名称", + "tips": "请先到设备管理器页面配置手机连接信息", + "type": "str", + "editor": { + "kind": "select", + "options": [] + } + } + ], + "outputs": [ + { + "id": "session", + "label": "保存连接对象至", + "variableLabel": "手机连接对象", + "tips": "该变量保存的是手机连接对象,使用此对象可以对移动手机进行自动化操作", + "name": "device_session", + "type": "xbot._mobile.session.DeviceSession" + } + ] + }, + { + "name": "mobile.all_connect", + "title": "连接多台手机", + "icon": "BlockIcons/27-26.png", + "comment": "与PC机连接的所有手机建立自动化连接,将连接对象保存到%sessions%", + "description": "与PC机连接的所有手机建立自动化连接,用于群控场景", + "function": "xbot_visual.mobile.all_connect", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Mobile.MultiConnectHandler" + } + ], + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Mobile.MultiConnectControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/手机操作自动化/连接多台手机.html?", + "inputs": [ + { + "name": "connect_mode", + "label": "连接模式", + "required": true, + "tips": "Appium:某些应用的输入框会无法输入(如“闲鱼”),需借助 AdbKeyBoard 输入法实现\r\nUiautomator2:稳定性高,但不支持安卓9及以上版本读写剪贴板,需借助 Clipper 剪贴板 APP 实现", + "type": "str", + "default": "10:appium", + "defaultDisplay": "Appium", + "editor": { + "kind": "select", + "options": [ + { + "display": "Appium", + "value": "appium" + }, + { + "display": "Uiautomator2", + "value": "u2" + } + ] + } + }, + { + "name": "ingore_failed_device", + "label": "", + "tips": "若勾选,连接失败的手机将添加到连接失败列表中,反之则抛出异常", + "type": "str", + "default": "13:True", + "editor": { + "kind": "checkbox", + "label": "忽略连接失败的手机" + } + }, + { + "name": "unlockType", + "label": "锁屏方式", + "category": "advanced", + "type": "str", + "tips": "锁屏方式", + "default": "10:pin", + "editor": { + "kind": "select", + "options": [ + { + "display": "数字密码", + "value": "pin" + }, + { + "display": "图案密码", + "value": "pattern" + }, + { + "display": "复杂密码", + "value": "password" + } + ] + } + }, + { + "name": "auto_unlock", + "label": "", + "category": "advanced", + "type": "bool", + "tips": "若勾选, 连接时会自动解锁", + "default": "13:False", + "editor": { + "label": "连接时自动解锁", + "kind": "checkbox" + } + }, + { + "name": "mobile_password", + "label": "", + "category": "advanced", + "type": "str", + "tips": "手机锁屏密码", + "editor": { + "kind": "password" + } + } + ], + "outputs": [ + { + "id": "sessions", + "label": "保存连接对象列表至", + "variableLabel": "手机连接对象列表", + "tips": "该变量保存的是手机连接对象,使用此对象可以对移动手机进行自动化操作", + "name": "device_session_list", + "type": "list" + }, + { + "id": "failed_sessions", + "label": "保存连接失败列表至", + "variableLabel": "手机udid", + "tips": "该变量保存的是连接失败手机编号", + "name": "failed_udid_list", + "type": "list" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/nlp.blocks.json b/src/assert/block_settings/nlp.blocks.json new file mode 100644 index 0000000..206442f --- /dev/null +++ b/src/assert/block_settings/nlp.blocks.json @@ -0,0 +1,405 @@ +{ + "types": [ + { + "name": "xbot_visual_ocr_lexical_words", + "localName": "文本分词", + "python": "xbot_visual._core.xbot_visual_ocr_lexical_words", + "props": [ + { + "name": "words", + "type": "list", + "label": "词汇集" + }, + { + "name": "raw_data", + "type": "any", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_lexical_item", + "localName": "实体属性对象", + "python": "xbot_visual._core.xbot_visual_ocr_lexical_item", + "props": [ + { + "name": "word", + "type": "str", + "label": "词汇" + }, + { + "name": "type", + "type": "str", + "label": "实体类型" + }, + { + "name": "pos", + "type": "str", + "label": "词性" + } + ] + }, + { + "name": "list", + "localName": "实体属性对象列表", + "base": "list", + "listItemType": "xbot_visual_ocr_lexical_item" + }, + { + "name": "xbot_visual_ocr_lexical_detail", + "localName": "实体抽取结果", + "pythonName": "xbot_visual._core.xbot_visual_ocr_lexical_detail", + "props": [ + { + "name": "words", + "type": "list", + "label": "属性集" + }, + { + "name": "raw_data", + "type": "any", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_sentiment", + "localName": "情感分析结果", + "python": "xbot_visual._core.xbot_visual_ocr_sentiment", + "props": [ + { + "name": "sentiment", + "type": "str", + "label": "分类结果" + }, + { + "name": "positive", + "type": "float", + "label": "积极类别的概率" + }, + { + "name": "negative", + "type": "float", + "label": "消极类别的概率" + }, + { + "name": "raw_data", + "type": "any", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_similarity", + "localName": "相似度分析结果", + "python": "xbot_visual._core.xbot_visual_ocr_similarity", + "props": [ + { + "name": "score", + "type": "float", + "label": "相似度" + }, + { + "name": "raw_data", + "type": "any", + "label": "原始数据" + } + ] + } + ], + "blocks": [ + { + "name": "nlp.lexical_analysis", + "icon": "BlockIcons/23-6.png", + "description": "将连续的自然语言文本切分成具有语义合理性和完整性的词汇列表", + "comment": "使用%ai_engine%AI引擎对文本%text%进行分词,将分词结果保存到%lexer_result%", + "title": "文本分词", + "function": "xbot_visual.nlp.lexical_analysis", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/自然语言处理nlp/文本分词.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Nlp.LexicalAnalysisControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "default": "10:shadowbot", + "defaultDisplay": "影刀", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "text", + "label": "文本", + "required": true, + "tips": "输入需要进行分词的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "flag", + "label": "分析模式", + "default": "10:common", + "defaultDisplay": "通用识别", + "tips": "选择一种识别模式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "通用模式", + "value": "common" + }, + { + "display": "高精度模式", + "value": "accurate" + } + ] + } + } + ], + "outputs": [ + { + "id": "lexer_result", + "label": "分词结果保存至", + "variableLabel": "文本分词结果", + "tips": "指定一个变量名称,该变量用于存储文本分词结果", + "type": "xbot_visual_ocr_lexical_words", + "name": "lexer_result" + } + ] + }, + { + "name": "nlp.lexical_analysis_include_location", + "icon": "BlockIcons/23-6.png", + "description": "从目标文本中,识别出实体词汇,比如人名、地名、机构名等", + "comment": "使用%ai_engine%AI引擎对文本%text%进行实体抽取,将抽取结果保存到%lexer_deatil_result%", + "title": "实体抽取", + "function": "xbot_visual.nlp.lexical_analysis_include_location", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/自然语言处理nlp/实体抽取.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Nlp.LexicalAnalysisIncludeLocationControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "default": "10:shadowbot", + "defaultDisplay": "影刀", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "text", + "label": "文本", + "required": true, + "tips": "输入需要进行实体抽取的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "flag", + "label": "分析模式", + "default": "10:common", + "defaultDisplay": "通用识别", + "tips": "选择一种识别模式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "通用模式", + "value": "common" + }, + { + "display": "高精度模式", + "value": "accurate" + } + ] + } + }, + { + "name": "pump_type", + "label": "提取目标", + "default": "10:all", + "defaultDisplay": "全部", + "tips": "选择一种需要提取的实体类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all" + }, + { + "display": "人名", + "value": "PER" + }, + { + "display": "地名", + "value": "LOC" + }, + { + "display": "机构团体名", + "value": "ORG" + }, + { + "display": "时间", + "value": "TIME" + }, + { + "display": "产品名", + "value": "PRODUCTION" + } + ] + } + } + ], + "outputs": [ + { + "id": "lexer_deatil_result", + "label": "实体抽取结果保存至", + "variableLabel": "实体抽取结果", + "tips": "指定一个变量名称,该变量用于存储实体抽取结果", + "type": "xbot_visual_ocr_lexical_detail", + "name": "lexer_deatil_result" + } + ] + }, + { + "name": "nlp.sentiment_analysis", + "icon": "BlockIcons/23-6.png", + "description": "从文本中识别出用户的情感倾向,是积极还是消极,并且提供各自概率", + "comment": "使用%ai_engine%AI引擎,对文本%text%进行情感分析,将分析结果保存到%sentiment_result%", + "title": "情感倾向分析", + "function": "xbot_visual.nlp.sentiment_analysis", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/自然语言处理nlp/情感倾向分析.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Nlp.SentimentAnalysisControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "default": "10:shadowbot", + "defaultDisplay": "影刀", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "text", + "label": "文本", + "required": true, + "tips": "输入需要进行情感分析的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "sentiment_result", + "label": "情感分析结果保存至", + "variableLabel": "情感分析结果", + "tips": "指定一个变量名称,该变量用于存储情感分析结果", + "type": "xbot_visual_ocr_sentiment", + "name": "sentiment_result" + } + ] + }, + { + "name": "nlp.text_similarity", + "icon": "BlockIcons/23-6.png", + "description": "分析两个短文本的相似度,相似度结果取值0~1,值越大说明相似度越高", + "comment": "使用%ai_engine%AI引擎比较文本1%src_text%与文本2%target_text%的相似性,将比较结果保存到%similarity_result%", + "title": "文本相似度分析", + "function": "xbot_visual.nlp.text_similarity", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/自然语言处理nlp/文本相似度分析.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Nlp.TextSimilarityControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "default": "10:shadowbot", + "defaultDisplay": "影刀", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "src_text", + "label": "文本1", + "required": true, + "tips": "需要与目标文本计算相似度的源文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "target_text", + "label": "文本2", + "required": true, + "tips": "需要与源文本计算相似度的目标文本", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "similarity_result", + "label": "相似度结果保存至", + "variableLabel": "文本相似度分析结果", + "tips": "指定一个变量名称,该变量用于存储文本相似度分析结果", + "type": "xbot_visual_ocr_similarity", + "name": "similarity_result" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/ocr.blocks.json b/src/assert/block_settings/ocr.blocks.json new file mode 100644 index 0000000..71471d5 --- /dev/null +++ b/src/assert/block_settings/ocr.blocks.json @@ -0,0 +1,4153 @@ +{ + "types": [ + { + "name": "xbot_visual_ocr_general_word", + "localName": "文本项(通用文字识别)", + "pythonName": "xbot_visual._core.xbot_visual_ocr_general_word", + "props": [ + { + "name": "text", + "type": "str", + "label": "文本" + }, + { + "name": "left", + "type": "str", + "label": "左边距" + }, + { + "name": "top", + "type": "str", + "label": "上边距" + }, + { + "name": "width", + "type": "str", + "label": "宽度" + }, + { + "name": "height", + "type": "str", + "label": "高度" + } + ] + }, + { + "name": "xbot_visual_ocr_form_cell", + "localName": "单元格(表格识别)", + "pythonName": "xbot_visual._core.xbot_visual_ocr_form_cell", + "props": [ + { + "name": "content", + "type": "str", + "label": "内容" + }, + { + "name": "start_x", + "type": "int", + "label": "起始位置X" + }, + { + "name": "start_y", + "type": "int", + "label": "起始位置Y" + }, + { + "name": "end_x", + "type": "int", + "label": "结束位置X" + }, + { + "name": "end_y", + "type": "int", + "label": "结束位置Y" + } + ] + }, + { + "name": "xbot_visual_ocr_form", + "localName": "单个表格(表格识别)", + "pythonName": "xbot_visual._core.xbot_visual_ocr_form", + "props": [ + { + "name": "form_cells", + "type": "list", + "label": "多个单元格" + } + ] + }, + { + "name": "list", + "localName": "单元格列表(表格识别)", + "base": "list", + "listItemType": "xbot_visual_ocr_form_cell" + }, + { + "name": "list", + "localName": "文本项列表(通用文字识别)", + "base": "list", + "listItemType": "xbot_visual_ocr_general_word" + }, + { + "name": "list", + "localName": "表格列表(表格识别)", + "base": "list", + "listItemType": "xbot_visual_ocr_form" + }, + { + "name": "xbot.ai.AIEngine", + "localName": "AI引擎", + "props": [] + }, + { + "name": "xbot.ai.BaiduAIEngine", + "localName": "百度AI引擎", + "pythonName": "xbot.ai.baidu.BaiduAI", + "base": "xbot.ai.AIEngine", + "props": [] + }, + { + "name": "xbot.ai.AliyunAIEngine", + "localName": "阿里云AI引擎", + "pythonName": "xbot.ai.aliyun.AliyunAI", + "base": "xbot.ai.AIEngine", + "props": [] + }, + { + "name": "xbot.ai.TencentAIEngine", + "localName": "腾讯AI引擎", + "pythonName": "xbot.ai.tencent.TencentAI", + "base": "xbot.ai.AIEngine", + "props": [] + }, + { + "name": "xbot.ai.ShadowBotAIEngine", + "localName": "影刀AI引擎", + "pythonName": "xbot.ai.shadowbot.ShadowBotAI", + "base": "xbot.ai.AIEngine", + "props": [] + }, + { + "name": "xbot_visual_ocr_vat_invoice", + "localName": "增值税发票信息", + "pythonName": "xbot_visual._core.xbot_visual_ocr_vat_invoice", + "props": [ + { + "name": "invoice_code", + "type": "str", + "label": "发票代码" + }, + { + "name": "invoice_num", + "type": "str", + "label": "发票号码" + }, + { + "name": "invoice_date", + "type": "str", + "label": "开票日期" + }, + { + "name": "check_code", + "type": "str", + "label": "校验码" + }, + { + "name": "total_amount", + "type": "str", + "label": "合计金额" + }, + { + "name": "total_tax", + "type": "str", + "label": "合计税额" + }, + { + "name": "seller_name", + "type": "str", + "label": "销售方名称" + }, + { + "name": "seller_register_num", + "type": "str", + "label": "销售方纳税人识别号" + }, + { + "name": "seller_address", + "type": "str", + "label": "销售方地址及电话" + }, + { + "name": "seller_bank", + "type": "str", + "label": "销售方开户行及账号" + }, + { + "name": "purchaser_name", + "type": "str", + "label": "购方名称" + }, + { + "name": "purchaser_register_num", + "type": "str", + "label": "购方纳税人识别号" + }, + { + "name": "purchaser_address", + "type": "str", + "label": "购方地址及电话" + }, + { + "name": "purchaser_bank", + "type": "str", + "label": "购方开户行及账号" + }, + { + "name": "raw_data", + "type": "dict", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_id_card", + "localName": "身份证信息", + "pythonName": "xbot_visual._core.xbot_visual_ocr_id_card", + "props": [ + { + "name": "name", + "type": "str", + "label": "姓名" + }, + { + "name": "sex", + "type": "str", + "label": "性别" + }, + { + "name": "nation", + "type": "str", + "label": "民族" + }, + { + "name": "birth", + "type": "str", + "label": "出生" + }, + { + "name": "address", + "type": "str", + "label": "住址" + }, + { + "name": "id_num", + "type": "str", + "label": "公民身份号码" + }, + { + "name": "authority", + "type": "str", + "label": "签发机关" + }, + { + "name": "valid_date", + "type": "str", + "label": "有效期" + }, + { + "name": "raw_data", + "type": "dict", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_license_plate", + "localName": "车牌信息", + "pythonName": "xbot_visual._core.xbot_visual_ocr_license_plate", + "props": [ + { + "name": "number", + "type": "str", + "label": "车牌号" + }, + { + "name": "left", + "type": "str", + "label": "左边距" + }, + { + "name": "top", + "type": "str", + "label": "上边距" + }, + { + "name": "width", + "type": "str", + "label": "宽度" + }, + { + "name": "height", + "type": "str", + "label": "高度" + }, + { + "name": "raw_data", + "type": "dict", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_bank_card", + "localName": "银行卡信息", + "pythonName": "xbot_visual._core.xbot_visual_ocr_bank_card", + "props": [ + { + "name": "bank_name", + "type": "str", + "label": "银行名" + }, + { + "name": "card_number", + "type": "str", + "label": "卡号" + }, + { + "name": "valid_date", + "type": "str", + "label": "有效期" + }, + { + "name": "raw_data", + "type": "dict", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_train_ticket", + "localName": "火车票信息", + "pythonName": "xbot_visual._core.xbot_visual_ocr_train_ticket", + "props": [ + { + "name": "starting_station", + "type": "str", + "label": "始发站" + }, + { + "name": "train_num", + "type": "str", + "label": "车票号" + }, + { + "name": "destination_station", + "type": "str", + "label": "到达站" + }, + { + "name": "date", + "type": "str", + "label": "出发日期" + }, + { + "name": "time", + "type": "str", + "label": "出发时间" + }, + { + "name": "seat_num", + "type": "str", + "label": "座位号" + }, + { + "name": "price", + "type": "str", + "label": "车票金额" + }, + { + "name": "seat_category", + "type": "str", + "label": "席别" + }, + { + "name": "name", + "type": "str", + "label": "乘客姓名" + }, + { + "name": "raw_data", + "type": "dict", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_taxi_invoice", + "localName": "出租车票信息", + "pythonName": "xbot_visual._core.xbot_visual_ocr_taxi_invoice", + "props": [ + { + "name": "invoice_num", + "type": "str", + "label": "发票号码" + }, + { + "name": "invoice_code", + "type": "str", + "label": "发票代号" + }, + { + "name": "date", + "type": "str", + "label": "日期" + }, + { + "name": "plate_number", + "type": "str", + "label": "车牌号" + }, + { + "name": "geton_time", + "type": "str", + "label": "上车时间" + }, + { + "name": "getoff_time", + "type": "str", + "label": "下车时间" + }, + { + "name": "distance", + "type": "str", + "label": "里程" + }, + { + "name": "fare", + "type": "str", + "label": "总金额" + }, + { + "name": "raw_data", + "type": "dict", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_general_text_with_location", + "localName": "AI识别结果(含位置)", + "pythonName": "xbot_visual._core.xbot_visual_ocr_general_text_with_location", + "props": [ + { + "name": "words", + "type": "list", + "label": "识别结果集" + }, + { + "name": "raw_data", + "type": "dict", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_general_text", + "localName": "AI识别结果", + "pythonName": "xbot_visual._core.xbot_visual_ocr_general_text", + "props": [ + { + "name": "text", + "type": "str", + "label": "识别结果" + }, + { + "name": "raw_data", + "type": "dict", + "label": "原始数据" + } + ] + }, + { + "name": "xbot_visual_ocr_table", + "localName": "表格信息", + "pythonName": "xbot_visual._core.xbot_visual_ocr_table", + "props": [ + { + "name": "forms", + "type": "list", + "label": "多个表格" + }, + { + "name": "raw_data", + "type": "dict", + "label": "原始数据" + } + ] + } + ], + "blocks": [ + { + "name": "ocr.OCRToText", + "icon": "BlockIcons/23-1.png", + "description": "识别图像文本", + "comment": "使用%ai_engine%AI引擎,识别%image_source%文本,将结果保存到%ocr_text%", + "title": "识别图像文本(OCR)", + "keywords": "文字识别;图像识别;识图;图文识别;图片识别", + "function": "xbot_visual.ocr.ocr_to_text", + "helpUrl": "yddoc/language/zh-cn/指令文档/ocr/识别图像文本(ocr).html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.OCRToTextControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "baidu_ocr_edition", + "label": "AI版本", + "tips": "选择百度AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "general" + }, + { + "display": "高精度版", + "value": "accurate" + } + ] + } + }, + { + "name": "tencent_ocr_edition", + "label": "AI版本", + "tips": "选择腾讯AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "GeneralBasicOCR" + }, + { + "display": "高精度版", + "value": "GeneralAccurateOCR" + }, + { + "display": "精简版", + "value": "GeneralEfficientOCR" + }, + { + "display": "高速版", + "value": "GeneralFastOCR" + } + ] + } + }, + { + "name": "aliyun_ocr_edition", + "label": "AI版本", + "tips": "选择阿里云AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "ocr_general" + }, + { + "display": "高精度版", + "value": "advanced" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "foreground_window" + }, + { + "display": "本地硬盘图片", + "value": "image_on_disk" + }, + { + "display": "剪切板", + "value": "clipboard_image" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "required": false, + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "image_path", + "label": "图片路径", + "required": false, + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png)|*.jpg;*.bmp;*.png" + } + } + }, + { + "name": "image_region", + "label": "提取区域", + "required": false, + "default": "10:all_region", + "defaultDisplay": "提取区域", + "tips": "选择图片提取区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all_region" + }, + { + "display": "指定部分区域", + "value": "sub_region" + } + ] + } + }, + { + "name": "region_x1", + "label": "X1", + "required": false, + "tips": "图片左上角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y1", + "label": "Y1", + "required": false, + "tips": "图片左上角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_x2", + "label": "X2", + "required": false, + "tips": "图片右下角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y2", + "label": "Y2", + "required": false, + "tips": "图片右下角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "ocr_text", + "label": "保存文本至变量", + "variableLabel": "图象文本", + "tips": "指定一个变量名称,该变量用于存储识别出来的文本", + "type": "str", + "name": "ocr_text" + } + ] + }, + { + "name": "ocr.CreateAIEngine", + "icon": "BlockIcons/23-7.png", + "description": "配置一个AI引擎, 用于人工智能类指令引用", + "comment": "创建%engine%AI引擎,将对象保存到%ai_engine%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.CreateAIEngineControl, ShadowBot.Shell.Development", + "title": "配置AI引擎", + "keywords":"创建;创建AI引擎", + "function": "xbot_visual.ocr.create_ai_engine", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/创建ai引擎.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Ocr.CreateAIEngineHandler" + } + ], + "inputs": [ + { + "name": "engine", + "label": "AI引擎", + "required": true, + "default": "10:shadowbot", + "defaultDisplay": "影刀", + "tips": "选择AI引擎类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀", + "value": "shadowbot" + }, + { + "display": "百度", + "value": "baidu" + }, + { + "display": "腾讯", + "value": "tencent" + }, + { + "display": "阿里云", + "value": "aliyun" + } + ] + } + }, + { + "name": "use_custom_account", + "label": "", + "required": true, + "tips": "是否使用自定义AI账号", + "type": "bool", + "default": "13:False", + "editor": { + "label": "使用自定义账号", + "kind": "checkbox" + } + }, + { + "name": "param1", + "label": "认证参数1", + "tips": "请输入AI引擎的认证参数1", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "param2", + "label": "认证参数2", + "tips": "请输入AI引擎的认证参数2", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "ai_engine", + "label": "保存AI引擎至", + "variableLabel": "AI引擎", + "tips": "指定一个变量名称,该变量用于存储创建的AI引擎", + "type": "xbot.ai.AIEngine", + "name": "ai_engine" + } + ] + }, + { + "name": "ocr.general_text_with_location", + "icon": "BlockIcons/23-1.png", + "description": "通用文字识别(含位置)", + "keywords": "文字识别;图像识别;识图;图文识别;图片识别", + "comment": "使用%ai_engine%AI引擎,识别%image_source%文本,将结果保存到%general_text_with_location%", + "title": "通用文字识别(含位置)", + "function": "xbot_visual.ocr.general_text_with_location", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.GeneralTextWithLocationControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/文字识别ocr/通用文字识别(含位置).html", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "baidu_ocr_edition", + "label": "AI版本", + "default": "10:general", + "tips": "选择百度AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "general" + }, + { + "display": "高精度版", + "value": "accurate" + } + ] + } + }, + { + "name": "tencent_ocr_edition", + "label": "AI版本", + "default": "10:GeneralBasicOCR", + "tips": "选择腾讯AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "GeneralBasicOCR" + }, + { + "display": "高精度版", + "value": "GeneralAccurateOCR" + }, + { + "display": "精简版", + "value": "GeneralEfficientOCR" + }, + { + "display": "高速版", + "value": "GeneralFastOCR" + } + ] + } + }, + { + "name": "aliyun_ocr_edition", + "label": "AI版本", + "default": "10:ocr_general", + "tips": "选择阿里云AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "ocr_general" + }, + { + "display": "高精度版", + "value": "advanced" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "foreground_window" + }, + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png;*.pdf)|*.jpg;*.bmp;*.png;*.pdf" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_region", + "label": "提取区域", + "default": "10:all_region", + "defaultDisplay": "提取区域", + "tips": "选择图片提取区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all_region" + }, + { + "display": "指定部分区域", + "value": "sub_region" + } + ] + } + }, + { + "name": "region_x1", + "label": "X1", + "tips": "图片左上角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y1", + "label": "Y1", + "tips": "图片左上角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_x2", + "label": "X2", + "tips": "图片右下角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y2", + "label": "Y2", + "tips": "图片右下角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_pdf", + "label": "", + "tips": "是否开启PDF识别,默认值为false,开启后可同时支持图片和PDF的识别", + "type": "bool", + "category": "advanced", + "default": "13:False", + "editor": { + "label": "开启PDF识别", + "kind": "checkbox" + } + }, + { + "name": "pdf_page_number", + "label": "PDF页码", + "default": "10:1", + "category": "advanced", + "tips": "需要识别的PDF页面的对应页码,仅支持PDF单页识别,当上传文件为PDF且IsPdf参数值为true时有效,默认值为1", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "recognize_granularity", + "label": "定位单字符位置", + "default": "10:big", + "category": "advanced", + "tips": "是否定位单字符位置,big:不定位单字符位置,默认值;small:定位单字符位置", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "vertexes_location", + "label": "", + "tips": "是否返回文字外接多边形顶点位置,不支持单字位置。默认为false", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "获取文字外接多边形顶点位置", + "kind": "checkbox" + } + }, + { + "name": "detect_direction", + "label": "", + "tips": "是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括: true:检测朝向, false:不检测朝向", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "检测朝向", + "kind": "checkbox" + } + }, + { + "name": "detect_language", + "label": "", + "tips": "是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "检测语言", + "kind": "checkbox" + } + }, + { + "name": "paragraph", + "label": "", + "tips": "是否输出段落信息", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "输出段落信息", + "kind": "checkbox" + } + }, + { + "name": "probability", + "label": "", + "tips": "是否返回识别结果中每一行的置信度", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "获取识别结果中每一行的置信度", + "kind": "checkbox" + } + }, + { + "name": "min_size", + "label": "文字最小高度", + "default": "10:16", + "category": "advanced", + "tips": "图片中文字的最小高度,单位像素", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "output_prob", + "label": "", + "tips": "是否输出文字框的概率", + "type": "bool", + "default": "13:True", + "category": "advanced", + "editor": { + "label": "输出文字框的概率", + "kind": "checkbox" + } + }, + { + "name": "output_keypoints", + "label": "", + "tips": "是否输出文字框角点", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "输出文字框角点", + "kind": "checkbox" + } + }, + { + "name": "skip_detection", + "label": "", + "tips": "是否跳过文字检测步骤直接进行文字识别", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "跳过文字检测", + "kind": "checkbox" + } + }, + { + "name": "without_predicting_direction", + "label": "", + "tips": "是否关闭文字行方向预测", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "关闭文字行方向预测", + "kind": "checkbox" + } + }, + { + "name": "prob", + "label": "", + "tips": "是否需要识别结果中每一行的置信度,默认不需要", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "获取每一行的置信度", + "kind": "checkbox" + } + }, + { + "name": "char_info", + "label": "", + "tips": "是否需要单字识别功能,默认不需要", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "单字识别", + "kind": "checkbox" + } + }, + { + "name": "rotate", + "label": "", + "tips": "是否需要自动旋转功能,默认不需要", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "自动旋转", + "kind": "checkbox" + } + }, + { + "name": "table", + "label": "", + "tips": "是否需要表格识别功能,默认不需要", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "表格识别", + "kind": "checkbox" + } + }, + { + "name": "sort_page", + "label": "", + "tips": "字块返回顺序,false表示从左往右,从上到下的顺序,true表示从上到下,从左往右的顺序,默认false", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "字块返回顺序", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "general_text_with_location", + "label": "保存识别结果至变量", + "variableLabel": "通用文字识别结果", + "tips": "指定一个变量名称,该变量用于存储识别出来的通用文字识别结果", + "type": "xbot_visual_ocr_general_text_with_location", + "name": "general_text_with_location" + } + ] + }, + { + "name": "ocr.general_text", + "icon": "BlockIcons/23-1.png", + "description": "通用文字识别", + "keywords": "文字识别;图像识别;识图;图文识别;图片识别", + "comment": "使用%ai_engine%AI引擎,识别%image_source%文本,将结果保存到%general_text%", + "title": "通用文字识别", + "function": "xbot_visual.ocr.general_text", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.GeneralTextControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/文字识别ocr/通用文字识别.html", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "baidu_ocr_edition", + "label": "AI版本", + "default": "10:general_basic", + "tips": "选择百度AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "general_basic" + }, + { + "display": "高精度版", + "value": "accurate_basic" + } + ] + } + }, + { + "name": "tencent_ocr_edition", + "label": "AI版本", + "default": "10:GeneralBasicOCR", + "tips": "选择腾讯AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "GeneralBasicOCR" + }, + { + "display": "高精度版", + "value": "GeneralAccurateOCR" + }, + { + "display": "精简版", + "value": "GeneralEfficientOCR" + }, + { + "display": "高速版", + "value": "GeneralFastOCR" + } + ] + } + }, + { + "name": "aliyun_ocr_edition", + "label": "AI版本", + "default": "10:ocr_general", + "tips": "选择阿里云AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "ocr_general" + }, + { + "display": "高精度版", + "value": "advanced" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "foreground_window" + }, + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png;*.pdf)|*.jpg;*.bmp;*.png;*.pdf" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_region", + "label": "提取区域", + "default": "10:all_region", + "defaultDisplay": "提取区域", + "tips": "选择图片提取区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all_region" + }, + { + "display": "指定部分区域", + "value": "sub_region" + } + ] + } + }, + { + "name": "region_x1", + "label": "X1", + "tips": "图片左上角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y1", + "label": "Y1", + "tips": "图片左上角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_x2", + "label": "X2", + "tips": "图片右下角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y2", + "label": "Y2", + "tips": "图片右下角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_pdf", + "label": "", + "tips": "是否开启PDF识别,默认值为false,开启后可同时支持图片和PDF的识别", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "开启PDF识别", + "kind": "checkbox" + } + }, + { + "name": "pdf_page_number", + "label": "PDF页码", + "default": "10:1", + "category": "advanced", + "tips": "需要识别的PDF页面的对应页码,仅支持PDF单页识别,当上传文件为PDF且IsPdf参数值为true时有效,默认值为1", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "detect_direction", + "label": "", + "tips": "是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括: true:检测朝向, false:不检测朝向", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "检测朝向", + "kind": "checkbox" + } + }, + { + "name": "detect_language", + "label": "", + "tips": "是否检测语言,默认不检测。当前支持(中文、英语、日语、韩语)", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "检测语言", + "kind": "checkbox" + } + }, + { + "name": "paragraph", + "label": "", + "tips": "是否输出段落信息", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "输出段落信息", + "kind": "checkbox" + } + }, + { + "name": "probability", + "label": "", + "tips": "是否返回识别结果中每一行的置信度", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "获取识别结果中每一行的置信度", + "kind": "checkbox" + } + }, + { + "name": "min_size", + "label": "文字最小高度", + "default": "10:16", + "category": "advanced", + "tips": "图片中文字的最小高度,单位像素", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "output_prob", + "label": "", + "tips": "是否输出文字框的概率", + "type": "bool", + "default": "13:True", + "category": "advanced", + "editor": { + "label": "输出文字框的概率", + "kind": "checkbox" + } + }, + { + "name": "output_keypoints", + "label": "", + "tips": "是否输出文字框角点", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "输出文字框角点", + "kind": "checkbox" + } + }, + { + "name": "skip_detection", + "label": "", + "tips": "是否跳过文字检测步骤直接进行文字识别", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "跳过文字检测", + "kind": "checkbox" + } + }, + { + "name": "without_predicting_direction", + "label": "", + "tips": "是否关闭文字行方向预测", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "关闭文字行方向预测", + "kind": "checkbox" + } + }, + { + "name": "prob", + "label": "", + "tips": "是否需要识别结果中每一行的置信度,默认不需要", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "获取每一行的置信度", + "kind": "checkbox" + } + }, + { + "name": "char_info", + "label": "", + "tips": "是否需要单字识别功能,默认不需要", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "单字识别", + "kind": "checkbox" + } + }, + { + "name": "rotate", + "label": "", + "tips": "是否需要自动旋转功能,默认不需要", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "自动旋转", + "kind": "checkbox" + } + }, + { + "name": "table", + "label": "", + "tips": "是否需要表格识别功能,默认不需要", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "表格识别", + "kind": "checkbox" + } + }, + { + "name": "sort_page", + "label": "", + "tips": "字块返回顺序,false表示从左往右,从上到下的顺序,true表示从上到下,从左往右的顺序,默认false", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "字块返回顺序", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "general_text", + "label": "保存识别结果至变量", + "variableLabel": "通用文字识别结果", + "tips": "指定一个变量名称,该变量用于存储识别出来的通用文字识别结果", + "type": "xbot_visual_ocr_general_text", + "name": "general_text" + } + ] + }, + { + "name": "ocr.if_text_on_screen", + "statement": "workflow.if", + "icon": "BlockIcons/23-5.png", + "description": "如果屏幕上存在/不存在指定的文本", + "comment": "通过%ai_engine%AI引擎识别%image_source%上是否存在文本%text%", + "indent": "1", + "scope": "1", + "isCondition": true, + "title": "IF 屏幕上存在文本(OCR)", + "function": "xbot_visual.ocr.if_text_on_screen", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/if屏幕上存在文本(ocr).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Ocr.IfTextOnScreenHandler" + } + ], + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.IfTextOnScreenControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "baidu_ocr_edition", + "label": "AI版本", + "tips": "选择百度AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "general" + }, + { + "display": "高精度版", + "value": "accurate" + }, + { + "display": "标准版(不含位置)", + "value": "general_basic" + }, + { + "display": "高精度版(不含位置)", + "value": "accurate_basic" + } + ] + } + }, + { + "name": "tencent_ocr_edition", + "label": "AI版本", + "tips": "选择腾讯AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "GeneralBasicOCR" + }, + { + "display": "高精度版", + "value": "GeneralAccurateOCR" + }, + { + "display": "精简版", + "value": "GeneralEfficientOCR" + }, + { + "display": "高速版", + "value": "GeneralFastOCR" + } + ] + } + }, + { + "name": "aliyun_ocr_edition", + "label": "AI版本", + "tips": "选择阿里云AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "ocr_general" + }, + { + "display": "高精度版", + "value": "advanced" + } + ] + } + }, + { + "name": "text", + "label": "待查找文本", + "required": true, + "tips": "请输入待查找的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_regular_expression", + "label": "", + "required": true, + "tips": "输入的文本是正则表达式", + "type": "bool", + "default": "13:False", + "editor": { + "label": "是正则表达式", + "kind": "checkbox" + } + }, + { + "name": "desired_state", + "label": "如果文本", + "required": true, + "default": "10:exist", + "defaultDisplay": "存在", + "tips": "指定查找范围内指定的文本存在or不存在", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "存在", + "value": "exist" + }, + { + "display": "不存在", + "value": "not_exist" + } + ] + } + }, + { + "name": "image_source", + "label": "查找来源", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕", + "tips": "可选择整个屏幕或指定的窗口", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "foreground_window" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "required": false, + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "image_region", + "label": "查找区域", + "required": true, + "default": "10:all_region", + "defaultDisplay": "全部", + "tips": "选择整个查找区域or局部区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all_region" + }, + { + "display": "指定部分区域", + "value": "sub_region" + } + ] + } + }, + { + "name": "region_x1", + "label": "X1", + "required": false, + "tips": "图片左上角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y1", + "label": "Y1", + "required": false, + "tips": "图片左上角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_x2", + "label": "X2", + "required": false, + "tips": "图片右下角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y2", + "label": "Y2", + "required": false, + "tips": "图片右下角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "ocr.wait_text_on_screen", + "icon": "BlockIcons/23-4.png", + "description": "等待屏幕上出现/消失指定的文本", + "comment": "通过%ai_engine%AI引擎识别%image_source%上是否存在文本%text%", + "title": "等待文本(OCR)", + "function": "xbot_visual.ocr.wait_text_on_screen", + "helpUrl": "yddoc/language/zh-cn/指令文档/等待/等待文本(ocr).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Ocr.WaitTextOnScreenHandler" + } + ], + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.WaitTextOnScreenControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "baidu_ocr_edition", + "label": "AI版本", + "tips": "选择百度AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "general" + }, + { + "display": "高精度版", + "value": "accurate" + }, + { + "display": "标准版(不含位置)", + "value": "general_basic" + }, + { + "display": "高精度版(不含位置)", + "value": "accurate_basic" + } + ] + } + }, + { + "name": "tencent_ocr_edition", + "label": "AI版本", + "tips": "选择腾讯AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "GeneralBasicOCR" + }, + { + "display": "高精度版", + "value": "GeneralAccurateOCR" + }, + { + "display": "精简版", + "value": "GeneralEfficientOCR" + }, + { + "display": "高速版", + "value": "GeneralFastOCR" + } + ] + } + }, + { + "name": "aliyun_ocr_edition", + "label": "AI版本", + "tips": "选择阿里云AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "ocr_general" + }, + { + "display": "高精度版", + "value": "advanced" + } + ] + } + }, + { + "name": "text", + "label": "待查找文本", + "required": true, + "tips": "请输入待查找的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_regular_expression", + "label": "", + "required": true, + "tips": "输入的文本是正则表达式", + "type": "bool", + "default": "13:False", + "editor": { + "label": "是正则表达式", + "kind": "checkbox" + } + }, + { + "name": "desired_state", + "label": "如果文本", + "required": true, + "default": "10:appear", + "defaultDisplay": "出现", + "tips": "选择等待文本出现或消失", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "出现", + "value": "appear" + }, + { + "display": "消失", + "value": "disappear" + } + ] + } + }, + { + "name": "image_source", + "label": "查找来源", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕", + "tips": "选择一个查找来源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "foreground_window" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "required": false, + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "image_region", + "label": "查找区域", + "required": true, + "default": "10:all_region", + "defaultDisplay": "全部", + "tips": "选择文本查找区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all_region" + }, + { + "display": "指定部分区域", + "value": "sub_region" + } + ] + } + }, + { + "name": "region_x1", + "label": "X1", + "required": false, + "tips": "图片左上角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y1", + "label": "Y1", + "required": false, + "tips": "图片左上角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_x2", + "label": "X2", + "required": false, + "tips": "图片右下角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y2", + "label": "Y2", + "required": false, + "tips": "图片右下角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_wait", + "label": "", + "required": true, + "tips": "设置超时时间", + "default": "13:False", + "type": "bool", + "editor": { + "label": "设置超时时间", + "kind": "checkbox" + } + }, + { + "name": "timeout_seconds", + "label": "超时时间(s)", + "required": false, + "default": "10:20", + "tips": "请输入超时时间(秒),", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "text_wait_result", + "label": "等待结果", + "tips": "如果为True则等待成功,否则等待超时", + "name": "text_wait_result", + "type": "bool" + } + ] + }, + { + "name": "ocr.hover_on_text", + "icon": "BlockIcons/23-5.png", + "title": "鼠标悬停在文本上(OCR)", + "description": "鼠标悬停在文本上(OCR)", + "keywords": "悬浮", + "comment": "通过%ai_engine%AI引擎,识别%image_source%上文本%text%的位置,将鼠标移动到图像%anchor_type%位置", + "function": "xbot_visual.ocr.hover_on_text", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/鼠标悬停在文本上(ocr).html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.HoverOnTextControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Ocr.HoverTextHandler" + } + ], + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "baidu_ocr_edition", + "label": "AI版本", + "tips": "选择百度AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "general" + }, + { + "display": "高精度版", + "value": "accurate" + } + ] + } + }, + { + "name": "tencent_ocr_edition", + "label": "AI版本", + "tips": "选择腾讯AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "GeneralBasicOCR" + }, + { + "display": "高精度版", + "value": "GeneralAccurateOCR" + }, + { + "display": "精简版", + "value": "GeneralEfficientOCR" + }, + { + "display": "高速版", + "value": "GeneralFastOCR" + } + ] + } + }, + { + "name": "aliyun_ocr_edition", + "label": "AI版本", + "tips": "选择阿里云AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "ocr_general" + }, + { + "display": "高精度版", + "value": "advanced" + } + ] + } + }, + { + "name": "text", + "label": "待查找文本", + "required": true, + "tips": "请输入待查找的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_source", + "label": "查找来源", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕", + "tips": "选择一个查找来源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "foreground_window" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "required": false, + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": true, + "tips": "支持点击目标中心位置(元素矩形区域的中心点)、随机位置(自动随机指定目标矩形范围内的点)、自定义位置(手动指定目标点)", + "category": "advanced", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "label": "目标文本的部位", + "default": "10:middleCenter", + "tips": "选择你要将鼠标移动到文本的哪个部位上", + "category": "advanced", + "required": true, + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "category": "advanced", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "category": "advanced", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "occurrence", + "label": "相似结果位置", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "如果识别到多个结果, 可以指定位置序号,从1开始。排序规则先从左向右,再从上至下", + "type": "int", + "editor": { + "kind": "spin", + "minValue": 1 + } + } + ] + }, + { + "name": "ocr.click_text", + "icon": "BlockIcons/23-5.png", + "title": "点击文本(OCR)", + "description": "点击文本(OCR)", + "comment": "通过%ai_engine%AI引擎,识别%image_source%上文本%text%的位置,%button%%clicks%文本", + "function": "xbot_visual.ocr.click_text", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/点击文本(ocr).html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.ClickTextControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Ocr.ClickTextHandler" + } + ], + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "baidu_ocr_edition", + "label": "AI版本", + "tips": "选择百度AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "general" + }, + { + "display": "高精度版", + "value": "accurate" + } + ] + } + }, + { + "name": "tencent_ocr_edition", + "label": "AI版本", + "tips": "选择腾讯AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "GeneralBasicOCR" + }, + { + "display": "高精度版", + "value": "GeneralAccurateOCR" + }, + { + "display": "精简版", + "value": "GeneralEfficientOCR" + }, + { + "display": "高速版", + "value": "GeneralFastOCR" + } + ] + } + }, + { + "name": "aliyun_ocr_edition", + "label": "AI版本", + "tips": "选择阿里云AI识别版本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准版", + "value": "ocr_general" + }, + { + "display": "高精度版", + "value": "advanced" + } + ] + } + }, + { + "name": "text", + "label": "待查找文本", + "required": true, + "tips": "请输入待查找的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_source", + "label": "查找来源", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕", + "tips": "选择一个查找来源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "foreground_window" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "required": false, + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": true, + "tips": "支持点击目标中心位置(元素矩形区域的中心点)、随机位置(自动随机指定目标矩形范围内的点)、自定义位置(手动指定目标点)", + "category": "advanced", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "label": "目标文本的部位", + "default": "10:middleCenter", + "tips": "选择你要将鼠标移动到文本的哪个部位上", + "category": "advanced", + "required": true, + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "category": "advanced", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "category": "advanced", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "clicks", + "label": "点击次数", + "required": true, + "default": "10:click", + "defaultDisplay": "单击", + "tips": "选择点击的方式是单击还是双击", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单击", + "value": "click" + }, + { + "display": "双击", + "value": "dbclick" + } + ] + } + }, + { + "name": "button", + "label": "鼠标", + "required": true, + "default": "10:left", + "defaultDisplay": "鼠标左键", + "tips": "选择用于触发点击的鼠标按键", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "鼠标左键", + "value": "left" + }, + { + "display": "鼠标右键", + "value": "right" + } + ] + } + }, + { + "name": "keys", + "label": "辅助按键", + "required": true, + "default": "10:null", + "defaultDisplay": "无", + "category": "advanced", + "tips": "在点击时需要按下的键盘功能键", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "无", + "value": "null" + }, + { + "display": "Alt", + "value": "alt" + }, + { + "display": "Ctrl", + "value": "ctrl" + }, + { + "display": "Shift", + "value": "shift" + }, + { + "display": "Win", + "value": "win" + } + ] + } + }, + { + "name": "move_mouse", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "是否显示鼠标移动轨迹", + "type": "bool", + "editor": { + "label": "显示鼠标移动轨迹", + "kind": "checkbox" + } + }, + { + "name": "occurrence", + "label": "相似结果位置", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "如果识别到多个结果, 可以指定位置序号,从1开始。排序规则先从左向右,再从上至下", + "type": "int", + "editor": { + "kind": "spin", + "minValue": 1 + } + } + ] + }, + { + "name": "ocr.vat_invoice", + "icon": "BlockIcons/23-1.png", + "description": "增值税发票识别(OCR)", + "comment": "使用%ai_engine%AI引擎,识别增值税发票 %image_source% 中的内容,将结果保存到%vat_invoice%", + "title": "增值税发票识别", + "function": "xbot_visual.ocr.vat_invoice", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/文字识别ocr/票据识别.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.VatInvoiceControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Ocr.VatInvoiceHandler" + } + ], + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:disk", + "defaultDisplay": "本地硬盘图片", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png;*.pdf)|*.jpg;*.bmp;*.png;*.pdf" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_pdf", + "label": "", + "tips": "默认值为false,开启后可同时支持图片和PDF的识别", + "type": "bool", + "default": "13:False", + "editor": { + "label": "是否开启PDF识别", + "kind": "checkbox" + } + }, + { + "name": "pdf_page_number", + "label": "PDF页面页码", + "tips": "需要识别的PDF页面的对应页码,仅支持PDF单页识别,当上传文件为PDF且IsPdf参数值为true时有效,默认值为1", + "type": "int", + "default": "10:1", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "vat_invoice", + "label": "保存发票信息至", + "variableLabel": "增值税发票信息", + "tips": "指定一个变量名称,该变量用于存储识别出来的增值税发票信息", + "type": "xbot_visual_ocr_vat_invoice", + "name": "vat_invoice" + } + ] + }, + { + "name": "ocr.id_card", + "icon": "BlockIcons/23-1.png", + "description": "身份证识别(OCR)", + "comment": "使用%ai_engine%AI引擎,识别身份证%image_source%中的内容,将结果保存到%id_card%", + "title": "身份证识别", + "function": "xbot_visual.ocr.id_card", + "helpUrl": "yddoc/language/zh-cn/指令文档/ocr/身份证识别.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.IdCardControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:disk", + "defaultDisplay": "本地硬盘图片", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png)|*.jpg;*.bmp;*.png" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "side", + "label": "正反面", + "required": true, + "default": "10:front", + "defaultDisplay": "正面", + "tips": "选择身份证正反面", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "正面", + "value": "front" + }, + { + "display": "反面", + "value": "back" + } + ] + } + }, + { + "name": "detect_risk", + "label": "", + "tips": "是否开启身份证风险类型(身份证复印件、临时身份证、身份证翻拍、修改过的身份证)功能,默认不开启,请查看返回参数risk_type", + "type": "bool", + "default": "13:False", + "editor": { + "label": "开启身份证风险类型", + "kind": "checkbox" + } + }, + { + "name": "detect_photo", + "label": "", + "tips": "是否检测头像内容,默认不检测。可选值:true-检测头像并返回头像的 base64 编码及位置信息", + "type": "bool", + "default": "13:False", + "editor": { + "label": "检测头像内容", + "kind": "checkbox" + } + }, + { + "name": "crop_idcard", + "label": "", + "tips": "身份证照片裁剪(去掉证件外多余的边缘、自动矫正拍摄角度)", + "type": "bool", + "default": "13:False", + "editor": { + "label": "身份证照片裁剪", + "kind": "checkbox" + } + }, + { + "name": "crop_portrait", + "label": "", + "tips": "人像照片裁剪(自动抠取身份证头像区域)", + "type": "bool", + "default": "13:False", + "editor": { + "label": "人像照片裁剪", + "kind": "checkbox" + } + }, + { + "name": "quality", + "label": "", + "tips": "图片质量分数(评价图片的模糊程度)", + "type": "bool", + "default": "13:False", + "editor": { + "label": "图片质量分数", + "kind": "checkbox" + } + }, + { + "name": "copy_warn", + "label": "", + "tips": "复印件告警", + "type": "bool", + "default": "13:False", + "editor": { + "label": "复印件告警", + "kind": "checkbox" + } + }, + { + "name": "border_check_warn", + "label": "", + "tips": "边框和框内遮挡告警", + "type": "bool", + "default": "13:False", + "editor": { + "label": "边框和框内遮挡告警", + "kind": "checkbox" + } + }, + { + "name": "reshoot_warn", + "label": "", + "tips": "翻拍告警", + "type": "bool", + "default": "13:False", + "editor": { + "label": "翻拍告警", + "kind": "checkbox" + } + }, + { + "name": "detect_ps_warn", + "label": "", + "tips": "PS检测告警", + "type": "bool", + "default": "13:False", + "editor": { + "label": "PS检测告警", + "kind": "checkbox" + } + }, + { + "name": "tempid_warn", + "label": "", + "tips": "临时身份证告警", + "type": "bool", + "default": "13:False", + "editor": { + "label": "临时身份证告警", + "kind": "checkbox" + } + }, + { + "name": "invalid_date_warn", + "label": "", + "tips": "身份证有效日期不合法告警", + "type": "bool", + "default": "13:False", + "editor": { + "label": "身份证有效日期不合法告警", + "kind": "checkbox" + } + }, + { + "name": "reflect_warn", + "label": "", + "tips": "是否开启反光检测", + "type": "bool", + "default": "13:False", + "editor": { + "label": "开启反光检测", + "kind": "checkbox" + } + }, + { + "name": "multi_card_detect", + "label": "", + "tips": "是否开启多卡证检测", + "type": "bool", + "default": "13:False", + "editor": { + "label": "开启多卡证检测", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "id_card", + "label": "保存身份证信息至", + "variableLabel": "身份证信息", + "tips": "指定一个变量名称,该变量用于存储识别出来的身份证信息", + "type": "xbot_visual_ocr_id_card", + "name": "id_card" + } + ] + }, + { + "name": "ocr.license_plate", + "icon": "BlockIcons/23-1.png", + "description": "车牌识别(OCR)", + "comment": "使用%ai_engine%AI引擎,识别图片%image_source%中的车牌信息,将结果保存到%license_plate%", + "title": "车牌识别", + "function": "xbot_visual.ocr.license_plate", + "helpUrl": "yddoc/language/zh-cn/指令文档/ocr/车牌识别.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.LicensePlateControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:disk", + "defaultDisplay": "本地硬盘图片", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png)|*.jpg;*.bmp;*.png" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "multi_crop", + "label": "", + "tips": "当设成true时,会做多crop预测,只有当多crop返回的结果一致,并且置信度>0.9时,才返回结果", + "type": "bool", + "default": "13:False", + "editor": { + "label": "开启多crop预测", + "kind": "checkbox" + } + }, + { + "name": "multi_detect", + "label": "", + "tips": "是否检测多张车牌,默认为false,当置为true的时候可以对一张图片内的多张车牌进行识别", + "type": "bool", + "default": "13:False", + "editor": { + "label": "检测多张车牌", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "license_plate", + "label": "保存车牌信息至", + "variableLabel": "车牌信息", + "tips": "指定一个变量名称,该变量用于存储识别出来的车牌信息", + "type": "xbot_visual_ocr_license_plate", + "name": "license_plate" + } + ] + }, + { + "name": "ocr.bank_card", + "icon": "BlockIcons/23-1.png", + "description": "银行卡识别(OCR)", + "comment": "使用%ai_engine%AI引擎,识别图片%image_source%中的银行卡信息,将结果保存到%bank_card%", + "title": "银行卡识别", + "function": "xbot_visual.ocr.bank_card", + "helpUrl": "yddoc/language/zh-cn/指令文档/ocr/银行卡识别.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.BankCardControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:disk", + "defaultDisplay": "本地硬盘图片", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png)|*.jpg;*.bmp;*.png" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "detect_direction", + "label": "", + "tips": "是否检测图像朝向,默认检测,即:true。可选值包括true - 检测朝向;false - 不检测朝向。朝向是指输入图像是正常方向、逆时针旋转90/180/270度", + "type": "bool", + "default": "13:True", + "editor": { + "label": "检测图像朝向", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "bank_card", + "label": "保存银行卡信息至", + "variableLabel": "银行卡信息", + "tips": "指定一个变量名称,该变量用于存储识别出来的银行卡信息", + "type": "xbot_visual_ocr_bank_card", + "name": "bank_card" + } + ] + }, + { + "name": "ocr.id_license_discern", + "icon": "BlockIcons/23-1.png", + "description": "对身份证、银行卡、车牌号等多种卡证进行识别", + "title": "卡证识别", + "function": "xbot_visual.ocr.id_license_discern", + "comment": "", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/文字识别ocr/卡证识别.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.IdLicenseDiscernControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Ocr.IdLicenseDiscernHandler" + } + ], + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "id_type", + "label": "卡证类型", + "required": true, + "tips": "选择一个卡证类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "身份证", + "value": "id_card" + }, + { + "display": "银行卡", + "value": "blank_card" + }, + { + "display": "车牌", + "value": "license_plate" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:disk", + "defaultDisplay": "本地硬盘图片", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png)|*.jpg;*.bmp;*.png" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "side", + "label": "正反面", + "required": true, + "default": "10:front", + "defaultDisplay": "正面", + "tips": "选择身份证正反面", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "正面", + "value": "front" + }, + { + "display": "反面", + "value": "back" + } + ] + } + }, + { + "name": "detect_risk", + "label": "", + "tips": "是否开启身份证风险类型(身份证复印件、临时身份证、身份证翻拍、修改过的身份证)功能,默认不开启,请查看返回参数risk_type", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "开启身份证风险类型", + "kind": "checkbox" + } + }, + { + "name": "detect_photo", + "label": "", + "tips": "是否检测头像内容,默认不检测。可选值:true-检测头像并返回头像的 base64 编码及位置信息", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "检测头像内容", + "kind": "checkbox" + } + }, + { + "name": "crop_idcard", + "label": "", + "tips": "身份证照片裁剪(去掉证件外多余的边缘、自动矫正拍摄角度)", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "身份证照片裁剪", + "kind": "checkbox" + } + }, + { + "name": "crop_portrait", + "label": "", + "tips": "人像照片裁剪(自动抠取身份证头像区域)", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "人像照片裁剪", + "kind": "checkbox" + } + }, + { + "name": "quality", + "label": "", + "tips": "图片质量分数(评价图片的模糊程度)", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "图片质量分数", + "kind": "checkbox" + } + }, + { + "name": "copy_warn", + "label": "", + "tips": "复印件告警", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "复印件告警", + "kind": "checkbox" + } + }, + { + "name": "border_check_warn", + "label": "", + "tips": "边框和框内遮挡告警", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "边框和框内遮挡告警", + "kind": "checkbox" + } + }, + { + "name": "reshoot_warn", + "label": "", + "tips": "翻拍告警", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "翻拍告警", + "kind": "checkbox" + } + }, + { + "name": "detect_ps_warn", + "label": "", + "tips": "PS检测告警", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "PS检测告警", + "kind": "checkbox" + } + }, + { + "name": "tempid_warn", + "label": "", + "tips": "临时身份证告警", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "临时身份证告警", + "kind": "checkbox" + } + }, + { + "name": "invalid_date_warn", + "label": "", + "tips": "身份证有效日期不合法告警", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "身份证有效日期不合法告警", + "kind": "checkbox" + } + }, + { + "name": "reflect_warn", + "label": "", + "tips": "是否开启反光检测", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "开启反光检测", + "kind": "checkbox" + } + }, + { + "name": "multi_card_detect", + "label": "", + "tips": "是否开启多卡证检测", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "开启多卡证检测", + "kind": "checkbox" + } + }, + { + "name": "detect_direction", + "label": "", + "tips": "是否检测图像朝向,默认检测,即:true。可选值包括true - 检测朝向;false - 不检测朝向。朝向是指输入图像是正常方向、逆时针旋转90/180/270度", + "type": "bool", + "default": "13:True", + "category": "advanced", + "editor": { + "label": "检测图像朝向", + "kind": "checkbox" + } + }, + { + "name": "multi_crop", + "label": "", + "tips": "当设成true时,会做多crop预测,只有当多crop返回的结果一致,并且置信度>0.9时,才返回结果", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "开启多crop预测", + "kind": "checkbox" + } + }, + { + "name": "multi_detect", + "label": "", + "tips": "是否检测多张车牌,默认为false,当置为true的时候可以对一张图片内的多张车牌进行识别", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "检测多张车牌", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "id_license", + "label": "识别结果保存至", + "variableLabel": "卡证信息", + "tips": "指定一个变量名称,该变量用于存储识别出来的卡证信息", + "type": "any", + "name": "id_license" + } + ] + }, + { + "name": "ocr.train_ticket", + "icon": "BlockIcons/23-1.png", + "description": "火车票识别(OCR)", + "comment": "使用%ai_engine%AI引擎,识别图片%image_source%中的火车票信息,将结果保存到%train_ticket%", + "title": "火车票识别", + "function": "xbot_visual.ocr.train_ticket", + "helpUrl": "yddoc/language/zh-cn/指令文档/ocr/火车票识别.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.TrainTicketControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:disk", + "defaultDisplay": "本地硬盘图片", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png)|*.jpg;*.bmp;*.png" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "train_ticket", + "label": "保存火车票信息至", + "variableLabel": "火车票信息", + "tips": "指定一个变量名称,该变量用于存储识别出来的火车票信息", + "type": "xbot_visual_ocr_train_ticket", + "name": "train_ticket" + } + ] + }, + { + "name": "ocr.taxi_invoice", + "icon": "BlockIcons/23-1.png", + "description": "出租车票识别(OCR)", + "comment": "使用%ai_engine%AI引擎,识别图片%image_source%中的出租车票信息,将结果保存到%taxi_invoice%", + "title": "出租车票识别", + "function": "xbot_visual.ocr.taxi_invoice", + "helpUrl": "yddoc/language/zh-cn/指令文档/ocr/出租车票识别.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.TaxiInvoiceControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:disk", + "defaultDisplay": "本地硬盘图片", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png)|*.jpg;*.bmp;*.png" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "taxi_invoice", + "label": "保存出租车票信息至", + "variableLabel": "出租车票信息", + "tips": "指定一个变量名称,该变量用于存储识别出来的出租车票信息", + "type": "xbot_visual_ocr_taxi_invoice", + "name": "taxi_invoice" + } + ] + }, + { + "name": "ocr.note_discern", + "icon": "BlockIcons/23-1.png", + "description": "对增值税发票、火车票、出租车票等各种票据进行识别", + "title": "票据识别", + "function": "xbot_visual.ocr.note_discern", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.NoteDiscernControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/文字识别ocr/票据识别.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Ocr.NoteDiscernHandler" + } + ], + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "note_type", + "label": "票据类型", + "required": true, + "tips": "选择一个票据类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "增值税发票", + "value": "vat_invoice" + }, + { + "display": "出租车票", + "value": "taxi_invoice" + }, + { + "display": "火车票", + "value": "train_ticket" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:disk", + "defaultDisplay": "本地硬盘图片", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png;*.pdf)|*.jpg;*.bmp;*.png;*.pdf" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_pdf", + "label": "", + "tips": "默认值为false,开启后可同时支持图片和PDF的识别", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "是否开启PDF识别", + "kind": "checkbox" + } + }, + { + "name": "pdf_page_number", + "label": "PDF页面页码", + "tips": "需要识别的PDF页面的对应页码,仅支持PDF单页识别,当上传文件为PDF且IsPdf参数值为true时有效,默认值为1", + "type": "int", + "default": "10:1", + "category": "advanced", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "note_invoice", + "label": "保存票据信息至", + "variableLabel": "票据信息信息", + "tips": "指定一个变量名称,该变量用于存储识别出来的票据信息", + "type": "any", + "name": "note_invoice" + } + ] + }, + { + "name": "ocr.table", + "icon": "BlockIcons/23-1.png", + "description": "表格识别(OCR)", + "comment": "使用%ai_engine%AI引擎,识别图片%image_source%中的表格信息,将结果保存到%table%", + "title": "表格识别", + "function": "xbot_visual.ocr.table", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Ocr.TableControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/人工智能ai/文字识别ocr/表格识别.html", + "inputs": [ + { + "name": "ai_engine", + "label": "AI引擎", + "required": true, + "tips": "选择一个AI引擎", + "type": "xbot.ai.AIEngine", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "影刀", + "value": "shadowbot" + } + ] + } + }, + { + "name": "image_source", + "label": "图像源", + "required": true, + "default": "10:disk", + "defaultDisplay": "本地硬盘图片", + "tips": "选择一个图像源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地硬盘图片", + "value": "disk" + }, + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "网络图片", + "value": "url" + } + ] + } + }, + { + "name": "path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png;*.pdf)|*.jpg;*.bmp;*.png;*.pdf" + } + } + }, + { + "name": "url", + "label": "图片URL", + "tips": "图片URL", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "save_to_excel", + "label": "", + "required": true, + "tips": "将表格识别结果直接保存到Excel表格", + "type": "bool", + "default": "13:False", + "editor": { + "label": "识别结果保存到Excel", + "kind": "checkbox" + } + }, + { + "name": "excel_path", + "label": "Excel文件路径", + "tips": "填写或选择要打开的Excel文件路径,若不存在将自动创建", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "defaultFileName": "Workbook", + "filter": "Excel 工作簿 (.xlsx)|*.xlsx" + } + } + }, + { + "name": "dir_assure", + "label": "", + "tips": "图片方向是否确定是正向的: true(确定)/false(不确定)", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "图片方向确定为正向", + "kind": "checkbox" + } + }, + { + "name": "line_less", + "label": "", + "tips": "是否无线条: true(无线条,或者只有横线没有竖线)/false(有线条)", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "无线条", + "kind": "checkbox" + } + }, + { + "name": "is_pdf", + "label": "", + "tips": "是否开启PDF识别,默认值为false,开启后可同时支持图片和PDF的识别", + "type": "bool", + "default": "13:False", + "category": "advanced", + "editor": { + "label": "开启PDF识别", + "kind": "checkbox" + } + }, + { + "name": "pdf_page_number", + "label": "PDF页码", + "default": "10:1", + "category": "advanced", + "tips": "需要识别的PDF页面的对应页码,仅支持PDF单页识别,当上传文件为PDF且IsPdf参数值为true时有效,默认值为1", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "table", + "label": "保存表格信息至", + "variableLabel": "表格信息", + "tips": "指定一个变量名称,该变量用于存储识别出来的表格信息", + "type": "xbot_visual_ocr_table", + "name": "table" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/pdf.blocks.json b/src/assert/block_settings/pdf.blocks.json new file mode 100644 index 0000000..2704ff2 --- /dev/null +++ b/src/assert/block_settings/pdf.blocks.json @@ -0,0 +1,687 @@ +{ + "types": [], + "blocks": [ + { + "name": "pdf.extract_text", + "function": "xbot_visual.pdf.extract_text", + "title": "PDF提取文本", + "description": "这个指令用于从PDF文件中提取文本", + "comment": "从%path%文件中提取%page_scope%的文本,将结果保存到%text%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Pdf.ExtractTextControl, ShadowBot.Shell.Development", + "icon": "BlockIcons/26-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/pdf文件/提取文本.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Pdf.ExtractTextHandler" + } + ], + "inputs": [ + { + "name": "path", + "label": "文件路径", + "required": true, + "tips": "请输入PDF文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "PDF文件 (.pdf)|*.pdf" + } + } + }, + { + "name": "page_scope", + "label": "提取范围", + "required": true, + "default": "10:all", + "defaultDisplay": "全部", + "tips": "选择提取页码范围", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all" + }, + { + "display": "单页", + "value": "single" + }, + { + "display": "部分", + "value": "part" + } + ] + } + }, + { + "name": "page", + "label": "页码", + "required": false, + "tips": "请输入待提取的单页页码", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "from_page", + "label": "起始页码", + "required": false, + "tips": "请输入待提取的起始页码", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "to_page", + "label": "终止页码", + "required": false, + "tips": "请输入待提取的终止页码, 输入-1表示最后一页", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "use_password", + "label": "", + "required": true, + "category": "advanced", + "tips": "打开文件是否需要输入密码", + "type": "bool", + "default": "13:False", + "editor": { + "label": "使用密码", + "kind": "checkbox" + } + }, + { + "name": "password", + "label": "密码", + "required": false, + "category": "advanced", + "tips": "请输入文件密码", + "type": "str", + "editor": { + "kind": "password" + } + } + ], + "outputs": [ + { + "id": "text", + "label": "保存文本至", + "variableLabel": "PDF中提取的文本", + "tips": "请输入一个名字,用来保存文本", + "type": "str", + "name": "text" + } + ] + }, + { + "name": "pdf.extract_images", + "function": "xbot_visual.pdf.extract_images", + "title": "PDF提取图片", + "description": "这个指令用于从PDF文件中提取图片", + "comment": "从%path%文件中提取%page_scope%的图片,并以%image_name%为名称前缀保存到%save_to_dir%目录下,将图片路径保存到%image_paths%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Pdf.ExtractImageControl, ShadowBot.Shell.Development", + "icon": "BlockIcons/26-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/pdf文件/提取图片.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Pdf.ExtractImageHandler" + } + ], + "inputs": [ + { + "name": "path", + "label": "文件路径", + "required": true, + "tips": "请输入PDF文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "PDF文件 (.pdf)|*.pdf" + } + } + }, + { + "name": "page_scope", + "label": "提取范围", + "required": true, + "default": "10:all", + "defaultDisplay": "全部", + "tips": "选择提取页码范围", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all" + }, + { + "display": "单页", + "value": "single" + }, + { + "display": "部分", + "value": "part" + } + ] + } + }, + { + "name": "page", + "label": "页码", + "required": false, + "tips": "请输入待提取的单页页码", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "from_page", + "label": "起始页码", + "required": false, + "tips": "请输入待提取的起始页码", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "to_page", + "label": "终止页码", + "required": false, + "tips": "请输入待提取的终止页码, 输入-1表示最后一页", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "name_prefix", + "label": "图片名称前缀", + "required": true, + "tips": "请输入图片名称前缀", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "save_to_dir", + "label": "保存图片至", + "required": true, + "tips": "请输入保存图片的文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "use_password", + "label": "", + "required": true, + "category": "advanced", + "tips": "打开文件是否需要输入密码", + "type": "bool", + "default": "13:False", + "editor": { + "label": "使用密码", + "kind": "checkbox" + } + }, + { + "name": "password", + "label": "密码", + "required": false, + "category": "advanced", + "tips": "请输入文件密码", + "type": "str", + "editor": { + "kind": "password" + } + } + ], + "outputs": [ + { + "id": "image_paths", + "label": "保存图片路径列表至", + "variableLabel": "PDF中提取的图片路径列表", + "tips": "请输入一个名字,用来保存图片路径列表至", + "type": "list", + "name": "image_paths" + } + ] + }, + { + "name": "pdf.extract_pages", + "function": "xbot_visual.pdf.extract_pages", + "title": "导出新PDF文档", + "description": "这个指令用于从当前PDF文件中导出新的PDF文档", + "comment": "从文件%path%中导出部分页,将内容保存到新文件%file_path%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Pdf.ExtractPdfControl, ShadowBot.Shell.Development", + "icon": "BlockIcons/26-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/pdf文件/导出新的pdf文件.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Pdf.ExtractPdfHandler" + } + ], + "inputs": [ + { + "name": "path", + "label": "原始文件路径", + "required": true, + "tips": "请输入原始文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "PDF文件 (.pdf)|*.pdf" + } + } + }, + { + "name": "page_scope", + "label": "提取范围", + "required": true, + "default": "10:single", + "defaultDisplay": "单页", + "tips": "选择提取页码范围", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单页", + "value": "single" + }, + { + "display": "部分", + "value": "part" + } + ] + } + }, + { + "name": "page", + "label": "页码", + "required": false, + "tips": "请输入待导出的单页页码", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "from_page", + "label": "起始页码", + "required": false, + "tips": "请输入待导出的起始页码", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "to_page", + "label": "终止页码", + "required": false, + "tips": "请输入待导出的终止页码, 输入-1表示最后一页", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "save_to", + "label": "新文件保存到", + "required": true, + "tips": "请输入新文件保存路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "filter": "PDF 文件|*.pdf" + } + } + }, + { + "name": "save_way", + "label": "如果文件存在", + "required": true, + "default": "10:add_sequential_suffix", + "defaultDisplay": "文件名称末尾添加序号", + "tips": "请选择若文件已经存在时,文件保存方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖", + "value": "overwrite" + }, + { + "display": "终止导出新文件", + "value": "stop_extract_if_exist" + }, + { + "display": "文件名称末尾添加序号", + "value": "add_sequential_suffix" + } + ] + } + }, + { + "name": "use_password", + "label": "", + "required": true, + "category": "advanced", + "tips": "打开文件是否需要输入密码", + "type": "bool", + "default": "13:False", + "editor": { + "label": "使用密码", + "kind": "checkbox" + } + }, + { + "name": "password", + "label": "密码", + "required": false, + "category": "advanced", + "tips": "请输入文件密码", + "type": "str", + "editor": { + "kind": "password" + } + } + ], + "outputs": [ + { + "id": "file_path", + "label": "保存新文件路径至", + "variableLabel": "导出的PDF文件路径", + "tips": "请输入一个名字,用来保存新文件路径", + "type": "str", + "name": "file_path" + } + ] + }, + { + "name": "pdf.merge_pdfs", + "function": "xbot_visual.pdf.merge_pdfs", + "title": "合并PDF文档", + "description": "这个指令用于合并PDF文档,并保存到指定的新文档", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Pdf.MergePdfControl, ShadowBot.Shell.Development", + "comment": "合并%paths%这些文件,将结果保存到%save_to%", + "icon": "BlockIcons/26-4.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/pdf文件/合并pdf文档.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Pdf.MergePdfHandler" + } + ], + "inputs": [ + { + "name": "paths", + "label": "待合并的文件列表", + "required": true, + "tips": "可同时选择多个文件。或切换到Python模式下,输入列表变量,比如: ['文件1路径','文件2路径']", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFiles", + "filter": "PDF文件 (.pdf)|*.pdf" + } + } + }, + { + "name": "save_to", + "label": "合并后保存至", + "required": true, + "tips": "请输入合并后的文件保存路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "filter": "PDF 文件|*.pdf" + } + } + }, + { + "name": "save_way", + "label": "如果文件存在", + "required": true, + "default": "10:add_sequential_suffix", + "defaultDisplay": "文件名称末尾添加序号", + "tips": "请选择若文件已经存在时,文件保存方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖", + "value": "overwrite" + }, + { + "display": "终止合并", + "value": "stop_extract_if_exist" + }, + { + "display": "文件名称末尾添加序号", + "value": "add_sequential_suffix" + } + ] + } + }, + { + "name": "use_password", + "label": "", + "required": true, + "category": "advanced", + "tips": "打开文件是否需要输入密码", + "type": "bool", + "default": "13:False", + "editor": { + "label": "使用密码", + "kind": "checkbox" + } + }, + { + "name": "passwords", + "label": "密码", + "required": false, + "category": "advanced", + "tips": "请输入文件密码,文件密码和文件路径一一对应", + "type": "str", + "editor": { + "kind": "password" + } + }, + { + "name": "delimiter", + "label": "分割符", + "required": false, + "category": "advanced", + "tips": "请输入密码分割符", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "file_path", + "label": "保存合并的路径至", + "variableLabel": "合并后的PDF文件路径", + "tips": "请输入一个名字,用来保存新文件路径", + "type": "str", + "name": "file_path" + } + ] + }, + { + "name": "pdf.save_pages_to_images", + "function": "xbot_visual.pdf.save_pages_to_images", + "title": "将PDF指定页另存为图片", + "description": "这个指令用于将指定页另存为图片", + "comment": "将文件%path%的指定页另存为图片,并以%name_prefix%为名称前缀保存到目录%save_to_dir%中,将图片保存路径保存到%page_image_paths%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Pdf.SavePagesToImageControl, ShadowBot.Shell.Development", + "icon": "BlockIcons/26-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/pdf文件/将指定页另存为图片.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Pdf.SavePagesToImagesHandler" + } + ], + "inputs": [ + { + "name": "path", + "label": "文件路径", + "required": true, + "tips": "请输入PDF文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "PDF文件 (.pdf)|*.pdf" + } + } + }, + { + "name": "page_scope", + "label": "提取范围", + "required": true, + "default": "10:all", + "defaultDisplay": "全部", + "tips": "选择提取页码范围", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all" + }, + { + "display": "单页", + "value": "single" + }, + { + "display": "部分", + "value": "part" + } + ] + } + }, + { + "name": "page", + "label": "页码", + "required": false, + "tips": "请输入待提取的单页页码", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "from_page", + "label": "起始页码", + "required": false, + "tips": "请输入待提取的起始页码", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "to_page", + "label": "终止页码", + "required": false, + "tips": "请输入待提取的终止页码, 输入-1表示最后一页", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "name_prefix", + "label": "图片名称前缀", + "required": true, + "tips": "请输入图片名称前缀", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "save_to_dir", + "label": "保存图片至", + "required": true, + "tips": "请输入保存图片的文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "use_password", + "label": "", + "required": true, + "category": "advanced", + "tips": "打开文件是否需要输入密码", + "type": "bool", + "default": "13:False", + "editor": { + "label": "使用密码", + "kind": "checkbox" + } + }, + { + "name": "password", + "label": "密码", + "required": false, + "category": "advanced", + "tips": "请输入文件密码", + "type": "str", + "editor": { + "kind": "password" + } + } + ], + "outputs": [ + { + "id": "page_image_paths", + "label": "保存图片路径列表至", + "variableLabel": "PDF中另存为的图片路径列表", + "tips": "请输入一个名字,用来保存图片路径列表至", + "type": "list", + "name": "page_image_paths" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/process.blocks.json b/src/assert/block_settings/process.blocks.json new file mode 100644 index 0000000..ae98c3a --- /dev/null +++ b/src/assert/block_settings/process.blocks.json @@ -0,0 +1,258 @@ +{ + "types": [], + "blocks": [ + { + "name": "process.run", + "statement": "process.run", + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/调用流程.html", + "icon": "BlockIcons/21-2.png", + "title": "调用流程", + "keywords": "调用子流程", + "description": "执行指定名称的内部流程", + "comment": "执行流程%process%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.RunProcessControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.RunProcessHandler" + } + ], + "inputs": [ + { + "name": "process", + "label": "模块名称", + "required": true, + "tips": "选择要执行的模块名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "package", + "label": "当前Python包对象", + "required": true, + "tips": "根据当前Python包对象动态导入指定流程", + "default": "11:__name__", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "inputs", + "label": "输入参数列表", + "required": false, + "tips": "输入参数列表", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "outputs", + "label": "输出参数列表", + "required": false, + "tips": "输出参数列表", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "process_result", + "label": "保存流程输出结果至", + "tips": "指定一个变量名称,该变量用于保存用户输入结果,如果用户取消对话框则返回None否则返回dict对象", + "name": "process_result", + "type": "dict" + } + ] + }, + { + "name": "process.invoke_module", + "statement": "process.invoke_module", + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/调用模块.html", + "icon": "BlockIcons/21-4.png", + "title": "调用模块", + "keywords": "调用python", + "description": "调用应用内的其他模块", + "comment": "调用模块%module%中的%function%方法", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.InvokeModule, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.InvokeModuleHandler" + } + ], + "inputs": [ + { + "name": "module", + "label": "模块名称", + "required": true, + "tips": "选择要执行的模块名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "function", + "label": "方法名称", + "required": true, + "tips": "选择要执行的方法名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "params", + "label": "方法参数列表", + "required": false, + "tips": "方法参数列表", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "returnType", + "label": "返回值类型", + "required": false, + "tips": "返回值类型", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "invoke_result", + "label": "模块调用结果", + "variableLabel": "模块调用结果", + "type": "any", + "name": "invoke_result" + } + ] + }, + { + "name": "process.return", + "statement": "process.return", + "canDebug": false, + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/退出流程.html", + "icon": "BlockIcons/21-1.png", + "description": "退出当前流程并继续执行其他流程", + "comment": "退出当前流程并继续执行其他流程", + "title": "退出当前流程" + }, + { + "name": "process.exit", + "statement": "process.exit", + "canDebug": false, + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/应用/终止应用.html", + "icon": "BlockIcons/21-3.png", + "description": "停止整个应用的运行", + "comment": "停止整个应用的运行", + "keywords": "退出应用;结束应用", + "title": "终止应用" + }, + { + "name": "process.get_app_params", + "function": "xbot_visual.process.get_app_params", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Process.GetAppParamsHandler" + } + ], + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/应用/获取应用参数.html", + "icon": "BlockIcons/21-2.png", + "title": "获取应用参数", + "description": "获取应用参数", + "comment": "获取应用参数,将结果保存到%param_value%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.GetAppParams, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "param_name", + "label": "参数类型", + "type": "str", + "editor": { + "kind": "select", + "options": [] + } + } + ], + "outputs": [ + { + "id": "param_value", + "label": "保存参数值至", + "variableLabel": "应用参数值", + "type": "str", + "name": "param_value" + } + ] + }, + { + "name": "process.write_to_storage", + "function": "xbot_visual.process.write_to_storage", + "title": "保存自定义数据", + "description": "可持久保存流程中的用户数据", + "comment": "保存自定义数据%content%到%key%", + "icon": "BlockIcons/12-10.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/应用/保存自定义数据.html", + "inputs": [ + { + "name": "key", + "label": "读取Key", + "required": true, + "tips": "数据读取时需要, 读取只限同一用户、同一应用 \r\n相同Key多次保存,内容会被覆盖", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "content", + "label": "数据内容", + "required": true, + "tips": "需要保存的数据内容,长度不超过20000个字符", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "process.read_from_storage", + "function": "xbot_visual.process.read_from_storage", + "title": "读取自定义数据", + "description": "读取流程中已保存的自定义数据", + "comment": "读取自定义数据%key%,将结果保存到%content%", + "icon": "BlockIcons/12-11.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/应用/读取自定义数据.html", + "inputs": [ + { + "name": "key", + "label": "Key", + "required": true, + "tips": "“保存自定义数据”指令中指定的读取Key", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "content", + "label": "数据内容", + "variableLabel": "自定义数据内容", + "tips": "若根据key未找到,返回None", + "type": "str", + "name": "content" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/programing.blocks.json b/src/assert/block_settings/programing.blocks.json new file mode 100644 index 0000000..5265c8b --- /dev/null +++ b/src/assert/block_settings/programing.blocks.json @@ -0,0 +1,538 @@ +{ + "types": [], + "blocks": [ + { + "name": "programing.log", + "title": "打印日志", + "description": "将变量或者文本打印输出,输出内容可在【运行日志】区查看", + "comment": "打印日志(%type%):%text%", + "icon": "BlockIcons/8-1.png", + "function": "xbot_visual.programing.log", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/打印日志.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Programing.LogHandler" + } + ], + "inputs": [ + { + "name": "type", + "label": "日志类型", + "required": true, + "tips": null, + "type": "str", + "default": "10:info", + "defaultDisplay": "信息", + "editor": { + "kind": "select", + "options": [ + { + "display": "调试", + "value": "debug" + }, + { + "display": "信息", + "value": "info" + }, + { + "display": "警告", + "value": "warning" + }, + { + "display": "错误", + "value": "error" + } + ] + } + }, + { + "name": "text", + "label": "日志内容", + "required": true, + "tips": null, + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "programing.undefined", + "function": "xbot_visual.programing.undefined", + "icon": "BlockIcons/8-11.png", + "canDebug": false, + "description": "指令在应用中未找到,可尝试升级客户端或联系作者解决", + "comment": "%message% 指令在指令库中未找到", + "title": "未找到指令", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Programing.BlockUndefinedControl, ShadowBot.Shell.Development", + "helpUrl": "", + "sourceBlock": "", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Programing.UndefinedHandler" + } + ], + "inputs": [ + { + "name": "message", + "label": "名称", + "required": false, + "tips": "未找到的自定义指令的名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "sourceBlock", + "label": "元数据", + "required": false, + "tips": "原指令的元数据,请勿修改", + "type": "str", + "editor": { + "kind": "textbox" + } + } + + ] + }, + { + "name": "programing.exportlog", + "title": "导出日志", + "description": "将日志导出到文件", + "comment": "导出日志至 %custom_folder_path%\\%file_name%", + "icon": "BlockIcons/8-16.png", + "function": "xbot_visual.programing.exportlog", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/导出日志.html", + "inputs": [ + { + "name": "custom_folder_path", + "label": "文件夹路径", + "required": true, + "tips": "指定文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "file_name", + "label": "文件名称", + "required": true, + "default": "10:日志文件.txt", + "tips": "指定文件名称", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "file_path", + "label": "文件路径", + "variableLabel": "导出的文件路径", + "tips": "指定一个变量名称, 该变量用于保存导出文件的位置", + "type": "str", + "name": "file_path" + } + ] + }, + { + "name": "programing.sleep", + "title": "等待", + "description": "让流程等待一段时间", + "comment": "等待%seconds%秒后继续运行", + "icon": "BlockIcons/8-2.png", + "function": "xbot_visual.programing.sleep", + "helpUrl": "yddoc/language/zh-cn/指令文档/等待/等待说明.html", + "keywords": "延迟;延时", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Programing.ProgramingSleep", + "video": { + "time": "05:09" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Programing.ProgramingSleepHandler" + } + ], + "inputs": [ + { + "name": "random_number", + "label": " ", + "required": true, + "default": "13:False", + "tips": "等待时长是随机数", + "type": "bool", + "editor": { + "label": "等待时长随机", + "kind": "checkbox" + } + }, + { + "name": "seconds", + "label": "时长(秒)", + "tips": null, + "type": "float", + "default": "10:1", + "editor": { + "kind": "textbox" + } + }, + { + "name": "start_number", + "label": "最小时长(秒)", + "required": true, + "tips": "随机数从开始数字到结束数字这一段区间中产生,包括开始数字和结束数字", + "type": "int", + "default": "10:1", + "editor": { + "kind": "textbox" + } + }, + { + "name": "stop_number", + "label": "最大时长(秒)", + "required": true, + "tips": "随机数从开始数字到结束数字这一段区间中产生,包括开始数字和结束数字", + "type": "int", + "default": "10:5", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "programing.variable", + "title": "设置变量", + "statement": "programing.variable", + "description": "创建一个新的变量并给它赋值,或对已经存在的变量重新赋值", + "comment": "设置%value_type%变量%variable%=%value%", + "icon": "BlockIcons/8-3.png", + "function": "xbot_visual.programing.variable", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Programing.SetVariableControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/设置变量.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Programing.SetVariableHandler" + } + ], + "inputs": [ + { + "name": "value_type", + "label": "变量类型", + "tips": "选择要执行的流程名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "value", + "label": "变量值", + "required": false, + "tips": "指定变量中保存的值", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "variable", + "label": "变量名", + "variableLabel": "变量", + "type": "str", + "tips": "输入一个名称作为变量名,将变量值保存至此变量中", + "name": "variable" + } + ] + }, + { + "name": "programing.random_int", + "icon": "BlockIcons/8-12.png", + "description": "产生随机数", + "comment": "在最小数%start_number%与最大数%stop_number%之间产生随机数,将随机数保存到%random_number%", + "title": "产生随机数", + "function": "xbot_visual.programing.random_int", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/产生随机数.html", + "inputs": [ + { + "name": "start_number", + "label": "最小数", + "required": true, + "tips": "随机数从开始数字到结束数字这一段区间中产生,包括开始数字和结束数字", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "stop_number", + "label": "最大数", + "required": true, + "tips": "随机数从开始数字到结束数字这一段区间中产生,包括开始数字和结束数字", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "random_number", + "label": "随机数保存至", + "variableLabel": "随机数", + "tips": "输入一个名字,用来保存产生的随机数", + "type": "int", + "name": "random_number" + } + ] + }, + { + "name": "programing.snippet", + "title": "插入代码段(Python)", + "statement": "programing.snippet", + "description": "插入代码段(Python)", + "comment": "执行Python语句:%snippet%", + "icon": "BlockIcons/8-4.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/插入代码段(python).html", + "inputs": [ + { + "name": "snippet", + "label": "Python代码段", + "required": true, + "tips": null, + "type": "str", + "editor": { + "kind": "code", + "language": "python" + } + } + ] + }, + { + "name": "programing.comment", + "statement": "programing.comment", + "title": "添加备注说明", + "keywords": "注释", + "description": "在流程中插入一条文字说明", + "icon": "BlockIcons/8-5.png", + "comment": "%content%", + "isCommentBlock": true, + "isPseudo": true, + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/添加备注说明.html", + "inputs": [ + { + "name": "content", + "label": "备注说明", + "required": true, + "tips": null, + "type": "str", + "editor": { + "kind": "PlainText" + } + } + ] + }, + { + "name": "programing.region", + "statement": "programing.region", + "title": "折叠开始", + "description": "折叠一组指令,使之更易于阅读,折叠从此处开始", + "comment": "说明:%content%", + "icon": "BlockIcons/8-6.png", + "indent": "1", + "scope": "0", + "isPseudo": true, + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/折叠.html", + "inputs": [ + { + "name": "content", + "label": "折叠区域名称", + "required": true, + "tips": null, + "type": "str", + "editor": { + "kind": "PlainText" + } + } + ] + }, + { + "name": "programing.endregion", + "statement": "programing.endregion", + "title": "折叠结束", + "description": "结束一段指令折叠", + "icon": "BlockIcons/8-7.png", + "indent": "2", + "scope": "0", + "isPseudo": true + }, + { + "name": "programing.try", + "statement": "programing.try", + "canDebug": false, + "icon": "BlockIcons/8-8.png", + "indent": "1", + "scope": "1", + "comment": "尝试执行", + "keywords": "异常", + "description": "尝试执行开始标记", + "title": "Try", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/异常处理/try.html" + }, + { + "name": "programing.catch", + "statement": "programing.catch", + "icon": "BlockIcons/8-9.png", + "indent": "3", + "scope": "3", + "canDebug": false, + "description": "尝试失败时执行", + "comment": "尝试失败时执行, 将错误信息保存到%exception%", + "title": "Catch", + "keywords": "异常", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/异常处理/catch.html", + "outputs": [ + { + "id": "exception", + "label": "错误信息", + "variableLabel": "错误信息", + "type": "str", + "tips": "输入一个名称作为保存错误信息的变量,当指令执行出错的时候错误信息将会保存至此变量中", + "name": "exception" + } + ] + }, + { + "name": "programing.finally", + "statement": "programing.finally", + "icon": "BlockIcons/8-10.png", + "indent": "3", + "scope": "3", + "canDebug": false, + "description": "无论尝试是否成功始终执行", + "comment": "无论尝试是否成功始终执行以下操作", + "title": "Finally", + "keywords": "异常", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/异常处理/finally.html" + }, + { + "name": "programing.endtry", + "statement": "programing.endtry", + "icon": "BlockIcons/8-11.png", + "indent": "2", + "scope": "2", + "isPseudo": true, + "description": "尝试执行结束标记", + "comment": "结束尝试执行", + "title": "End Try", + "keywords": "异常", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/异常处理/endtry.html" + }, + { + "name": "programing.raise", + "statement": "programing.raise", + "icon": "BlockIcons/8-13.png", + "description": "抛出异常", + "comment": "抛出异常:%reason%", + "title": "Raise", + "keywords": "异常", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/异常处理/raise.html", + "inputs": [ + { + "name": "reason", + "label": "异常原因", + "required": true, + "tips": "异常产生的原因", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "programing.onDelayRunSwitch", + "title": "开始批量等待", + "description": "一次为多个鼠标操作指令添加等待时间", + "comment": "从此处开始,每条鼠标操作指令运行后等待%seconds%秒", + "icon": "BlockIcons/8-14.png", + "indent": "1", + "scope": "1", + "function": "xbot_visual.programing.on_delay_run_switch", + "helpUrl": "doc/指令文档/03等待/开始批量等待.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Programing.OnDelayRunSwitchControl", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Programing.OnDelayRunSwitchHandler" + } + ], + "inputs": [ + { + "name": "random_number", + "label": " ", + "required": true, + "default": "13:True", + "tips": "每条指令结束后,根据最小、最大等待时长生成随机等待时长", + "type": "bool", + "editor": { + "label": "等待时长随机", + "kind": "checkbox" + } + }, + { + "name": "seconds", + "label": "时长(秒)", + "required": false, + "tips": "每条指令结束后,等待的固定时长", + "type": "float", + "default": "10:1", + "editor": { + "kind": "textbox" + } + }, + { + "name": "min_number", + "label": "最小时长(秒)", + "required": false, + "tips": "指定最小等待时间", + "type": "int", + "default": "10:1", + "editor": { + "kind": "textbox" + } + }, + { + "name": "max_number", + "label": "最大时长(秒)", + "required": false, + "tips": "指定最大等待时间", + "type": "int", + "default": "10:3", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "programing.offDelayRunSwitch", + "function": "xbot_visual.programing.off_delay_run_switch", + "icon": "BlockIcons/8-15.png", + "indent": "2", + "scope": "2", + "description": "结束批量等待", + "comment": "结束批量等待", + "title": "结束批量等待", + "helpUrl": "doc/指令文档/03等待/结束批量等待.html" + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/programing.databook.blocks.json b/src/assert/block_settings/programing.databook.blocks.json new file mode 100644 index 0000000..7feb6f9 --- /dev/null +++ b/src/assert/block_settings/programing.databook.blocks.json @@ -0,0 +1,1001 @@ +{ + "types": [], + "blocks": [ + { + "name": "programing.databook.foreach", + "statement": "workflow.for", + "title": "循环数据表格", + "description": "循环读取数据表格内容", + "comment": "循环数据表格,从第%start%行到第%stop%行,步长为%step%,将循环的行号保存到%loop_index%", + "icon": "", + "indent": "1", + "scope": "1", + "function": "xbot_visual.programing.databook.foreach", + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/循环数据表格内容.html", + "video": { + "time": "06:30" + }, + "inputs": [ + { + "name": "start", + "label": "起始行号", + "required": true, + "tips": "起始行号,从1开始,支持负数,-n表示倒数第n行", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "起始行号,从1开始,支持负数,-n表示倒数第n行" + } + }, + { + "name": "stop", + "label": "结束行号", + "required": true, + "tips": "结束行号,从1开始,支持负数,-n表示倒数第n行", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "结束行号,从1开始,支持负数,-n表示倒数第n行" + } + }, + { + "name": "step", + "label": "递增步长", + "required": true, + "default": "10:1", + "tips": null, + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "loop_index", + "label": "循环索引位置", + "type": "int", + "name": "row_index" + } + ] + }, + { + "name": "programing.databook.active", + "title": "激活Sheet页", + "comment": "%mode%激活%workbook%中的Sheet页%value%", + "description": "根据Sheet页的名称或位置激活指定的Sheet页", + "icon": "BlockIcons/5-7.png", + "function": "xbot_visual.programing.databook.active", + "helpUrl": "", + "inputs": [ + { + "name": "mode", + "label": "激活方式", + "required": true, + "default": "10:name", + "defaultDisplay": "根据Sheet页的名称", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据Sheet页的名称", + "value": "name" + }, + { + "display": "根据Sheet页的位置", + "value": "index" + } + ] + } + }, + { + "name": "value", + "label": "Sheet页的名称/位置", + "required": true, + "tips": "填写要打开激活的Sheet页的名称或位置(从1开始)", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "programing.databook.create_sheet", + "title": "添加Sheet页", + "comment": "添加一个Sheet页,%create_way%,命名为%sheet_name%", + "description": "在数据表格面板中添加一个新的sheet页,可以指定在头部添加或尾部添加", + "icon": "BlockIcons/5-9.png", + "function": "xbot_visual.programing.databook.create_sheet", + "helpUrl": "", + "inputs": [ + { + "name": "sheet_name", + "label": "Sheet页名称", + "required": true, + "tips": "请输入sheet页的名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "create_way", + "label": "添加方式", + "required": true, + "default": "10:first", + "defaultDisplay": "作为第一个sheet页", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "作为第一个sheet页", + "value": "first" + }, + { + "display": "作为最后一个sheet页", + "value": "last" + } + ] + } + } + ] + }, + { + "name": "programing.databook.remove_row", + "title": "删除数据表格行", + "keywords": "删除行", + "comment": "删除数据表格中的第%index%行", + "description": "删除行", + "icon": "BlockIcons/5-2.png", + "function": "xbot_visual.programing.databook.remove_row", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/删除行.html", + "video": { + "time": "06:22" + }, + "inputs": [ + { + "name": "index", + "label": "行号", + "required": true, + "tips": "输入行号,多行用1,2,3或1:3,-n表示倒数第n行", + "type": "str", + "editor": { + "placeholder": "输入行号,多行用1,2,3或1:3,-n表示倒数第n行", + "kind": "textbox" + } + } + ] + }, + { + "name": "programing.databook.remove_column", + "title": "删除数据表格列", + "keywords": "删除列", + "comment": "删除数据表格中的第%column_name%列", + "description": "删除列", + "icon": "BlockIcons/5-13.png", + "function": "xbot_visual.programing.databook.remove_column", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/删除列.html", + "video": { + "time": "06:22" + }, + "inputs": [ + { + "name": "column_name", + "label": "列号", + "required": true, + "tips": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列", + "type": "str", + "editor": { + "placeholder": "输入列名(支持A或1),多列用A,B,C或A:C,-n表示倒数第n列", + "kind": "textbox" + } + } + ] + }, + { + "name": "programing.databook.remove_all_rows", + "title": "清空数据表格", + "comment": "删除数据表格中的所有数据", + "description": "清空数据表格", + "icon": "BlockIcons/5-8.png", + "function": "xbot_visual.programing.databook.remove_all_rows", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/清空数据表格.html", + "video": { + "time": "00:32" + } + }, + { + "name": "programing.databook.get_row_count", + "title": "读取数据表格总行数", + "comment": "读取数据表格总行数,将结果保存到%row_count%", + "description": "读取数据表格总行数", + "icon": "BlockIcons/5-5.png", + "function": "xbot_visual.programing.databook.get_row_count", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/读取数据表格总行数.html", + "video": { + "time": "01:43" + }, + "outputs": [ + { + "id": "row_count", + "label": "保存总行数至", + "variableLabel": "数据表格总行数", + "tips": "指定一个变量名称,该变量用于保存总行数", + "type": "int", + "name": "databook_row_count" + } + ] + }, + { + "name": "programing.databook.write_data_to_workbook", + "title": "写入内容至数据表格", + "icon": "BlockIcons/5-1.png", + "comment": "写入内容到数据表格", + "keywords": "写入内容", + "description": "在数据表格写入内容,支持追加、插入或覆盖", + "function": "xbot_visual.programing.databook.write_data_to_workbook", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/写入内容至数据表格.html", + "video": { + "time": "08:04" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Programing.Databook.WriteDataToWorkBookControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Programing.WriteDataToWorkBookHandler" + } + ], + "inputs": [ + { + "name": "write_range", + "label": "写入范围", + "required": true, + "default": "10:area", + "defaultDisplay": "区域", + "tips": "将数据写入到区域(包含单元格)、一行或一列", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "区域", + "value": "area" + }, + { + "display": "行", + "value": "row" + }, + { + "display": "列", + "value": "column" + } + ] + } + }, + { + "name": "write_way", + "label": "写入方式", + "default": "10:append", + "defaultDisplay": "追加一行", + "tips": "提示", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "追加一行", + "value": "append" + }, + { + "display": "插入一行", + "value": "insert" + }, + { + "display": "覆盖一行", + "value": "override" + } + ] + } + }, + { + "name": "write_column_way", + "label": "写入方式", + "default": "10:override", + "defaultDisplay": "覆盖一列", + "tips": "提示", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "追加一列", + "value": "append" + }, + { + "display": "插入一列", + "value": "insert" + }, + { + "display": "覆盖一列", + "value": "override" + } + ] + } + }, + { + "name": "row_num", + "label": "行号", + "default": "10:1", + "tips": "行号", + "type": "int", + "editor": { + "placeholder": "从1开始,支持负数,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "column_name", + "label": "列号", + "tips": "列", + "type": "str", + "editor": { + "placeholder": "A或1代表A列, 支持负数,-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "begin_row_num", + "label": "起始行号", + "default": "10:1", + "category": "advanced", + "tips": "起始行号", + "type": "int", + "editor": { + "placeholder": "输入行号,从1开始,支持负数,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "begin_column_name", + "label": "起始列号", + "category": "advanced", + "default": "10:", + "tips": "起始列号", + "type": "str", + "editor": { + "placeholder": "输入列号,A或1代表A列,支持负数,-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "content", + "label": "写入内容", + "required": true, + "tips": "写入内容", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "programing.databook.read_data_from_workbook", + "title": "读取数据表格内容", + "icon": "BlockIcons/5-6.png", + "comment": "从数据表格中读取单元格(第%cell_row_num%行,第%cell_column_name%列)中的内容,将数据保存到%datatable%", + "description": "从数据表格中读取内容,支持矩形区域范围读取", + "function": "xbot_visual.programing.databook.read_data_from_workbook", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/读取数据表格内容.html", + "video": { + "time": "04:41" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Programing.Databook.ReadDataFromWorkBookControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Programing.ReadDataFromWorkBookHandler" + } + ], + "inputs": [ + { + "name": "read_way", + "label": "读取方式", + "required": true, + "default": "10:cell", + "defaultDisplay": "单元格", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单元格", + "value": "cell" + }, + { + "display": "区域内容", + "value": "range" + }, + { + "display": "行内容", + "value": "row" + }, + { + "display": "列内容", + "value": "column" + } + ] + } + }, + { + "name": "cell_row_num", + "label": "行号", + "required": false, + "default": "10:1", + "tips": "行号", + "type": "int", + "editor": { + "placeholder": "从1开始,支持负数,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "cell_column_name", + "label": "列号", + "required": false, + "default": "10:", + "tips": "列号", + "type": "str", + "editor": { + "placeholder": "A或1代表A列, 支持负数,-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "area_begin_row_num", + "label": "行号", + "required": false, + "default": "10:1", + "tips": "行号", + "type": "int", + "editor": { + "placeholder": "从1开始,支持负数,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "area_begin_column_name", + "label": "列号", + "default": "10:", + "required": false, + "tips": "列号", + "type": "str", + "editor": { + "placeholder": "A或1代表A列,支持负数,-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "area_end_row_num", + "label": "行号", + "required": false, + "default": "10:1", + "tips": "行号", + "type": "int", + "editor": { + "placeholder": "从1开始,支持负数,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "area_end_column_name", + "label": "列号", + "required": false, + "default": "10:", + "tips": "列号", + "type": "str", + "editor": { + "placeholder": "A或1代表A列,支持负数,-n表示倒数第n列", + "kind": "textbox" + } + }, + { + "name": "row_row_num", + "label": "行号", + "required": false, + "default": "10:1", + "tips": "行号", + "type": "int", + "editor": { + "placeholder": "从1开始,支持负数,-n表示倒数第n行", + "kind": "textbox" + } + }, + { + "name": "get_display_text", + "label": "", + "required": false, + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "获取单元格的值作为纯文本", + "kind": "checkbox" + } + }, + { + "name": "has_header_row", + "label": "", + "required": false, + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "区域第一行包含列名", + "kind": "checkbox" + } + }, + { + "name": "column_column_name", + "label": "列号", + "tips": "列号", + "type": "str", + "default": "10:", + "editor": { + "placeholder": "A或1代表A列,从1开始,支持负数,-n表示倒数第n列", + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "datatable", + "label": "保存区域内容至", + "variableLabel": "数据表格内容", + "tips": "指定一个变量名称,该变量用于保存区域数据内容", + "type": "any", + "name": "datatable" + } + ] + }, + { + "name": "programing.databook.loop_data_from_workbook", + "statement": "excel.forin", + "indent": "1", + "scope": "1", + "isLoop": true, + "title": "循环数据表格内容", + "icon": "BlockIcons/5-10.png", + "comment": "循环数据表格的内容,将每次循环的项保存到%loop_item%", + "description": "循环数据表格的内容,并保存循环项", + "function": "xbot_visual.programing.databook.loop_data_from_workbook_with_return_item_location", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/循环数据表格内容.html", + "video": { + "time": "06:30" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Programing.Databook.ExcelLoopControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Programing.DataTableLoopHandler" + } + ], + "inputs": [ + { + "name": "loop_way", + "label": "循环方式", + "required": true, + "default": "10:used_range", + "defaultDisplay": "循环已使用区域", + "tips": "循环数据表格的方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "循环区域", + "value": "loop_range" + }, + { + "display": "循环行", + "value": "loop_row" + }, + { + "display": "循环列", + "value": "loop_column" + }, + { + "display": "循环已使用区域", + "value": "used_range" + } + ] + } + }, + { + "name": "begin_row_num", + "label": "起始行号", + "default": "10:1", + "tips": "循环开始行号", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "从1开始,支持负数,-n表示倒数第n行" + } + }, + { + "name": "end_row_num", + "label": "结束行号", + "default": "10:-1", + "tips": "循环结束行号", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "从1开始,支持负数,-n表示倒数第n行" + } + }, + { + "name": "begin_column_name", + "label": "起始列号", + "required": false, + "default": "10:", + "tips": "循环开始列号", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "A或1代表A列, 支持负数,-n表示倒数第n列" + } + }, + { + "name": "end_column_name", + "label": "结束列号", + "required": false, + "default": "10:", + "tips": "循环结束列号", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "A或1代表A列,支持负数,-n表示倒数第n列" + } + }, + { + "name": "has_header_row", + "label": "", + "required": false, + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "区域第一行包含列名", + "kind": "checkbox" + } + }, + { + "name": "range_begin_row_num", + "label": "行号", + "default": "10:1", + "tips": "循环开始行号", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "从1开始,支持负数,-n表示倒数第n行" + } + }, + { + "name": "range_begin_column_name", + "label": "列号", + "default": "10:", + "required": false, + "tips": "循环起始列号", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "A或1代表A列,支持负数,-n表示倒数第n列" + } + }, + { + "name": "range_end_row_num", + "label": "行号", + "default": "10:-1", + "tips": "循环结束行号", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "从1开始,支持负数,-n表示倒数第n行" + } + }, + { + "name": "range_end_column_name", + "label": "列号", + "default": "10:", + "required": false, + "tips": "循环结束列号", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "A或1代表A列,支持负数,-n表示倒数第n列" + } + }, + { + "name": "get_display_text", + "label": "", + "required": false, + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "获取单元格的值作为纯文本", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "loop_item", + "label": "当前循环项保存至", + "variableLabel": "当前循环项数据对象", + "tips": "指定一个变量名称,该变量用于保存数据表格的当前循环项", + "type": "list", + "name": "loop_datatable" + }, + { + "id": "loop_item_rownum", + "label": "当前行号保存至", + "variableLabel": "当前循环项的行号", + "tips": "指定一个变量名称,该变量用于保存数据表格当前循环项的行号", + "type": "int", + "name": "loop_item_rownum" + }, + { + "id": "loop_item_columnname", + "label": "当前列名保存至", + "variableLabel": "当前循环项的列名", + "tips": "指定一个变量名称,该变量用于保存数据表格当前循环项的列名", + "type": "str", + "name": "loop_item_columnname" + } + ] + }, + { + "name": "programing.databook.export_data", + "title": "数据表格导出", + "keywords": "保存数据表格;保存表格", + "comment": "导出数据表格到%folder_source%\\%file_name%,将文件路径保存到%file_path%", + "description": "将数据表格导出为文件", + "icon": "BlockIcons/5-12.png", + "function": "xbot_visual.programing.databook.export_data", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/数据表格导出.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Programing.Databook.ExportDataControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Programing.DataTableExportHandler" + } + ], + "inputs": [ + { + "name": "folder_source", + "label": "文件夹", + "required": true, + "default": "10:desktop", + "defaultDisplay": "桌面", + "tips": "选择保存路径", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "桌面", + "value": "desktop" + }, + { + "display": "下载目录", + "value": "download" + }, + { + "display": "临时目录", + "value": "tmp" + }, + { + "display": "自定义目录", + "value": "custom" + } + ] + } + }, + { + "name": "custom_folder_path", + "label": "文件夹路径", + "tips": "指定文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "file_name", + "label": "文件名称", + "required": true, + "default": "10:影刀数据表格.xlsx", + "tips": "指定文件名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "export_header", + "label": "", + "required": true, + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "导出列头信息", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "file_path", + "label": "文件路径", + "variableLabel": "导出的文件路径", + "tips": "指定一个变量名称, 该变量用于保存导出文件的位置", + "type": "str", + "name": "file_path" + } + ] + }, + { + "name": "programing.databook.import_data", + "title": "数据表格导入", + "comment": "导入文件%file_path%的Sheet页%sheet_name%到数据表格", + "description": "导入数据到数据表格", + "icon": "BlockIcons/5-11.png", + "function": "xbot_visual.programing.databook.import_data", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/数据表格导入.html", + "inputs": [ + { + "name": "file_path", + "label": "文件路径", + "required": true, + "tips": "填写要导入的文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "Excel 工作簿|*.xlsx;*.xls;*.xlsm;*.csv" + } + } + }, + { + "name": "sheet_name", + "label": "Sheet页名称", + "required": true, + "default": "10:Sheet1", + "tips": "指定要导入的sheet页名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "import_header", + "label": "", + "required": true, + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "使用第一行数据作为列头", + "kind": "checkbox" + } + } + ] + }, + { + "name": "programing.databook.get_column_info", + "title": "获取列信息", + "comment": "从数据表格中%access_kind%,将结果保存到%databook_column_info%", + "description": "获取列名称、列描述", + "icon": "BlockIcons/5-5.png", + "function": "xbot_visual.programing.databook.get_column_info", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Programing.Databook.GetColumnInfoControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Programing.GetColumnInfoHandler" + } + ], + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/获取列信息.html", + "inputs": [ + { + "name": "access_kind", + "label": "获取方式", + "required": true, + "default": "10:get_column_desc_by_name", + "defaultDisplay": "根据列名称获取列描述", + "tips": "获取方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据列名称获取列描述", + "value": "get_column_desc_by_name" + }, + { + "display": "根据列描述获取列名称", + "value": "get_column_name_by_desc" + } + ] + } + }, + { + "name": "column_name", + "label": "列名称", + "tips": "支持负数,-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "A或1代表A列,支持负数,-n表示倒数第n列" + } + }, + { + "name": "column_desc", + "label": "列描述", + "tips": "列描述", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "databook_column_info", + "label": "保存列信息至", + "variableLabel": "数据表格列信息", + "tips": "指定一个变量名称,该变量用于保存数据表格列信息", + "type": "str", + "name": "databook_column_info" + } + ] + }, + { + "name": "programing.databook.set_column_info", + "title": "设置列信息", + "comment": "将内容%column_desc%设置到数据表格列%column_name%", + "description": "为数据表格列设置描述信息", + "icon": "BlockIcons/5-14.png", + "function": "xbot_visual.programing.databook.set_column_info", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据表格/设置列信息.html", + "inputs": [ + { + "name": "column_name", + "label": "列名称", + "tips": "支持负数,-n表示倒数第n列", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "A或1代表A列,支持负数,-n表示倒数第n列" + } + }, + { + "name": "column_desc", + "label": "列描述", + "tips": "列描述", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/rdp.blocks.json b/src/assert/block_settings/rdp.blocks.json new file mode 100644 index 0000000..9fd7d77 --- /dev/null +++ b/src/assert/block_settings/rdp.blocks.json @@ -0,0 +1,78 @@ +{ + "types": [], + "blocks": [ + { + "name": "win32.lock_screen", + "function": "xbot_visual.win32.lock_screen", + "title": "屏幕锁屏", + "description": "这个指令用于屏幕锁屏", + "comment": "屏幕锁屏", + "icon": "BlockIcons/31-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/锁屏、解锁/屏幕解锁.html" + }, + { + "name": "win32.rdp_lock_screen", + "function": "xbot_visual.win32.rdp_lock_screen", + "title": "屏幕锁屏", + "description": "锁住系统屏幕,确保后续指令能在锁屏状态下正常运行", + "comment": "使用%user_name%账户锁屏", + "icon": "BlockIcons/31-1.png", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Rdp.RDPLockScreenControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/锁屏、解锁/屏幕锁屏.html", + "inputs": [ + { + "name": "user_name", + "label": "用户名", + "required": true, + "tips": "请输入用户名", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "password", + "label": "登录密码", + "required": false, + "tips": "输入登录密码", + "type": "str", + "editor": { + "kind": "password" + } + } + ] + }, + { + "name": "win32.unlock_screen", + "function": "xbot_visual.win32.unlock_screen", + "title": "屏幕解锁", + "description": "解锁系统屏幕,进入系统屏幕", + "comment": "使用%user_name%账户解锁", + "icon": "BlockIcons/31-2.png", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Rdp.UnlockScreenControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/锁屏、解锁/屏幕解锁.html", + "inputs": [ + { + "name": "user_name", + "label": "用户名", + "required": true, + "tips": "请输入用户名", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "password", + "label": "登录密码", + "required": false, + "tips": "输入登录密码", + "type": "str", + "editor": { + "kind": "password" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/resourcesfile.blocks.json b/src/assert/block_settings/resourcesfile.blocks.json new file mode 100644 index 0000000..9202bf5 --- /dev/null +++ b/src/assert/block_settings/resourcesfile.blocks.json @@ -0,0 +1,210 @@ +{ + "types": [], + "blocks": [ + { + "name": "resourcesfile.read", + "function": "xbot_visual.resourcesfile.read", + "title": "读取资源文件内容", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.ResourcesFile.ReadFileControl, ShadowBot.Shell.Development", + "description": "读取资源文件内容", + "icon": "BlockIcons/18-3.png", + "comment": "获取资源文件%file_name%的%read_way%", + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/资源文件/读取资源文件内容.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.ResourcesFile.ReadFileHandler" + } + ], + "inputs": [ + { + "name": "file_name", + "label": "资源文件名", + "required": true, + "tips": "请选择资源文件", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "read_way", + "label": "读取内容", + "required": true, + "default": "10:text", + "defaultDisplay": "文本内容", + "tips": "选择文件的读取方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "文本内容", + "value": "text" + }, + { + "display": "二进制内容", + "value": "binary" + } + ] + } + }, + { + "name": "encoding", + "label": "文件编码", + "default": "10:UTF-8", + "defaultDisplay": "UTF-8", + "tips": "选择文本编码", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "默认", + "value": "default" + }, + { + "display": "ANSI", + "value": "ANSI" + }, + { + "display": "GB2312", + "value": "GB2312" + }, + { + "display": "GBK", + "value": "GBK" + }, + { + "display": "UTF-8", + "value": "UTF-8" + } + ] + } + } + ], + "outputs": [ + { + "id": "file_content", + "label": "保存文件内容至", + "variableLabel": "资源文件内容", + "tips": "输入一个名字,用来保存文件内容", + "type": "any", + "name": "file_content" + } + ] + }, + { + "name": "resourcesfile.copy_to", + "title": "拷贝资源文件", + "keywords": "复制资源文件", + "comment": "将资源文件%file_name%的内容拷贝到%dest_file_name%中", + "description": "将资源文件的内容拷贝到指定文件中", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.ResourcesFile.CopyToControl, ShadowBot.Shell.Development", + "icon": "BlockIcons/18-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/资源文件/拷贝资源文件.html", + "function": "xbot_visual.resourcesfile.copy_to", + "inputs": [ + { + "name": "file_name", + "label": "资源文件名", + "required": true, + "tips": "请选择资源文件", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "dest_file_name", + "label": "资源文件拷贝至", + "required": true, + "tips": "需要将资源文件拷贝到的文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "filter": "所有文件 (.*)|*.*" + } + } + }, + { + "name": "copy_way", + "label": "存在同名文件时", + "required": true, + "default": "10:overwrite", + "defaultDisplay": "覆盖", + "tips": "指定当目标文件夹下已存在同名文件时要执行的操作", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "覆盖", + "value": "overwrite" + }, + { + "display": "不要拷贝", + "value": "not_copy" + } + ] + } + } + ] + }, + { + "name": "resourcesfile.get_resourcesfile_path", + "function": "xbot_visual.resourcesfile.get_resourcesfile_path", + "title": "获取资源文件路径", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.ResourcesFile.GetResourcesFilePath, ShadowBot.Shell.Development", + "description": "这个指令用来获取指定资源文件路径, 可用于资源文件的快速获取", + "comment": "获取资源文件%file_name%的路径,将文件路径保存到%file_path%", + "icon": "BlockIcons/18-7.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/资源文件/获取资源文件路径.html", + "inputs": [ + { + "name": "file_name", + "label": "资源文件名", + "required": true, + "tips": "输入资源文件名", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "file_path", + "label": "保存文件路径至", + "variableLabel": "资源文件路径", + "tips": "输入一个名字,用来保存文件路径", + "type": "str", + "name": "file_path" + } + ] + }, + { + "name": "resourcesfile.copy_to_clipboard", + "function": "xbot_visual.resourcesfile.copy_to_clipboard", + "title": "将资源文件添加到剪切板", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.ResourcesFile.CopyToClipboardControl, ShadowBot.Shell.Development", + "description": "用来将资源文件添加到剪切板中,可用于资源文件的快捷发送", + "comment": "将资源文件%file_name%添加到剪切板中", + "icon": "BlockIcons/18-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/流程、应用/资源文件/将资源文件添加到剪切板.html", + "inputs": [ + { + "name": "file_name", + "label": "资源文件名", + "required": true, + "tips": "输入资源文件名", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/sap.element.blocks.json b/src/assert/block_settings/sap.element.blocks.json new file mode 100644 index 0000000..949bc00 --- /dev/null +++ b/src/assert/block_settings/sap.element.blocks.json @@ -0,0 +1,294 @@ +{ + "types": [], + "blocks": [ + { + "name": "win32.element.expand_tree_and_select_node", + "title": "选中树节点(sap)", + "keywords": "选中目标节点", + "description": "扩展树以显示目标节点,然后选中目标节点", + "comment": "在窗口%window%内,选中树%element%的节点%text_path%", + "icon": "BlockIcons/3-3.png", + "function": "xbot_visual.win32.element.expand_tree_and_select_node", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/sap/选中树节点(sap).html", + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择一棵节点树", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "text_path", + "label": "节点路径", + "tips": "填写目标节点的位置路径,如 SAP 菜单/会计核算/控制", + "type": "str", + "editor": { + "placeholder": "目标节点的位置,如 SAP 菜单/会计核算/控制", + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标树出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "tree_item_element", + "label": "保存选中节点元素至", + "variableLabel": "元素对象", + "tips": "指定一个变量名称, 该变量用于保存选中的sap树节点内的指定元素", + "name": "win_element", + "type": "xbot.win32.element.Win32Element" + } + ] + }, + { + "name": "win32.element.get_table_row_count", + "title": "获取表格总行数(sap)", + "description": "获取数据表格总行数", + "comment": "获取数据表格%element%的总行数,将结果保存到%row_count%", + "icon": "BlockIcons/3-3.png", + "function": "xbot_visual.win32.element.get_table_row_count", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/sap/获取表格总行数(sap).html", + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择数据表格 或者 单元格", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标表格出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "row_count", + "label": "保存总行数至", + "variableLabel": "总行数", + "tips": "指定一个变量名称, 该变量用于保存获取到的总行数", + "name": "row_count", + "type": "int" + } + ] + }, + { + "name": "win32.element.get_table_column_count", + "title": "获取表格总列数(sap)", + "description": "获取数据表格总列数", + "comment": "获取数据表格%element%的总列数,将结果保存到%column_count%", + "icon": "BlockIcons/3-3.png", + "function": "xbot_visual.win32.element.get_table_column_count", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/sap/获取表格总列数(sap).html", + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择数据表格 或者 单元格", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标表格出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "column_count", + "label": "保存总列数至", + "variableLabel": "总列数", + "tips": "指定一个变量名称, 该变量用于保存获取到的总列数", + "name": "column_count", + "type": "int" + } + ] + }, + { + "name": "win32.element.get_table_cell_by_rownum_and_columnnum", + "title": "获取单元格(sap)", + "description": "获取表格指定位置的单元格", + "comment": "获取数据表格%element%位于(第%row_num%行,第%column_num%列)处的单元格对象,将对象保存到%table_cell_element%", + "icon": "BlockIcons/3-3.png", + "function": "xbot_visual.win32.element.get_table_cell_by_rownum_and_columnnum", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/sap/获取单元格(sap).html", + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择数据表格 或者 单元格", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "row_num", + "label": "行号", + "required": true, + "tips": "单元格所在行的行号, 从1开始", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "单元格所在行的行号, 从1开始" + } + }, + { + "name": "column_num", + "label": "列号", + "required": true, + "tips": "单元格所在的列的列号, 从1开始", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "单元格所在列的列号, 从1开始" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标表格出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "table_cell_element", + "label": "保存单元格元素至", + "variableLabel": "单元格元素", + "tips": "指定一个变量名称,该变量用于保存获取到的单元格元素", + "name": "table_cell_element", + "type": "xbot.win32.element.Win32Element" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/system.blocks.json b/src/assert/block_settings/system.blocks.json new file mode 100644 index 0000000..1257e0a --- /dev/null +++ b/src/assert/block_settings/system.blocks.json @@ -0,0 +1,746 @@ +{ + "types": [ + { + "name": "xbot_visual.system.LaunchResult", + "localName": "应用启动信息", + "props": [ + { + "name": "pid", + "type": "int", + "label": "进程唯一标识码" + }, + { + "name": "main_window_handle", + "type": "int", + "label": "主窗口句柄" + }, + { + "name": "exit_code", + "type": "int", + "label": "退出码" + } + ] + } + ], + "blocks": [ + { + "name": "system.run_application", + "function": "xbot_visual.system.run_application", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.SystemOperation.RunApplicationControl, ShadowBot.Shell.Development", + "title": "启动程序", + "description": "这个指令用于执行一个程序或者打开一个文件", + "comment": "运行应用或者打开文件,路径为%application_path%", + "icon": "BlockIcons/10-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/启动程序.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.SystemOperation.RunApplicationHandler" + } + ], + "inputs": [ + { + "name": "application_path", + "label": "应用路径", + "required": true, + "tips": "打开一个程序或者文件", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile" + } + } + }, + { + "name": "command_line_arguments", + "label": "命令行参数", + "required": false, + "tips": "程序执行的额外参数", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "working_folder", + "label": "工作目录", + "required": false, + "tips": "进程中命令的工作目录", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "after_application_launch", + "label": "在应用启动之后", + "required": true, + "default": "10:continue", + "defaultDisplay": "继续执行下一条指令", + "tips": "选择是否继续执行指令,或者等待程序执行结束、文件关闭", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "继续执行下一条指令", + "value": "continue" + }, + { + "display": "等待应用执行完成", + "value": "wait_to_complete" + } + ] + } + }, + { + "name": "is_wait_not_more_than", + "label": "", + "required": false, + "default": "13:False", + "tips": "如果不勾选,表示无限等待", + "type": "bool", + "editor": { + "label": "等待时间不超过", + "kind": "checkbox" + } + }, + { + "name": "wait_time", + "label": "等待时间", + "required": false, + "default": "10:10", + "tips": "等待程序执行结束或者文件关闭的最长时间", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "process_id", + "label": "保存进程id至", + "variableLabel": "进程Id", + "tips": "输入一个名称作为保存进程ID,其类型是整数", + "type": "int", + "name": "process_id" + }, + { + "id": "exit_code", + "label": "保存退出码至", + "variableLabel": "退出码", + "tips": "输入一个名称作为保存应用退出码, 其类型是整数,-1表示非正常退出", + "type": "int", + "name": "exit_code" + } + ] + }, + { + "name": "system.run_dos_command", + "function": "xbot_visual.system.run_dos_command", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.SystemOperation.RunDosCommandControl, ShadowBot.Shell.Development", + "title": "运行DOS命令", + "description": "这个指令用于执行DOS命令并返回结果", + "comment": "运行DOS命令%dos_command%,将执行结果保存到%output_info%,将错误信息保存到%err_info%,将退出代码保存到%exit_code%", + "icon": "BlockIcons/10-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/运行dos命令.html", + "inputs": [ + { + "name": "dos_command", + "label": "DOS命令", + "required": false, + "tips": "输入DOS命令字符串", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile" + } + } + }, + { + "name": "working_folder", + "label": "工作目录", + "required": false, + "tips": "进程中命令的工作目录", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "encoding", + "label": "编码格式", + "required": false, + "tips": "设置命令行的文本格式", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "output_info", + "label": "保存执行结果至", + "variableLabel": "DOS执行结果", + "tips": "输入一个名称作为保存DOS命令执行结果", + "type": "str", + "name": "output_info" + }, + { + "id": "err_info", + "label": "保存错误信息至", + "variableLabel": "DOS错误信息", + "tips": "输入一个名称作为保存错误信息", + "type": "str", + "name": "err_info" + }, + { + "id": "exit_code", + "label": "保存退出代码至", + "variableLabel": "DOS退出代码", + "tips": "输入一个名称作为保存退出代码,其类型是整数", + "type": "int", + "name": "exit_code" + } + ] + }, + { + "name": "system.terminal_process", + "function": "xbot_visual.system.terminal_process", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.SystemOperation.TerminalProcessControl, ShadowBot.Shell.Development", + "title": "终止程序", + "description": "这个指令用于终止一个程序", + "comment": "终止程序", + "icon": "BlockIcons/10-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/终止程序.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.SystemOperation.TerminalProcessHandler" + } + ], + "inputs": [ + { + "name": "terminal_way", + "label": "终止方式", + "required": true, + "default": "10:id", + "defaultDisplay": "进程Id", + "tips": "指定通过进程Id或者进程名称来终止进程", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "进程Id", + "value": "id" + }, + { + "display": "进程名称", + "value": "name" + } + ] + } + }, + { + "name": "process_id", + "label": "进程Id", + "required": false, + "tips": "输入你想要终止的进程的Id号", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "process_name", + "label": "进程名称", + "required": false, + "tips": "输入你想要终止的进程的名称,如xxx.exe,如果有多个同名的进程将会全部被关闭", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "system.take_screenshot", + "icon": "BlockIcons/10-4.png", + "description": "对屏幕或者窗口截图,保存到剪切板或者文件", + "comment": "从%image_source%截屏,将图像保存到%save_to%", + "title": "截屏", + "keywords": "截图", + "function": "xbot_visual.system.take_screenshot", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/截屏.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.SystemOperation.TakeScreenshotHandler" + } + ], + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.SystemOperation.TakeScreenshotControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "image_source", + "label": "截屏来源", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕", + "tips": "选择一个截屏来源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕", + "value": "screen" + }, + { + "display": "窗口对象", + "value": "window" + }, + { + "display": "当前激活窗口", + "value": "foreground_window" + }, + { + "display": "动态选择", + "value": "dynamic_select" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "required": false, + "tips": "请选择窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "image_region", + "label": "提取区域", + "default": "10:all_region", + "defaultDisplay": "提取区域", + "tips": "选择图片提取区域", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "all_region" + }, + { + "display": "指定部分区域", + "value": "sub_region" + } + ] + } + }, + { + "name": "region_x1", + "label": "X1", + "tips": "图片左上角X值", + "type": "int", + "default": "10:0", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y1", + "label": "Y1", + "tips": "图片左上角Y值", + "type": "int", + "default": "10:0", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_x2", + "label": "X2", + "tips": "图片右下角X值", + "type": "int", + "default": "10:0", + "editor": { + "kind": "textbox" + } + }, + { + "name": "region_y2", + "label": "Y2", + "tips": "图片右下角Y值", + "type": "int", + "default": "10:0", + "editor": { + "kind": "textbox" + } + }, + { + "name": "save_to", + "label": "保存截屏至", + "required": true, + "default": "10:clipboard", + "defaultDisplay": "剪切板", + "tips": "选择一个保存当前截屏的方法", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "剪切板", + "value": "clipboard" + }, + { + "display": "文件", + "value": "file" + } + ] + } + }, + { + "name": "image_path", + "label": "图片路径", + "required": false, + "tips": "请选择图片保存路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "filter": "图片(*.jpg;*.bmp;*.png)|*.jpg;*.bmp;*.png" + } + } + } + ], + "outputs": [ + { + "id": "is_user_cancel", + "label": "用户是否取消截图", + "variableLabel": "截图操作是否取消", + "tips": "输入一个名称作为保存用户是否取消了截图", + "type": "bool", + "name": "is_user_cancel" + } + ] + }, + { + "name": "win32.set_ime", + "icon": "BlockIcons/20-6.png", + "description": "设置当前激活窗口的输入法", + "comment": "设置当前激活窗口的输入法为%lang%", + "title": "设置输入法", + "function": "xbot_visual.win32.set_ime", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/输入法/设置输入法.html", + "inputs": [ + { + "name": "lang", + "label": "切换到", + "required": true, + "default": "10:english", + "defaultDisplay": "英文输入法", + "tips": "选择一个输入法", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "英文输入法", + "value": "english" + }, + { + "display": "中文输入法", + "value": "chinese" + } + ] + } + } + ] + }, + { + "name": "win32.get_ime", + "icon": "BlockIcons/20-7.png", + "description": "获取当前激活窗口的输入法的中英文输入状态", + "comment": "获取当前激活窗口的输入法的中英文输入状态,将结果保存到%lang_name%", + "title": "获取输入法", + "function": "xbot_visual.win32.get_ime", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/输入法/获取输入法.html", + "inputs": [], + "outputs": [ + { + "id": "lang_name", + "label": "将输入法名称保存至", + "variableLabel": "输入法名称", + "tips": "输入一个名称用来保存输入法名称", + "type": "str", + "name": "lang_name" + } + ] + }, + { + "name": "system.open_screen_saver", + "icon": "BlockIcons/actionicon_mask_show.png", + "description": "可在保护屏幕信息不被窥视的状态下执行指令,并可展示自定义的文字提示", + "comment": "唤起屏幕保护,在屏保上显示文字%default_text%", + "title": "唤起屏幕保护", + "keywords": "屏保", + "function": "xbot_visual.system.open_screen_saver", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/屏幕保护/唤起屏幕保护.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.SystemOperation.CreateScreenSaverControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "settings", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "default_text", + "label": "提示文字", + "default": "10:影刀机器人正在工作中,请勿操作此电脑", + "tips": "设置屏保显示文字", + "type": "str", + "editor": { + "kind": "memoedit" + } + } + ] + }, + { + "name": "system.append_screen_saver_text", + "title": "设置屏保提示", + "icon": "BlockIcons/actionicon_mask_text.png", + "description": "设置显示在屏幕保护上的提示文字", + "comment": "在屏保上显示自定义提示内容%text%", + "function": "xbot_visual.system.append_screen_saver_text", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/屏幕保护/设置屏保提示.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.SystemOperation.SetScreenSaverTextControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "text", + "label": "屏保提示", + "required": true, + "tips": "设置屏保显示文字", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "settings", + "label": "提示内容", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "system.clear_screen_saver_text", + "title": "清空屏保提示", + "icon": "BlockIcons/actionicon_mask_clear.png", + "description": "清空屏保上显示的提示", + "comment": "清空屏保上显示的提示", + "function": "xbot_visual.system.clear_screen_saver_text", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/屏幕保护/清空屏保提示.html" + }, + { + "name": "system.close_screen_saver", + "title": "关闭屏幕保护", + "keywords": "屏保", + "icon": "BlockIcons/actionicon_mask_close.png", + "description": "关闭已唤起的屏保", + "comment": "关闭已唤起的屏保", + "function": "xbot_visual.system.close_screen_saver", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/屏幕保护/关闭屏幕保护.html" + }, + { + "name": "system.run_or_open", + "function": "xbot_visual.system.run_or_open", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.SystemOperation.RunOrOpenControl, ShadowBot.Shell.Development", + "title": "运行或打开", + "keywords": "启动;运行;执行;程序;软件", + "description": "运行软件、打开文件、打开文件夹、打开网址、执行系统命令等", + "comment": "运行或打开%application_path%,将执行结果保存到%process_info%", + "icon": "BlockIcons/10-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/运行或打开.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.SystemOperation.RunOrOpenHandler" + } + ], + "inputs": [ + { + "name": "application_path", + "label": "路径或命令", + "required": true, + "tips": "打开一个程序或者文件", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile" + } + } + }, + { + "name": "command_line_arguments", + "label": "参数(可选)", + "required": false, + "tips": "程序执行的额外参数", + "category": "advanced", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "working_folder", + "label": "工作目录(可选)", + "required": false, + "tips": "进程中命令的工作目录", + "category": "advanced", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "after_application_launch", + "label": "在指令执行之后", + "required": true, + "default": "10:continue", + "defaultDisplay": "继续执行下一条指令", + "tips": "选择是否继续执行指令,或者等待程序执行结束、文件关闭", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "继续执行下一条指令", + "value": "continue" + }, + { + "display": "等待主窗口出现", + "value": "wait_to_mainwindow" + }, + { + "display": "等待应用执行完成", + "value": "wait_to_complete" + } + ] + } + }, + { + "name": "is_waitexit_not_more_than", + "label": "", + "default": "13:False", + "tips": "如果不勾选, 表示无限等待", + "type": "bool", + "editor": { + "label": "等待时间不超过", + "kind": "checkbox" + } + }, + { + "name": "timeout_for_exit", + "label": "等待时间", + "default": "10:10", + "tips": "等待程序执行结束或者文件关闭的最长时间", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_waithwnd_not_more_than", + "label": "", + "default": "13:False", + "tips": "如果不勾选, 表示无限等待", + "type": "bool", + "editor": { + "label": "等待时间不超过", + "kind": "checkbox" + } + }, + { + "name": "timeout_for_hwnd", + "label": "等待时间", + "default": "10:3", + "tips": "等待主窗口出现的最长时间", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "start_as_admin", + "label": "", + "default": "13:False", + "tips": "是否以管理员身份运行", + "category": "advanced", + "type": "bool", + "editor": { + "label": "以管理员身份运行", + "kind": "checkbox" + } + }, + { + "name": "window_style", + "label": "窗口风格", + "default": "10:normal", + "defaultDisplay": "普通", + "tips": "指定新窗口应如何显示:普通、最小化、最大化", + "type": "str", + "category": "advanced", + "editor": { + "kind": "select", + "options": [ + { + "display": "普通", + "value": "normal" + }, + { + "display": "最小化", + "value": "minimized" + }, + { + "display": "最大化", + "value": "maximized" + } + ] + } + } + ], + "outputs": [ + { + "id": "process_info", + "label": "保存执行结果至", + "variableLabel": "执行结果", + "tips": "输入一个名称,用于保存执行结果", + "type": "xbot_visual.system.LaunchResult", + "name": "process_info" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/text.blocks.json b/src/assert/block_settings/text.blocks.json new file mode 100644 index 0000000..bab06c5 --- /dev/null +++ b/src/assert/block_settings/text.blocks.json @@ -0,0 +1,976 @@ +{ + "types": [], + "blocks": [ + { + "name": "text.get_text_length", + "function": "xbot_visual.text.get_text_length", + "title": "获取文本长度", + "description": "这个指令用于获取文本字符串的长度", + "comment": "获取文本%text%的长度,将文本长度保存到%text_length%", + "icon": "BlockIcons/12-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/文本操作/获取文本长度.html", + "inputs": [ + { + "name": "text", + "label": "文本内容", + "required": true, + "tips": "输入文本字符串或者一个变量", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "text_length", + "label": "保存文本长度至", + "variableLabel": "文本长度", + "tips": "输入一个名字,用来保存文本内容的长度,其返回是一个数字类型", + "type": "int", + "name": "text_length" + } + ] + }, + { + "name": "text.append_text_in_newline", + "function": "xbot_visual.text.append_text_in_newline", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Text.AppendTextInNewlineControl, ShadowBot.Shell.Development", + "title": "追加新文本", + "keywords": "拼接", + "description": "在原始文本后追加新文本内容,完成文本拼接功能", + "comment": "在原始文本%text%后追加新文本%new_line_text%,将结果保存到%result%", + "icon": "BlockIcons/12-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/文本操作/追加新文本.html", + "inputs": [ + { + "name": "text", + "label": "原始文本", + "required": true, + "tips": "输入文本字符串或者一个变量", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "new_line", + "label": "", + "required": true, + "tips": "是否换行追加", + "type": "bool", + "default": "13:False", + "editor": { + "label": "换行追加", + "kind": "checkbox" + } + }, + { + "name": "new_line_text", + "label": "追加文本", + "required": true, + "tips": "输入文本字符串或者一个变量", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "result", + "label": "保存结果至", + "variableLabel": "追加后的文本", + "tips": "输入一个名字,用来保存结果。当变量名字与原始文本变量名相同的话,就会发生覆盖。", + "type": "str", + "name": "result" + } + ] + }, + { + "name": "text.sub_text", + "function": "xbot_visual.text.sub_text", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Text.GetSubTextControl, ShadowBot.Shell.Development", + "title": "截取一段文本", + "description": "这个指令用于截取一段文本", + "comment": "截取文本%text%的子内容,将结果保存到%sub_text%", + "icon": "BlockIcons/12-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/文本操作/截取一段文本.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Text.GetSubTextHandler" + } + ], + "inputs": [ + { + "name": "text", + "label": "文本内容", + "required": true, + "tips": "输入文本字符串或者一个变量", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "start_way", + "label": "起始位置", + "required": true, + "default": "10:begin", + "defaultDisplay": "第一个字符", + "tips": "指定起始字符的位置,如果你想要在文本'Hello中国欢迎你'中提取'中国'两个字',那么起始位置就是5", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "从第一个字符开始截取", + "value": "begin" + }, + { + "display": "从指定位置开始截取", + "value": "positon" + }, + { + "display": "从指定文本开始截取", + "value": "text" + } + ] + } + }, + { + "name": "start_index", + "label": "起始字符的位置", + "required": false, + "default": "10:0", + "tips": "如果你想要在文本'Hello中国欢迎你'中提取'中国'两个字',那么起始位置就是5", + "type": "int", + "editor": { + "kind": "textbox", + "placeholder": "位置从0开始计算" + } + }, + { + "name": "start_text", + "label": "起始文本", + "required": false, + "tips": "如果你想要在文本“购买订单号:1234567890”中提取订单号,那么起始位置就是“:”", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "输入需要截取的起始文本内容" + } + }, + { + "name": "contaion_start_text", + "label": "", + "default": "13:True", + "tips": "勾选时,结果中包含起始文本,例如:“购买订单号:1234567890”,起始文本设置为“:”,勾选后结果为“:1234567890”,不勾选结果为“1234567890”", + "type": "bool", + "editor": { + "label": "结果中包含起始文本", + "kind": "checkbox" + } + }, + { + "name": "sub_way", + "label": "截取方式", + "required": true, + "default": "10:end", + "defaultDisplay": "截取到最后一个字符", + "tips": "如果你想要在文本'Hello中国欢迎你'中提取'中国'两个字',那么起始位置就是5,截取长度为2,代表从第6个字符开始要截取两个字符", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "截取到最后一个字符", + "value": "end" + }, + { + "display": "截取指定长度", + "value": "length" + } + ] + } + }, + { + "name": "sub_length", + "label": "截取长度", + "default": "10:0", + "required": false, + "tips": "输入你要截取的字符数量", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "sub_text", + "label": "保存结果至", + "variableLabel": "截取到的文本内容", + "tips": "输入一个名字,用来保存截取到的文本内容", + "type": "str", + "name": "sub_text" + } + ] + }, + { + "name": "text.pad_text", + "function": "xbot_visual.text.pad_text", + "title": "补齐文本至指定长度", + "description": "这个指令用于补齐文本至指定长度", + "comment": "在原始文本%text%的%pad_way%文本%pad_text%,直至补齐后的总长度为%total_length%,将结果保存到%result_text%", + "icon": "BlockIcons/12-4.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/文本操作/补齐文本至指定长度.html", + "inputs": [ + { + "name": "text", + "label": "原始文本", + "required": true, + "tips": "输入文本字符串或者一个变量", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "pad_way", + "label": "补齐方式", + "required": true, + "default": "10:left", + "defaultDisplay": "左端补齐", + "tips": "在原始文本的左端或者右端添加补齐文本", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "左端补齐", + "value": "left" + }, + { + "display": "右端补齐", + "value": "right" + } + ] + } + }, + { + "name": "pad_text", + "label": "用于补齐的文本", + "required": true, + "tips": "输入文本字符串或者一个变量", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "total_length", + "label": "总长度", + "required": true, + "tips": "如果你要在数字1的左端补齐2个0,那么补齐后的内容就是001,总长度就是3", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "result_text", + "label": "保存结果至", + "variableLabel": "补齐后的文本", + "tips": "输入一个名字,用来保存补齐后的文本内容", + "type": "str", + "name": "result_text" + } + ] + }, + { + "name": "text.trim_text", + "function": "xbot_visual.text.trim_text", + "title": "删除文本两端的空格", + "description": "这个指令用于删除文本两端的空格(还包括换行符、回车符、制表符)", + "comment": "删除文本%text%中%trim_way%,将结果保存到%trim_text%", + "icon": "BlockIcons/12-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/文本操作/删除文本两端的空格.html", + "inputs": [ + { + "name": "text", + "label": "原始文本", + "required": true, + "tips": "输入文本字符串或者一个变量", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "trim_way", + "label": "删除方式", + "required": true, + "default": "10:left", + "defaultDisplay": "左端的空格", + "tips": "选择你要删除文本哪一侧的空格", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "左端的空格", + "value": "left" + }, + { + "display": "右端的空格", + "value": "right" + }, + { + "display": "两端的空格", + "value": "both" + } + ] + } + } + ], + "outputs": [ + { + "id": "trim_text", + "label": "保存结果至", + "variableLabel": "删除空格后的文本", + "tips": "输入一个名字,用来保存删除空格后的文本内容", + "type": "str", + "name": "trim_text" + } + ] + }, + { + "name": "text.change_text_case", + "function": "xbot_visual.text.change_text_case", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Text.ChangeTextCaseHandler" + } + ], + "title": "改变文本的大小写", + "description": "这个指令用于改变文本的大小写(全部大写、全部小写、词首字母大写)", + "comment": "将文本%text%转换成%case_type%,将结果保存到%text_case%", + "icon": "BlockIcons/12-6.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/文本操作/改变文本的大小写.html", + "inputs": [ + { + "name": "text", + "label": "文本内容", + "required": true, + "tips": "输入文本字符串或者一个变量", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "case_type", + "label": "转换成", + "required": true, + "default": "10:upper", + "defaultDisplay": "全部大写", + "tips": "选择一个转换方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部大写", + "value": "upper" + }, + { + "display": "全部小写", + "value": "lower" + }, + { + "display": "词首字母大写", + "value": "title" + } + ] + } + } + ], + "outputs": [ + { + "id": "text_case", + "label": "保存结果至", + "variableLabel": "转换大小写后的文本", + "tips": "输入一个名字,用来保存转换大小写后的文本内容", + "type": "str", + "name": "text_case" + } + ] + }, + { + "name": "text.text_to_number", + "function": "xbot_visual.text.text_to_number", + "title": "文本转数字", + "description": "这个指令用于将文本形式的数字转换成一个包含数字的变量", + "comment": "将文本%text%转换成数字,将结果保存到%text_number%", + "icon": "BlockIcons/12-7.png", + "helpUrl": "", + "inputs": [ + { + "name": "text", + "label": "文本内容", + "required": true, + "tips": "输入文本字符串或者一个变量", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "text_number", + "label": "保存结果至", + "variableLabel": "文本转换成的数字", + "tips": "输入一个变量名字,用来保存数字结果", + "type": "int", + "name": "text_number" + } + ] + }, + { + "name": "text.number_to_text", + "function": "xbot_visual.text.number_to_text", + "title": "数字转文本", + "description": "这个指令用于将数字转换成指定格式的文本", + "comment": "将数字%num%转换成文本,将结果保存到%formatted_number%", + "icon": "BlockIcons/12-8.png", + "helpUrl": "", + "inputs": [ + { + "name": "num", + "label": "待转换的数字", + "required": true, + "tips": "请输入一个数字或者一个变量", + "type": "float", + "editor": { + "kind": "textbox" + } + }, + { + "name": "float_places", + "label": "小数位数", + "default": "10:2", + "required": true, + "tips": "请输入一个数字或者一个变量", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "use_1000_separator", + "label": "", + "required": true, + "default": "13:False", + "tips": "例如数字 10000 用千分位分割显示的话就是 10,000", + "type": "bool", + "editor": { + "label": "千分位分割", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "formatted_number", + "label": "保存结果至", + "variableLabel": "数字转换成的文本", + "tips": "输入一个变量名字,用来保存格式化后的结果", + "type": "str", + "name": "formatted_number" + } + ] + }, + { + "name": "text.join_list_to_text", + "function": "xbot_visual.text.join_list_to_text", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Text.JoinListToTextControl, ShadowBot.Shell.Development", + "title": "列表聚合成文本", + "keywords": "列表转文本", + "description": "这个指令用于将列表中的每个元素用指定的符号连接起来,最终转换成一个文本字符串", + "comment": "用连接符连接列表%list_to_join%中的每个元素,将文本结果保存到%joined_text%", + "icon": "BlockIcons/12-7.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/文本操作/列表聚合成文本.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Text.JoinListToTextHandler" + } + ], + "inputs": [ + { + "name": "list_to_join", + "label": "待转换的列表", + "required": true, + "tips": "请输入一个列表", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "delimiter_way", + "label": "连接符类型", + "required": true, + "default": "10:no", + "defaultDisplay": "无连接符", + "tips": "选择一种连接符类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "无连接符", + "value": "no" + }, + { + "display": "标准连接符", + "value": "standard" + }, + { + "display": "自定义连接符", + "value": "custom" + } + ] + } + }, + { + "name": "standard_delimiter", + "label": "标准连接符", + "required": false, + "default": "10:space", + "defaultDisplay": "空格符", + "tips": "选择一种连接符", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "空格符", + "value": "space" + }, + { + "display": "制表符", + "value": "tab" + }, + { + "display": "换行符", + "value": "new_line" + } + ] + } + }, + { + "name": "num_standard_delimiter", + "label": "连接符的数量", + "required": false, + "default": "10:1", + "tips": "连接符的重复数量", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "custom_delimiter", + "label": "自定义的连接符", + "required": false, + "default": "10:", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "joined_text", + "label": "保存结果至", + "variableLabel": "列表转换成的文本", + "tips": "输入一个变量名字,用来保存列表转换后的文本", + "type": "str", + "name": "joined_text" + } + ] + }, + { + "name": "text.split_text_to_list", + "function": "xbot_visual.text.split_text_to_list", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Text.SplitTextToListControl, ShadowBot.Shell.Development", + "title": "文本分割成列表", + "keywords": "文本转列表", + "description": "这个指令使用指定分隔符号,将目标文本分割成一个列表", + "comment": "用%delimiter_way%分割字符串%text_to_split%,将结果列表保存到%splited_list%", + "icon": "BlockIcons/12-8.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/文本操作/文本分割成列表.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Text.SplitTextToListHandler" + } + ], + "inputs": [ + { + "name": "text_to_split", + "label": "待转换的文本", + "required": true, + "tips": "请输入文本字符串或者选择一个包含字符串的变量", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "delimiter_way", + "label": "分隔符类型", + "required": true, + "default": "10:standard", + "defaultDisplay": "标准分隔符", + "tips": "选择一种列表的分隔方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "标准分隔符", + "value": "standard" + }, + { + "display": "自定义分隔符", + "value": "custom" + } + ] + } + }, + { + "name": "standard_delimiter", + "label": "标准分隔符", + "required": false, + "default": "10:space", + "defaultDisplay": "空格符", + "tips": "选择一种列表的分隔方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "空格符", + "value": "space" + }, + { + "display": "制表符", + "value": "tab" + }, + { + "display": "换行符", + "value": "new_line" + } + ] + } + }, + { + "name": "num_standard_delimiter", + "label": "分隔符的数量", + "required": false, + "default": "10:1", + "tips": "分隔符的重复数量", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "custom_delimiter", + "label": "自定义的分隔符", + "required": false, + "default": "10:", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_regular_expression", + "label": "", + "required": false, + "tips": "是否正则表达式", + "type": "bool", + "default": "13:False", + "editor": { + "label": "正则表达式", + "kind": "checkbox" + } + }, + { + "name": "remove_empty", + "label": "", + "required": true, + "tips": "是否过滤空白项", + "type": "bool", + "default": "13:False", + "editor": { + "label": "过滤空白项", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "splited_list", + "label": "保存结果至", + "variableLabel": "文本切割后的列表", + "tips": "输入一个变量名字,用来保存文本转换后的列表", + "type": "list", + "name": "splited_list" + } + ] + }, + { + "name": "text.extract_content_from_text", + "function": "xbot_visual.text.extract_content_from_text", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Text.ExtractContentFromTextControl, ShadowBot.Shell.Development", + "title": "从文本中提取内容", + "keywords": "正则;提取文本;文本提取", + "description": "根据正则表达式从文本中提取指定内容", + "comment": "从文本%text%中%extract_way%,将内容保存到%content%", + "icon": "BlockIcons/12-9.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/文本操作/从文本中提取内容.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Text.ExtractContentFromTextHandler" + } + ], + "inputs": [ + { + "name": "text", + "label": "文本内容", + "required": true, + "tips": "请输入文本字符串或者选择一个包含字符串的变量", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "extract_way", + "label": "提取方式", + "required": true, + "default": "10:number", + "defaultDisplay": "提取数字", + "tips": "选择一种内容的提取方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "提取数字", + "value": "number" + }, + { + "display": "提取手机号码", + "value": "mobile_phone" + }, + { + "display": "提取Email地址", + "value": "email" + }, + { + "display": "提取身份证号", + "value": "id_card" + }, + { + "display": "提取自定义内容", + "value": "custom" + } + ] + } + }, + { + "name": "regular_pattern", + "label": "正则表达式", + "required": true, + "tips": "请输入一段正则表达式", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "just_get_first", + "label": "", + "required": true, + "default": "13:True", + "tips": "例如在文本中找到了两个手机号,你可以只取第一个", + "type": "bool", + "editor": { + "label": "只找第一个匹配项", + "kind": "checkbox" + } + }, + { + "name": "ignore_case", + "label": "", + "required": true, + "default": "13:False", + "tips": "在字符串匹配时,是否忽略大小写", + "type": "bool", + "editor": { + "label": "忽略大小写", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "content", + "label": "保存结果至", + "variableLabel": "提取到的内容", + "tips": "输入一个变量名字,用来保存提取到的内容", + "type": "str", + "name": "content" + } + ] + }, + { + "name": "text.replace_content_from_text", + "function": "xbot_visual.text.replace_content_from_text", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Text.ReplaceContentFromText, ShadowBot.Shell.Development", + "title": "文本替换", + "keywords": "正则", + "description": "替换文本中的指定内容", + "comment": "将文本%text%中的内容%replace_text%用%dest_text%替换,将结果保存到%replace_content%", + "icon": "BlockIcons/12-9.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/数据处理/文本操作/文本替换.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Text.ReplaceContentFromTextHandler" + } + ], + "inputs": [ + { + "name": "text", + "label": "内容源", + "required": true, + "tips": "请输入文本字符串或者选择一个包含字符串的变量", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "regular_pattern", + "label": "正则表达式", + "tips": "请输入一段正则表达式", + "type": "str", + "editor": { + "kind": "PlainText" + } + }, + { + "name": "replace_way", + "label": "替换方式", + "required": true, + "default": "10:content", + "defaultDisplay": "替换内容", + "tips": "选择一种内容的提取方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "替换内容", + "value": "content" + }, + { + "display": "替换数字", + "value": "number" + }, + { + "display": "替换手机号", + "value": "mobile_phone" + }, + { + "display": "替换email", + "value": "email" + }, + { + "display": "替换身份证", + "value": "id_card" + }, + { + "display": "自定义正则替换", + "value": "custom" + } + ] + } + }, + { + "name": "replace_text", + "label": "被替换内容", + "tips": "请输入要被替换的内容", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "just_get_first", + "label": "", + "required": true, + "default": "13:True", + "tips": "例如在文本中找到了两个手机号,你可以只替换第一个", + "type": "bool", + "editor": { + "label": "只替换第一个匹配项", + "kind": "checkbox" + } + }, + { + "name": "ignore_case", + "label": "", + "required": true, + "default": "13:False", + "tips": "在字符串匹配时,是否忽略大小写", + "type": "bool", + "editor": { + "label": "忽略大小写", + "kind": "checkbox" + } + }, + { + "name": "dest_text", + "label": "替换为", + "required": false, + "tips": "请输入替换后的值", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "replace_content", + "label": "保存结果至", + "variableLabel": "替换后的文本", + "tips": "输入一个变量名字,用来保存替换后的内容", + "type": "str", + "name": "replace_content" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/visual.activities.xml b/src/assert/block_settings/visual.activities.xml new file mode 100644 index 0000000..d8e866d --- /dev/null +++ b/src/assert/block_settings/visual.activities.xml @@ -0,0 +1,500 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/assert/block_settings/web.blocks.json b/src/assert/block_settings/web.blocks.json new file mode 100644 index 0000000..908f429 --- /dev/null +++ b/src/assert/block_settings/web.blocks.json @@ -0,0 +1,1819 @@ +{ + "types": [ + { + "name": "xbot._web.browser.WebBrowser", + "localName": "网页对象", + "pythonName": "xbot.web.chrome.ChromeBrowser,xbot.web.ie.IEBrowser,xbot.web.cef.CEFBrowser", + "methods": [ + { + "display": "该网页的地址", + "function": "$0.get_url()", + "type": "str" + }, + { + "display": "该网页的标题", + "function": "$0.get_title()", + "type": "str" + } + ] + } + ], + "blocks": [ + { + "name": "web.create", + "title": "打开网页", + "keywords": "打开网站;打开网址", + "icon": "BlockIcons/1-1.png", + "comment": "在%web_type%中新建标签页%value%,将网页对象保存到%browser%,网页加载超时后执行%stop_load_if_load_timeout%操作", + "description": "使用指定浏览器打开网页,以实现网页自动化", + "function": "xbot_visual.web.create", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/打开网页.html", + "video": { + "time": "04:47" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.CreateBrowserControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.CreateHandler" + } + ], + "inputs": [ + { + "name": "web_type", + "label": "浏览器类型", + "required": true, + "tips": "选择浏览器类型, Google Chrome 浏览器、Microsoft Edge 浏览器需要安装影刀插件才能实现自动化, 另外, 如 Chrome、Edge 或 IE 安装路径非默认系统盘,需要在\"高级\"选项中设置安装路径", + "type": "str", + "default": "10:cef", + "defaultDisplay": "影刀浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + }, + { + "display": "360安全浏览器", + "value": "360se" + } + ] + } + }, + { + "name": "value", + "label": "网址", + "required": true, + "tips": "输入需要打开的网页地址", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "silent_running", + "label": "运行时不抢占鼠标键盘", + "required": true, + "category": "advanced", + "tips": "对该网页的后续操作采用API方式执行,将提升稳定性并避免占用鼠标和键盘", + "default": "13:False", + "type": "bool", + "editor": { + "label": "运行时不抢占鼠标键盘", + "kind": "checkbox" + } + }, + { + "name": "wait_load_completed", + "label": "", + "required": true, + "category": "advanced", + "default": "13:True", + "tips": "是否等待网页加载完成", + "type": "bool", + "editor": { + "label": "等待网页加载完成", + "kind": "checkbox" + } + }, + { + "name": "load_timeout", + "label": "加载超时时间", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待网页加载完成的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "stop_load_if_load_timeout", + "label": "加载超时后执行", + "required": true, + "category": "advanced", + "tips": "等待网页加载完成超时后希望执行的操作", + "type": "str", + "default": "10:handleExcept", + "defaultDisplay": "执行\"错误处理\"", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "执行\"错误处理\"", + "value": "handleExcept" + }, + { + "display": "停止网页加载", + "value": "stopLoad" + } + ] + } + }, + { + "name": "chrome_file_name", + "label": "chrome执行文件路径", + "required": false, + "category": "advanced", + "tips": "我们会默认在目录C:\\Program Files (x86)\\Google\\Chrome\\Application\\.下启动chrome.exe,也可以在这里手动配置chrome.exe文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "exe files (*.exe)|*.exe" + } + } + }, + { + "name": "edge_file_name", + "label": "edge执行文件路径", + "required": false, + "category": "advanced", + "tips": "我们会默认在目录C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\.下启动msedge.exe,也可以在这里手动配置msedge.exe文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "exe files (*.exe)|*.exe" + } + } + }, + { + "name": "ie_file_name", + "label": "ie执行文件路径", + "required": false, + "category": "advanced", + "tips": "我们会默认在目录C:\\Program Files\\Internet Explorer\\.下启动iexplore.exe,也可以在这里手动配置iexplore.exe文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "exe files (*.exe)|*.exe" + } + } + }, + { + "name": "bro360_file_name", + "label": "360执行文件路径", + "required": false, + "category": "advanced", + "tips": "我们会在默认目录下启动360se.exe, 也可以在这里手动配置360se.exe文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "exe files (*.exe)|*.exe" + } + } + }, + { + "name": "firefox_file_name", + "label": "firefox执行文件路径", + "required": false, + "category": "advanced", + "tips": "我们会在默认目录下启动firefox.exe, 也可以在这里手动配置firefox.exe文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "exe files (*.exe)|*.exe" + } + } + }, + { + "name": "arguments", + "label": "命令行参数", + "tips": "命令行参数, 必须是目标浏览器支持的命令行, 可为空", + "category": "advanced", + "type": "str", + "editor": { + "placeholder": "目标浏览器支持的命令行可空", + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "browser", + "label": "保存网页对象至", + "variableLabel": "新打开网页的对象", + "tips": "该变量保存的是网页对象,使用此网页对象可以对网页进行自动化操作", + "name": "web_page", + "type": "xbot._web.browser.WebBrowser" + } + ] + }, + { + "name": "web.get", + "title": "获取已打开的网页对象", + "icon": "BlockIcons/1-2.png", + "comment": "在%web_type%中获取已打开的网页对象%value%, 并将网页对象保存至变量%browser%, 网页加载超时后执行 %stop_load_if_load_timeout% 操作", + "description": "获取网址或标题匹配已打开的网页,或者获取当前浏览器选中的网页", + "function": "xbot_visual.web.get", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/获取已打开的网页对象.html", + "video": { + "time": "07:16" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.GetBrowserControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetBrowserHandler" + } + ], + "inputs": [ + { + "name": "web_type", + "label": "浏览器类型", + "required": true, + "tips": "选择浏览器类型, Google Chrome 浏览器、Microsoft Edge 浏览器需要安装影刀插件才能实现自动化", + "type": "str", + "default": "10:cef", + "defaultDisplay": "影刀浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + }, + { + "display": "360安全浏览器", + "value": "360se" + } + ] + } + }, + { + "name": "mode", + "label": "匹配方式", + "required": true, + "default": "10:activated", + "defaultDisplay": "匹配当前选中的网页", + "tips": "选择获取已打开网页的匹配方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据标题匹配", + "value": "title" + }, + { + "display": "根据网址匹配", + "value": "url" + }, + { + "display": "匹配当前选中的网页", + "value": "activated" + } + ] + } + }, + { + "name": "value", + "label": "标题", + "required": false, + "tips": "填写要匹配的网页标题或地址,支持模糊匹配", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + }, + { + "name": "silent_running", + "label": "运行时不抢占鼠标键盘", + "required": true, + "category": "advanced", + "tips": "对该网页的后续操作采用API方式执行,将提升稳定性并避免占用鼠标和键盘", + "default": "13:True", + "type": "bool", + "editor": { + "label": "运行时不抢占鼠标键盘", + "kind": "checkbox" + } + }, + { + "name": "wait_load_completed", + "label": "", + "required": true, + "category": "advanced", + "default": "13:True", + "tips": "是否等待网页加载完成", + "type": "bool", + "editor": { + "label": "等待网页加载完成", + "kind": "checkbox" + } + }, + { + "name": "load_timeout", + "label": "超时时间(秒)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待网页加载完成的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "stop_load_if_load_timeout", + "label": "超时后执行 ", + "required": true, + "category": "advanced", + "tips": "等待网页加载完成超时后希望执行的操作", + "type": "str", + "default": "10:handleExcept", + "defaultDisplay": "执行\"错误处理\"", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "执行\"错误处理\"", + "value": "handleExcept" + }, + { + "display": "停止网页加载", + "value": "stopLoad" + } + ] + } + }, + { + "name": "open_page", + "label": "", + "required": true, + "category": "advanced", + "default": "13:False", + "tips": "根据网页标题或网址匹配失败时,打开新网页", + "type": "bool", + "editor": { + "label": "匹配失败时打开新网页", + "kind": "checkbox" + } + }, + { + "name": "url", + "label": "新网址", + "required": false, + "category": "advanced", + "tips": "打开新网页的网址", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "browser", + "label": "保存网页对象至", + "variableLabel": "网页对象", + "tips": "该变量保存的是网页对象,使用此网页对象可以对网页进行自动化操作", + "name": "web_page", + "type": "xbot._web.browser.WebBrowser" + } + ], + "exception_handling": { + "logging": true, + "mode": "retry", + "retryTime": 3, + "retryInterval": 3 + } + }, + { + "name": "web.get_all", + "title": "获取网页对象列表", + "icon": "BlockIcons/1-2.png", + "comment": "在%web_type%中获取已打开且满足筛选条件的网页对象列表%value%,将该列表保存到%browser_list%,列表中每一个网页加载超时后执行%stop_load_if_load_timeout%操作", + "description": "获取已打开的网页对象列表,以实现批量对每个网页相关自动化操作", + "function": "xbot_visual.web.get_all", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/网页操作/获取网页对象列表.html", + "video": { + "time": "02:37" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.GetAllBrowsersControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetALLBrowsersHandler" + } + ], + "inputs": [ + { + "name": "web_type", + "label": "浏览器类型", + "required": true, + "tips": "选择浏览器类型, Google Chrome 浏览器、Microsoft Edge 浏览器需要安装影刀插件才能实现自动化", + "type": "str", + "default": "10:cef", + "defaultDisplay": "影刀浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + }, + { + "display": "360安全浏览器", + "value": "360se" + } + ] + } + }, + { + "name": "mode", + "label": "匹配方式", + "required": true, + "default": "10:title", + "defaultDisplay": "匹配所有网页", + "tips": "选择获取已打开网页的匹配方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "匹配所有网页", + "value": "all" + }, + { + "display": "根据标题匹配", + "value": "title" + }, + { + "display": "根据网址匹配", + "value": "url" + } + ] + } + }, + { + "name": "value", + "label": "标题", + "required": false, + "tips": "填写要匹配的网页标题或地址,支持模糊匹配,不填则匹配所有网页", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "browser_list", + "label": "保存网页对象列表至", + "variableLabel": "网页对象列表", + "tips": "该变量保存的是网页对象列表,使用此网页对象列表可以对每个网页进行自动化操作", + "name": "web_page_list", + "type": "list" + } + ] + }, + { + "name": "web.get_cookies", + "title": "获取筛选所有Cookie", + "icon": "BlockIcons/3-12.png", + "comment": "从单个 cookie store 中获取与给定信息匹配的所有 cookie 集合", + "description": "从单个 cookie store 中获取与给定信息匹配的所有 cookie 集合", + "function": "xbot_visual.web.get_cookies", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/获取筛选所有cookie.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.GetCookiesControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetCookiesHandler" + } + ], + "inputs": [ + { + "name": "url_type", + "label": "url 指定方式", + "required": true, + "default": "10:auto", + "defaultDisplay": "网页对象", + "tips": "用来筛选 cookies 的 url 来源, 可选择手动输入, 如果选择网页对象,则自动使用网页 url 进行筛选", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据网页对象", + "value": "auto" + }, + { + "display": "根据输入的url", + "value": "manual" + } + ] + } + }, + { + "name": "browser", + "label": "网页对象", + "required": false, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "web_type", + "label": "浏览器类型", + "required": false, + "tips": "获取指定类型浏览器 cookie", + "type": "str", + "default": "10:cef", + "defaultDisplay": "影刀浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + }, + { + "display": "360安全浏览器", + "value": "360se" + } + ] + } + }, + { + "name": "url", + "label": "筛选cookie url", + "required": false, + "tips": "根据是否与给定的 URL 比如 'https://www.winrobot360.com'匹配, 筛选浏览器 cookie (url为必填项)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "name", + "label": "筛选cookie name", + "required": false, + "category": "advanced", + "tips": "根据是否与给定的 name 匹配, 筛选 cookie (值为空则忽略 name筛选条件)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "domain", + "label": "筛选cookie domain", + "required": false, + "category": "advanced", + "tips": "根据是否完全与给定的 domain 比如 '.winrobot360.com'匹配, 或是否是其子域名, 筛选 cookie (浏览器类型为IE或值为空则忽略 domain筛选条件)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "path", + "label": "筛选cookie path", + "required": false, + "category": "advanced", + "tips": "根据是否与给定的 path 比如 '/', 筛选 cookie (浏览器类型为IE或值为空则忽略 path筛选条件)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "filter_secure", + "label": "", + "required": true, + "category": "advanced", + "default": "13:False", + "tips": "筛选 secure=true cookie 或 secure=fasle cookie(浏览器类型为IE则忽略该设置)", + "type": "bool", + "editor": { + "label": "根据 Cookie secure 属性筛选", + "kind": "checkbox" + } + }, + { + "name": "secure", + "label": "", + "required": false, + "category": "advanced", + "default": "13:False", + "tips": "勾选则筛选 secure cookie 集合, 取消勾选则获取非 secure cookie 集合(浏览器类型为IE则忽略该设置)", + "type": "bool", + "editor": { + "label": "仅 secure Cookie", + "kind": "checkbox" + } + }, + { + "name": "filter_session", + "label": "", + "required": true, + "category": "advanced", + "default": "13:False", + "tips": "筛选会话 cookie 或永久性 cookie(浏览器类型为IE则忽略该设置)", + "type": "bool", + "editor": { + "label": "根据 Cookie 生命周期筛选", + "kind": "checkbox" + } + }, + { + "name": "session", + "label": "", + "required": false, + "category": "advanced", + "default": "13:False", + "tips": "勾选则筛选会话 cookie 集合, 取消勾选则筛选永久性 cookie 集合(浏览器类型为IE则忽略该设置)", + "type": "bool", + "editor": { + "label": "仅会话 Cookie", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "cookie_list", + "label": "保存cookie列表至", + "tips": "指定一个变量名称,该变量用于保存获取到的 cookie 列表,列表项键包括'domain'、'expirationDate'、'name'、'value'、'httpOnly'...(ie只包括name, value), 集合中的值可以通过比如 item['value'] 的方式获取", + "name": "cookie_list", + "type": "list" + } + ] + }, + { + "name": "web.get_cookies_v2", + "title": "获取筛选所有Cookie", + "icon": "BlockIcons/3-12.png", + "comment": "从单个 cookie store 中获取与给定信息匹配的所有 cookie 集合", + "description": "从单个 cookie store 中获取与给定信息匹配的所有 cookie 集合", + "function": "xbot_visual.web.get_cookies_v2", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/获取筛选所有cookie.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.GetCookiesV2Control, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetCookiesV2Handler" + } + ], + "inputs": [ + { + "name": "web_type", + "label": "浏览器类型", + "required": true, + "tips": "获取指定类型浏览器 cookie", + "type": "str", + "default": "10:chrome", + "defaultDisplay": "Google Chrome浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + }, + { + "display": "360安全浏览器", + "value": "360se" + } + ] + } + }, + { + "name": "url", + "label": "筛选 cookie url", + "required": false, + "tips": "根据给定的 URL 比如 'https://www.winrobot360.com' 筛选cookie, 值为空则忽略 url筛选条件 (IE 不能为空)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "name", + "label": "筛选 cookie name", + "required": false, + "tips": "根据给定的 name 筛选 cookie, 值为空则忽略 name筛选条件", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "domain", + "label": "筛选 cookie domain", + "required": false, + "tips": "根据给定的 domain 比如'.winrobot360.com'筛选 cookie, 值为空则忽略 domain 筛选条件", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "path", + "label": "筛选 cookie path", + "required": false, + "tips": "根据给定的 path 筛选 cookie, 值为空则忽略 path筛选条件", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "partition_key", + "label": "筛选 partition key", + "required": false, + "tips": "根据给定的 paritition_key 筛选 cookie, 值为空则忽略 partition key 筛选条件(仅支持 Chrome/Edge 119、firefox 94 及之后版本)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "filter_secure", + "label": "", + "required": true, + "category": "advanced", + "default": "13:False", + "tips": "筛选 secure=true cookie 或 secure=fasle cookie", + "type": "bool", + "editor": { + "label": "根据 Cookie secure 属性筛选", + "kind": "checkbox" + } + }, + { + "name": "secure", + "label": "", + "required": false, + "category": "advanced", + "default": "13:False", + "tips": "勾选则筛选 secure cookie, 取消勾选则获取非 secure cookie", + "type": "bool", + "editor": { + "label": "仅 secure Cookie", + "kind": "checkbox" + } + }, + { + "name": "filter_session", + "label": "", + "required": true, + "category": "advanced", + "default": "13:False", + "tips": "筛选会话 cookie 或永久性 cookie", + "type": "bool", + "editor": { + "label": "根据 Cookie 生命周期筛选", + "kind": "checkbox" + } + }, + { + "name": "session", + "label": "", + "required": false, + "category": "advanced", + "default": "13:False", + "tips": "勾选则筛选会话 cookie 集合, 取消勾选则筛选永久性 cookie 集合", + "type": "bool", + "editor": { + "label": "仅会话 Cookie", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "cookie_list", + "label": "保存cookie列表至", + "tips": "指定一个变量名称,该变量用于保存获取到的 cookie 列表,列表项键包括'domain'、'expirationDate'、'name'、'value'、'httpOnly'...(ie只包括name, value), 集合中的值可以通过比如 item['value'] 的方式获取", + "name": "cookie_list", + "type": "list" + } + ] + }, + { + "name": "web.get_cookie", + "title": "获取指定Cookie信息", + "icon": "BlockIcons/3-12.png", + "comment": "获取指定 cookie 信息", + "description": "如果指定的 URL 存在多个相同 name 的 cookie,则返回 path 最长的 cookie。若 path 长度相同,返会创建时间较早的 cookie", + "function": "xbot_visual.web.get_cookie", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/获取指定cookie信息.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.GetCookieControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetCookieHandler" + } + ], + "inputs": [ + { + "name": "url_type", + "label": "url 指定方式", + "required": true, + "default": "10:auto", + "defaultDisplay": "网页对象", + "tips": "用来指定 cookie 的 url 来源, 可选择手动输入, 如果选择网页对象,则自动使用网页 url 指定", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据网页对象", + "value": "auto" + }, + { + "display": "根据输入的url", + "value": "manual" + } + ] + } + }, + { + "name": "browser", + "label": "网页对象", + "required": false, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "web_type", + "label": "浏览器类型", + "required": false, + "tips": "获取指定类型浏览器 cookie", + "type": "str", + "default": "10:cef", + "defaultDisplay": "影刀浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + }, + { + "display": "360安全浏览器", + "value": "360se" + } + ] + } + }, + { + "name": "url", + "label": "筛选cookie url", + "required": false, + "tips": "根据是否与给定的 URL 比如 'https://www.winrobot360.com'匹配, 筛选浏览器 cookie (url 为必填项)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "name", + "label": "筛选 cookie name", + "required": true, + "category": "advanced", + "tips": "根据是否与给定的 name 匹配, 筛选 cookie (值为空则忽略 name 筛选条件)", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "cookie", + "label": "保存 cookie 至", + "tips": "指定一个变量名称,该变量用于保存获取到的cookie,cookie 键包括'domain'、'expirationDate'、'name'、'value'、'httpOnly'...(ie只包括name, value), cookie 的值可以通过比如 cookie['value'] 的方式获取", + "name": "cookie", + "type": "dict" + } + ] + }, + { + "name": "web.set_cookie", + "title": "设置Cookie", + "icon": "BlockIcons/3-12.png", + "comment": "根据指定的 cookie 数据设置 cookie,若存在等效 cookie 则覆盖", + "description": "根据指定的 cookie 数据设置 cookie,若存在等效 cookie 则覆盖", + "function": "xbot_visual.web.set_cookie", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/网页操作/设置cookie.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.SetCookieControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.SetCookieHandler" + } + ], + "inputs": [ + { + "name": "url_type", + "label": "url 设置方式", + "required": true, + "default": "10:auto", + "defaultDisplay": "网页对象", + "tips": "cookie url 设置值来源, 可选择手动输入, 如果选择网页对象,则自动使用网页 url 设置", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据网页对象", + "value": "auto" + }, + { + "display": "根据输入的url", + "value": "manual" + } + ] + } + }, + { + "name": "browser", + "label": "网页对象", + "required": false, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "web_type", + "label": "浏览器类型", + "required": false, + "tips": "设置指定类型浏览器 cookie", + "type": "str", + "default": "10:cef", + "defaultDisplay": "影刀浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + }, + { + "display": "360安全浏览器", + "value": "360se" + } + ] + } + }, + { + "name": "url", + "label": "cookie url", + "required": false, + "tips": "cookie url,与 cookie 设置相关联的 url,该值影响创建 cookie 的默认 domain 和 path 值", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "name", + "label": "cookie name", + "required": true, + "tips": "cookie name, 忽略则为空", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "value", + "label": "cookie value", + "required": false, + "tips": "cookie value,忽略则为空", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "sessionCookie", + "label": "", + "required": true, + "default": "13:True", + "tips": "默认设置为会话 cookie,取消勾选则设置为持久化 cookie", + "type": "bool", + "editor": { + "label": "设置为会话 Cookie", + "kind": "checkbox" + } + }, + { + "name": "expires", + "label": "cookie 有效期(秒)", + "required": false, + "default": "10:100", + "tips": "持久化 cookie 需要设置有效期(cookie 生效到失效的时间间隔,单位为秒),默认 100s", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 1 + } + }, + { + "name": "domain", + "label": "cookie domain", + "required": false, + "tips": "cookie domain,默认为 url 的 domain 部分。忽略这该 cookie 为 host-only cookie", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "path", + "label": "cookie path", + "required": false, + "tips": "cookie path,默认为 url 的 path 部分,忽略则为空", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "httpOnly", + "label": "标记为 HttpOnly", + "required": false, + "default": "13:False", + "tips": "设置该 cookie 是否被标记为 HttpOnly,默认为 false", + "type": "bool", + "editor": { + "label": "标记为 HttpOnly", + "kind": "checkbox" + } + }, + { + "name": "secure", + "label": "标记为 Secure", + "required": false, + "default": "13:False", + "tips": "设置该 cookie 是否被标记为 Secure,默认为 false", + "type": "bool", + "editor": { + "label": "标记为 Secure", + "kind": "checkbox" + } + } + ] + }, + { + "name": "web.remove_cookie", + "title": "移除Cookie", + "icon": "BlockIcons/3-12.png", + "comment": "移除网页对象%browser%上名为%name%的cookie", + "description": "移除通过 cookie url、 cookie name 指定的 cookie", + "function": "xbot_visual.web.remove_cookie", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/网页操作/移除指定cookie.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.RemoveCookieControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.RemoveCookieHandler" + } + ], + "inputs": [ + { + "name": "url_type", + "label": "url 指定方式", + "required": true, + "default": "10:auto", + "defaultDisplay": "网页对象", + "tips": "用来指定 cookie 的 url 来源, 可选择手动输入, 如果选择网页对象,则自动使用网页 url 指定", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据网页对象", + "value": "auto" + }, + { + "display": "根据输入的url", + "value": "manual" + } + ] + } + }, + { + "name": "browser", + "label": "网页对象", + "required": false, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "web_type", + "label": "浏览器类型", + "required": false, + "tips": "获取指定类型浏览器 cookie", + "type": "str", + "default": "10:cef", + "defaultDisplay": "影刀浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + }, + { + "display": "360安全浏览器", + "value": "360se" + } + ] + } + }, + { + "name": "url", + "label": "cookie url", + "required": false, + "tips": "cookie url,将被移除的 cookie url", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "remove_type", + "label": "移除方式", + "required": true, + "tips": "设置cookie的移除方式", + "type": "str", + "default": "10:appoint_cookie", + "defaultDisplay": "移除指定Cookie", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "移除指定Cookie", + "value": "appoint_cookie" + }, + { + "display": "移除所有Cookie", + "value": "all_cookies" + } + ] + } + }, + { + "name": "name", + "label": "cookie name", + "required": false, + "category": "advanced", + "tips": "将被移除的 cookie 名称", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "web.handle_save_dialog", + "title": "处理下载对话框", + "keywords": "弹框", + "description": "处理下载对话框", + "comment": "点击%web_type%中下载对话框的%dialog_result%按钮下载,保存到路径%file_folder%下,将下载的文件路径保存到%download_file_name%", + "icon": "BlockIcons/4-1.png", + "function": "xbot_visual.web.handle_save_dialog", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.HandleSaveDialogControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/对话框处理/处理下载对话框.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.HandleSaveDialogHandler" + } + ], + "inputs": [ + { + "name": "web_type", + "label": "浏览器类型", + "required": true, + "tips": "选择想要操作的浏览器对象", + "type": "str", + "default": "10:cef", + "defaultDisplay": "影刀浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + } + ] + } + }, + { + "name": "dialog_result", + "label": "点击按钮", + "required": true, + "default": "10:OK", + "defaultDisplay": "确定", + "tips": "当下载对话框出现时要点击的按钮", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "确定", + "value": "OK" + }, + { + "display": "取消", + "value": "Cancle" + } + ] + } + }, + { + "name": "file_folder", + "label": "保存文件夹", + "required": true, + "tips": "保存下载文件的文件夹", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder", + "filter": "All Files (*.*)|*.*" + } + } + }, + { + "name": "use_custom_filename", + "label": "是否自定义文件名", + "required": true, + "default": "13:False", + "tips": "是否自定义保存文件名,不勾选则使用默认文件名,若没有默认文件名,为下载资源自动生成不重复的文件名", + "type": "bool", + "editor": { + "label": "是否自定义保存文件名", + "kind": "checkbox" + } + }, + { + "name": "file_name", + "label": "保存文件名", + "required": false, + "tips": "自定义保存的文件名", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "wait_complete", + "label": "是否等待下载完成", + "required": false, + "default": "13:False", + "tips": "若是,则会在最大超时时间内一直等待,直到文件下载完成", + "type": "bool", + "editor": { + "label": "是否等待下载完成", + "kind": "checkbox" + } + }, + { + "name": "wait_complete_timeout", + "label": "超时时间(s)", + "required": false, + "default": "10:300", + "tips": "等待下载超时时间,单位(秒)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "simulate", + "label": "", + "default": "13:False", + "category": "advanced", + "tips": "如果使用模拟人工输入则通过模拟人工的方式触发输入事件,否则将根据目标元素的自动化接口触发输入", + "type": "bool", + "editor": { + "label": "模拟人工输入", + "kind": "checkbox" + } + }, + { + "name": "clipboard_input", + "label": "", + "default": "13:False", + "category": "advanced", + "tips": "将输入路径和文件名添加到剪切板, 通过Ctrl+V的方式将内容填写到下载对话框的文件名输入框中,避免输入法问题", + "type": "bool", + "editor": { + "label": "剪切板输入", + "kind": "checkbox" + } + }, + { + "name": "input_type", + "label": "输入方式", + "required": true, + "tips": "自动化接口输入: 调用文件名输入框自身实现的自动化接口输入\r\n剪切板输入: 将输入路径和文件名添加到剪切板, 通过Ctrl+V的方式将内容填写到上传对话框的文件名输入框中,避免输入法问题\r\n模拟人工输入: 如果使用模拟人工输入则通过模拟人工的方式触发输入事件(会自动切换当前输入法为英文输入状态, 以避免输入法造成的输入错误问题),否则将根据目标元素的自动化接口触发输入", + "type": "str", + "default": "10:automatic", + "defaultDisplay": "自动化接口输入", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "自动化接口输入", + "value": "automatic" + }, + { + "display": "剪切板输入", + "value": "clipboard" + }, + { + "display": "模拟人工输入", + "value": "simulate" + } + ] + } + }, + { + "name": "wait_appear_timeout", + "label": "等待对话框出现(秒)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待下载对话框出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "force_ime_ENG", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "存在不常见的输入法切换英文输入状态不成功的情况\r\n需要指定强制加载美式键盘(ENG), 确保模拟输入不受中文输入法影响", + "type": "bool", + "editor": { + "label": "强制加载美式键盘(ENG)", + "kind": "checkbox" + } + }, + { + "name": "send_key_delay", + "label": "按键输入间隔(毫秒)", + "required": true, + "category": "advanced", + "default": "10:50", + "tips": "两次按键输入的间隔时间, 单位是毫秒, 为避免输入错误, 请将该值调大,最大值为1000ms", + "type": "int", + "editor": { + "kind": "spin", + "minValue": 5 + } + }, + { + "name": "focus_timeout", + "label": "焦点超时时间(毫秒)", + "category": "advanced", + "default": "10:1000", + "tips": "设置焦点超时时间(毫秒), 元素获取焦点后暂停指定时间后进行输入操作", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "download_file_name", + "label": "文件保存位置", + "tips": "下载文件所在的位置:文件路径+名称", + "name": "download_file_name", + "type": "str" + } + ] + }, + { + "name": "web.handle_upload_dialog", + "title": "处理上传对话框", + "keywords": "弹框", + "description": "处理上传对话框", + "comment": "点击%web_type%中上传对话框的%dialog_result%按钮上传,上传文件%filename%", + "icon": "BlockIcons/4-2.png", + "function": "xbot_visual.web.handle_upload_dialog", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.HandleUploadDialogControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/对话框处理/处理上传对话框.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.HandleUploadDialogHandler" + } + ], + "inputs": [ + { + "name": "web_type", + "label": "浏览器类型", + "required": true, + "tips": "选择想要操作的浏览器对象", + "type": "str", + "default": "10:cef", + "defaultDisplay": "影刀浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + }, + { + "display": "360安全浏览器", + "value": "360se" + } + ] + } + }, + { + "name": "dialog_result", + "label": "点击按钮", + "required": true, + "default": "10:OK", + "defaultDisplay": "确定", + "tips": "当上传对话框出现时要点击的按钮", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "确定", + "value": "OK" + }, + { + "display": "取消", + "value": "Cancle" + } + ] + } + }, + { + "name": "filename", + "label": "上传文件路径", + "required": true, + "tips": "要上传文件完整路径; \r\n如果需要多文件上传, 在python模式下, 输入完整路径字符串数组,比如: [r\"C:\\test.txt\",r\"C:\\text1.txt\"]", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "All Files (*.*)|*.*" + } + } + }, + { + "name": "simulate", + "label": "", + "default": "13:False", + "category": "advanced", + "tips": "如果使用模拟人工输入则通过模拟人工的方式触发输入事件,否则将根据目标元素的自动化接口触发输入", + "type": "bool", + "editor": { + "label": "模拟人工输入", + "kind": "checkbox" + } + }, + { + "name": "clipboard_input", + "label": "", + "default": "13:False", + "category": "advanced", + "tips": "将输入路径和文件名添加到剪切板, 通过Ctrl+V的方式将内容填写到上传对话框的文件名输入框中,避免输入法问题", + "type": "bool", + "editor": { + "label": "剪切板输入", + "kind": "checkbox" + } + }, + { + "name": "input_type", + "label": "输入方式", + "required": true, + "tips": "自动化接口输入: 调用文件名输入框自身实现的自动化接口输入\r\n剪切板输入: 将输入路径和文件名添加到剪切板, 通过Ctrl+V的方式将内容填写到上传对话框的文件名输入框中,避免输入法问题\r\n模拟人工输入: 如果使用模拟人工输入则通过模拟人工的方式触发输入事件(会自动切换当前输入法为英文输入状态, 以避免输入法造成的输入错误问题),否则将根据目标元素的自动化接口触发输入", + "type": "str", + "default": "10:automatic", + "defaultDisplay": "自动化接口输入", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "自动化接口输入", + "value": "automatic" + }, + { + "display": "剪切板输入", + "value": "clipboard" + }, + { + "display": "模拟人工输入", + "value": "simulate" + } + ] + } + }, + { + "name": "wait_appear_timeout", + "label": "等待对话框出现(秒)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待上传对话框出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "force_ime_ENG", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "存在不常见的输入法切换英文输入状态不成功的情况\r\n需要指定强制加载美式键盘(ENG), 确保模拟输入不受中文输入法影响", + "type": "bool", + "editor": { + "label": "强制加载美式键盘(ENG)", + "kind": "checkbox" + } + }, + { + "name": "send_key_delay", + "label": "按键输入间隔(毫秒)", + "required": true, + "category": "advanced", + "default": "10:50", + "tips": "两次按键输入的间隔时间(仅模拟输入有效), 单位是毫秒, 为避免输入错误, 请将该值调大,最大值为1000ms", + "type": "int", + "editor": { + "kind": "spin", + "minValue": 5 + } + }, + { + "name": "focus_timeout", + "label": "焦点超时时间(毫秒)", + "category": "advanced", + "default": "10:1000", + "tips": "设置焦点超时时间(毫秒), 元素获取焦点后暂停指定时间后进行输入操作", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/web.browser.blocks.json b/src/assert/block_settings/web.browser.blocks.json new file mode 100644 index 0000000..c62db04 --- /dev/null +++ b/src/assert/block_settings/web.browser.blocks.json @@ -0,0 +1,1279 @@ +{ + "types": [ + { + "name": "xbot._web.element.WebElement", + "localName": "网页元素", + "pythonName": "xbot.web.chrome.ChromeElement,xbot.web.ie.IEElement,xbot.web.cef.CEFElement", + "methods": [ + { + "display": "该元素的链接", + "function": "$0.get_attribute('href')", + "type": "str" + }, + { + "display": "该元素的文本内容", + "function": "$0.get_text()", + "type": "str" + } + ] + } + ], + "blocks": [ + { + "name": "web.browser.close", + "title": "关闭网页", + "description": "关闭已打开的某个或所有网页", + "comment": "关闭%web_type%中的网页%browser%", + "icon": "BlockIcons/1-3.png", + "function": "xbot_visual.web.browser.close", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.CloseBrowserControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/关闭网页.html", + "video": { + "time": "03:16" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.CloseBrowserBlockHandler" + } + ], + "inputs": [ + { + "name": "operation", + "label": "操作", + "required": true, + "default": "10:close_specified", + "defaultDisplay": "关闭指定网页", + "tips": "选择要关闭一个指定的网页还是关闭所有网页", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "关闭指定网页", + "value": "close_specified" + }, + { + "display": "关闭所有网页", + "value": "close_all" + } + ] + } + }, + { + "name": "browser", + "label": "网页对象", + "required": false, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "web_type", + "label": "操作浏览器", + "required": false, + "tips": "选择想要操作的浏览器对象", + "type": "str", + "default": "10:cef", + "defaultDisplay": "影刀浏览器", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "影刀浏览器", + "value": "cef" + }, + { + "display": "Google Chrome浏览器", + "value": "chrome" + }, + { + "display": "Microsoft Edge浏览器", + "value": "edge" + }, + { + "display": "Internet Explorer浏览器", + "value": "ie" + }, + { + "display": "Mozilla Firefox浏览器", + "value": "firefox" + }, + { + "display": "360安全浏览器", + "value": "360se" + } + ] + } + }, + { + "name": "task_kill", + "label": "", + "required": true, + "default": "13:False", + "tips": "如果勾选, 将强制结束属于当前用户的指定浏览器进程和由它启动的所有子进程", + "type": "bool", + "editor": { + "label": "终止浏览器进程", + "kind": "checkbox" + } + } + ] + }, + { + "name": "web.browser.navigate", + "title": "跳转至新网址", + "keywords": "后退;前进;重新加载;刷新", + "description": "将Web浏览器跳转至新页面、后退、前进、或重新加载(刷新)当前页面", + "comment": "将网页%browser%%mode%", + "icon": "BlockIcons/1-4.png", + "function": "xbot_visual.web.browser.navigate", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/网页操作/跳转至新网址.html", + "video": { + "time": "01:48" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.NavigateBrowserControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.NavigateBrowserHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "mode", + "label": "跳转方式", + "required": true, + "tips": "选择一种跳转方式,可以是跳转至新页面、后退、前进、或重新加载当前页面", + "default": "10:url", + "defaultDisplay": "跳转至新页面", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "跳转至新页面", + "value": "url" + }, + { + "display": "后退", + "value": "back" + }, + { + "display": "前进", + "value": "forward" + }, + { + "display": "重新加载(刷新)", + "value": "reload" + } + ] + } + }, + { + "name": "url", + "label": "新网址", + "tips": "填写要跳转到的目标网址", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "ignore_cache", + "label": "", + "category": "advanced", + "tips": "重新加载时是否忽略浏览器缓存", + "default": "13:False", + "type": "bool", + "editor": { + "label": "忽略缓存", + "kind": "checkbox" + } + }, + { + "name": "load_timeout", + "label": "网页加载超时时间(秒)", + "required": true, + "default": "10:20", + "category": "advanced", + "tips": "等待网页加载完成的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.browser.stop_load", + "title": "停止网页加载", + "description": "如果网页尚未加载完毕则强制停止网页加载", + "comment": "停止网页%browser%加载", + "icon": "BlockIcons/1-5.png", + "function": "xbot_visual.web.browser.stop_load", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/网页操作/停止网页加载.html", + "video": { + "time": "00:18" + }, + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + } + ] + }, + { + "name": "web.browser.execute_javascript", + "title": "执行JS脚本", + "keywords": "Javascript", + "description": "在指定的网页中执行一段Javascript脚本,同时获取脚本的执行结果", + "comment": "在网页%browser%中的元素%element%上执行Javascript,将执行结果保存到%js_result%", + "icon": "BlockIcons/1-6.png", + "function": "xbot_visual.web.browser.execute_javascript", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/网页操作/执行js脚本.html", + "video": { + "time": "03:14" + }, + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple", + "elementType": "xbot._web.browser.WebBrowser" + } + }, + { + "name": "argument", + "label": "参数", + "tips": "填写要传入到Javascript脚本中的参数", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "code", + "label": "javascript", + "required": true, + "default": "10:function (element, input) {\r\n // 在此处编写您的Javascript代码\r\n // element表示选择的操作目标(HTML元素)\r\n // input表示输入的参数(字符串)\r\n \r\n return null;\r\n}", + "tips": "编写一段用于执行的Javascript脚本", + "type": "str", + "editor": { + "kind": "code", + "language": "javascript" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "execution_world", + "label": "执行环境", + "required": true, + "category": "advanced", + "default": "10:ISOLATED", + "defaultDisplay": "插件环境", + "tips": "JS脚本的目标执行环境", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "插件环境", + "value": "ISOLATED" + }, + { + "display": "网页环境", + "value": "MAIN" + } + ] + } + } + ], + "outputs": [ + { + "id": "js_result", + "label": "存储脚本执行结果至", + "variableLabel": "脚本执行结果", + "tips": "指定一个变量名称,该变量用于存储脚本执行的结果", + "name": "web_js_result", + "type": "any" + } + ] + }, + { + "name": "web.browser.scroll_to", + "title": "鼠标滚动网页", + "description": "在指定的网页中滚动鼠标,可以设置为滚动到顶部、底部或者指定位置", + "comment": "在指定的网页中滚动鼠标", + "icon": "BlockIcons/2-10.png", + "function": "xbot_visual.web.browser.scroll_to", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.ScrollToElementControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/网页操作/鼠标滚动网页.html", + "video": { + "time": "03:50" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.ScrollToElementHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "scroll_on_element", + "label": "", + "required": true, + "default": "13:False", + "tips": "是否在指定元素上滚动", + "type": "bool", + "editor": { + "label": "在指定元素上滚动", + "kind": "checkbox" + } + }, + { + "name": "element", + "label": "操作目标", + "autoFill": false, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple", + "elementType": "xbot._web.browser.WebBrowser" + } + }, + { + "name": "search_up", + "label": "", + "required": false, + "default": "13:False", + "tips": "若当前元素无滚动条,自动向上查找有滚动条元素", + "type": "bool", + "editor": { + "label": "元素无滚动条,自动向上查找", + "kind": "checkbox" + } + }, + { + "name": "location", + "label": "滚动位置", + "required": true, + "tips": "指定网页滚动到的目标位置", + "default": "10:bottom", + "defaultDisplay": "滚动到底部", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "滚动到底部", + "value": "bottom" + }, + { + "display": "滚动到顶部", + "value": "top" + }, + { + "display": "滚动到指定位置", + "value": "point" + }, + { + "display": "滚动一屏", + "value": "screen" + } + ] + } + }, + { + "name": "behavior", + "label": "滚动效果", + "required": true, + "tips": "指定鼠标的滚动效果可以是平滑滚动或者瞬间滚动", + "default": "10:smooth", + "defaultDisplay": "平滑滚动", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "平滑滚动", + "value": "smooth" + }, + { + "display": "瞬间滚动", + "value": "instant" + } + ] + } + }, + { + "name": "left", + "label": "横坐标", + "default": "10:0", + "tips": "鼠标移动到的目标位置的横坐标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "top", + "label": "纵坐标", + "default": "10:0", + "tips": "鼠标移动到的目标位置的纵坐标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.browser.handle_javascript_dialog", + "title": "处理网页对话框", + "keywords": "弹框;alert;confirm;prompt;", + "description": "处理网页中alert、confirm、prompt三种弹框", + "comment": "在网页%browser%的对话框中,点击%dialog_result%按钮", + "icon": "BlockIcons/4-3.png", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.HandleJavascriptDialogControl, ShadowBot.Shell.Development", + "function": "xbot_visual.web.browser.handle_javascript_dialog", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/对话框处理/处理网页对话框.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.HandleJavascriptDialogHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "dialog_result", + "label": "对话框按钮", + "required": true, + "default": "10:OK", + "defaultDisplay": "确定", + "tips": "当网页对话框出现时要点击的按钮", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "确定", + "value": "OK" + }, + { + "display": "取消", + "value": "Cancle" + } + ] + } + }, + { + "name": "text", + "label": "输入内容", + "tips": "如果是支持输入的对话框出现时,可以在此填写要输入的内容", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "wait_appear_timeout", + "label": "等待对话框出现(秒)", + "required": true, + "default": "10:20", + "category": "advanced", + "tips": "等待网页对话框出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.browser.get_details", + "title": "获取网页信息", + "description": "获取网页标题、网址、源代码、文本等信息", + "comment": "%operation%,目标网页为%browser%,将结果保存到%webpage_attribute%", + "icon": "BlockIcons/3-1.png", + "function": "xbot_visual.web.browser.get_details", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetBrowserDetailHandler" + } + ], + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/获取网页信息.html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "operation", + "label": "操作", + "required": true, + "default": "10:url", + "defaultDisplay": "获取网址", + "tips": "选择要获取的网页信息", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "获取网址", + "value": "url" + }, + { + "display": "获取网页标题", + "value": "title" + }, + { + "display": "获取网页源代码", + "value": "html" + }, + { + "display": "获取网页文本内容", + "value": "text" + } + ] + } + } + ], + "outputs": [ + { + "id": "webpage_attribute", + "label": "存储网页信息至", + "variableLabel": "网页信息", + "tips": "指定一个变量名称,该变量用于存储获取到的网页信息", + "name": "web_page_attribute", + "type": "str" + } + ] + }, + { + "name": "web.browser.get_javascript_dialog_text", + "title": "提取网页对话框内容", + "description": "提取网页对话框内容", + "comment": "提取网页%browser%中的对话框内容,将结果保存到%dialog_text%", + "icon": "BlockIcons/3-7.png", + "function": "xbot_visual.web.browser.get_javascript_dialog_text", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/提取网页对话框内容.html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "wait_appear_timeout", + "label": "等待对话框出现(秒)", + "required": true, + "default": "10:20", + "category": "advanced", + "tips": "等待网页对话框出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "dialog_text", + "label": "存储对话框内容至", + "variableLabel": "对话框内容", + "tips": "指定一个变量名称,该变量用于存储获取到的对话框中的文字内容", + "name": "web_dialog_text", + "type": "str" + } + ] + }, + { + "name": "web.browser.start_monitor_network", + "title": "开始监听网页请求", + "description": "开始监听网页请求,根据输入的资源路径Url、资源类型, 筛选网页监听结果,可在开启后获取抓取到的信息", + "comment": "开始抓取网页%browser%中的请求信息", + "icon": "BlockIcons/3-9.png", + "keywords": "http", + "function": "xbot_visual.web.browser.start_monitor_network", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/开始监听网页请求.html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "url", + "label": "资源路径Url", + "default": "10:", + "tips": "根据输入的资源Url,筛选网页监听结果(值为空则忽略url筛选条件)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符筛选Url", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + }, + { + "name": "resource_type", + "label": "筛选资源类型", + "required": true, + "default": "10:All", + "defaultDisplay": "All", + "tips": "选择要获取的网页监听结果类型,可筛选JS,图片,文档等类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "全部", + "value": "All" + }, + { + "display": "Fetch/XHR", + "value": "Fetch|XHR" + }, + { + "display": "JS", + "value": "Script" + }, + { + "display": "CSS", + "value": "Stylesheet" + }, + { + "display": "图片", + "value": "Image" + }, + { + "display": "媒体", + "value": "Media" + }, + { + "display": "字体", + "value": "Font" + }, + { + "display": "文档", + "value": "Document" + }, + { + "display": "WebSocket", + "value": "WebSocket" + }, + { + "display": "其他", + "value": "Other" + } + ] + } + } + ] + }, + { + "name": "web.browser.get_responses", + "title": "获取网页监听结果", + "description": "获取网页监听结果,\r\n列表项键包括'url'、'type'、'headers'、'body'、'base64Encoded'、'status'、'requestHeaders'、'requestBody'、'method' ", + "comment": "获取网页%browser%监听结果列表,将结果保存到%response_body_list%", + "icon": "BlockIcons/3-11.png", + "keywords": "http", + "function": "xbot_visual.web.browser.get_responses", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.GetResponsesControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/获取网页监听结果.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetResponsesHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "url", + "label": "资源路径Url", + "default": "10:", + "tips": "根据输入的资源Url,筛选网页监听结果(值为空则忽略url筛选条件)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符筛选Url", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + }, + { + "name": "resource_type", + "label": "筛选资源类型", + "required": true, + "default": "10:All", + "defaultDisplay": "All", + "tips": "选择要获取的网页监听结果类型,可筛选JS,图片,文档等类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "All", + "value": "All" + }, + { + "display": "XHR", + "value": "XHR" + }, + { + "display": "Script", + "value": "Script" + }, + { + "display": "Stylesheet", + "value": "Stylesheet" + }, + { + "display": "Image", + "value": "Image" + }, + { + "display": "Media", + "value": "Media" + }, + { + "display": "Font", + "value": "Font" + }, + { + "display": "Document", + "value": "Document" + }, + { + "display": "WebSocket", + "value": "WebSocket" + }, + { + "display": "Manifest", + "value": "Manifest" + }, + { + "display": "TextTrack", + "value": "TextTrack" + }, + { + "display": "Fetch", + "value": "Fetch" + }, + { + "display": "EventSource", + "value": "EventSource" + }, + { + "display": "Other", + "value": "Other" + } + ] + } + } + ], + "outputs": [ + { + "id": "response_body_list", + "label": "保存网页监听结果列表至", + "tips": "指定一个变量名称,该变量用于保存获取到的网页监听结果列表,列表项键包括'url'、'type'、'body'、'base64Encoded',集合中的值可以通过比如 item['body'] 的方式获取", + "name": "response_body_list", + "type": "list" + } + ] + }, + { + "name": "web.browser.stop_monitor_network", + "title": "停止监听网页请求", + "description": "停止监听网页请求", + "comment": "结束抓取网页%browser%中的请求信息", + "icon": "BlockIcons/3-10.png", + "keywords": "http", + "function": "xbot_visual.web.browser.stop_monitor_network", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/停止监听网页请求.html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + } + ] + }, + { + "name": "web.browser.contains_element_or_text", + "statement": "workflow.if", + "title": "IF 网页包含", + "description": "检测指定的文本或元素是否出现在网页中", + "comment": "检测指定的文本或元素是否出现在网页中", + "indent": "1", + "scope": "1", + "isCondition": true, + "icon": "BlockIcons/6-4.png", + "function": "xbot_visual.web.browser.contains_element_or_text", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.ContainsElementOrTextControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/if网页包含.html", + "video": { + "time": "01:18" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.ContainsElementOrTextHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "content_type", + "label": "检测网页是否", + "required": true, + "default": "10:contains_element", + "defaultDisplay": "包含元素", + "tips": "指定你想要检测的内容类型,检测文本还是检测元素", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "包含元素", + "value": "contains_element" + }, + { + "display": "不包含元素", + "value": "not_contains_element" + }, + { + "display": "包含文本", + "value": "contains_text" + }, + { + "display": "不包含文本", + "value": "not_contains_text" + } + ] + } + }, + { + "name": "selector", + "label": "操作目标", + "required": false, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "text", + "label": "文本内容", + "required": false, + "tips": "文本内容", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "web.browser.element_display", + "statement": "workflow.if", + "title": "IF 元素可见(web)", + "description": "检测指定的元素在网页中是否可见", + "comment": "检测网页%browser%中元素%selector%在是否%content_type%", + "indent": "1", + "scope": "1", + "isCondition": true, + "icon": "BlockIcons/6-4.png", + "function": "xbot_visual.web.browser.element_display", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/if元素可见(web).html", + "video": { + "time": "01:03" + }, + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "content_type", + "label": "检测网页是否", + "required": true, + "default": "10:display", + "defaultDisplay": "可见", + "tips": "指定你想要检测的内容类型,检测元素可见还是不可见", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "可见", + "value": "display" + }, + { + "display": "不可见", + "value": "undisplay" + } + ] + } + }, + { + "name": "selector", + "label": "操作目标", + "required": false, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + } + ] + }, + { + "name": "web.browser.get_scroll", + "title": "获取滚动条位置", + "description": "获取网页或元素中滚动条的当前位置或底部位置(即滚动条长度)", + "comment": "获取网页%browser%中滚动条的%location%,将滚动条位置保存到%scroll_value%", + "icon": "BlockIcons/2-10.png", + "function": "xbot_visual.web.browser.get_scroll", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.GetScrollControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/获取滚动条位置.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetScrollControlHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "scroll_on_element", + "label": "", + "required": true, + "default": "13:False", + "tips": "获取指定元素滚动条的位置,否则为整个网页的滚动条", + "type": "bool", + "editor": { + "label": "元素滚动条", + "kind": "checkbox" + } + }, + { + "name": "element", + "label": "操作目标", + "autoFill": false, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple", + "elementType": "xbot._web.browser.WebBrowser" + } + }, + { + "name": "search_up", + "label": "", + "required": false, + "default": "13:False", + "tips": "若当前元素无滚动条,自动向上查找有滚动条元素", + "type": "bool", + "editor": { + "label": "元素无滚动条,自动向上查找", + "kind": "checkbox" + } + }, + { + "name": "direction", + "label": " 滚动条", + "required": true, + "tips": "根据实际需要选择纵向或横向滚动条", + "default": "10:vertical", + "defaultDisplay": "纵向滚动条", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "纵向滚动条", + "value": "vertical" + }, + { + "display": "横向滚动条", + "value": "horizontal" + } + ] + } + }, + { + "name": "location", + "label": "位置", + "required": true, + "tips": "当前位置为当前滚动条所在的位置与顶部的距离,底部位置为滚动条最大可滚动的长度", + "default": "10:current", + "defaultDisplay": "当前位置", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "当前位置", + "value": "current" + }, + { + "display": "底部位置", + "value": "bottom" + } + ] + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标滚动条存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "scroll_value", + "label": "保存滚动条位置至", + "variableLabel": "滚动条位置", + "tips": "指定一个变量名称,该变量用于保存获取到滚动条位置", + "name": "scroll_value", + "type": "int" + } + ] + }, + { + "name": "web.browser.wait_load_completed", + "title": "等待网页加载完成", + "description": "等待网页加载完成", + "comment": "等待网页%browser%加载完成,等待时间%load_timeout%秒", + "icon": "BlockIcons/2-9.png", + "function": "xbot_visual.web.browser.wait_load_completed", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/网页操作/等待网页加载完成.html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "load_timeout", + "label": "加载超时时间", + "required": true, + "default": "10:20", + "tips": "等待网页加载完成的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "action_after_load_timeout", + "label": "加载超时后执行", + "required": true, + "tips": "等待网页加载完成超时后希望执行的操作", + "type": "str", + "default": "10:handleExcept", + "defaultDisplay": "执行\"错误处理\"", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "执行\"错误处理\"", + "value": "handleExcept" + }, + { + "display": "停止网页加载", + "value": "stopLoad" + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/web.element.blocks.json b/src/assert/block_settings/web.element.blocks.json new file mode 100644 index 0000000..fa44336 --- /dev/null +++ b/src/assert/block_settings/web.element.blocks.json @@ -0,0 +1,3409 @@ +{ + "types": [ + { + "name": "xbot_visual._core.Rectangle", + "localName": "元素位置信息", + "props": [ + { + "name": "left", + "type": "int", + "label": "左边" + }, + { + "name": "top", + "type": "int", + "label": "顶部" + }, + { + "name": "right", + "type": "int", + "label": "右边" + }, + { + "name": "bottom", + "type": "int", + "label": "底部" + }, + { + "name": "center_x", + "type": "int", + "label": "中心点横坐标" + }, + { + "name": "center_y", + "type": "int", + "label": "中心点纵坐标" + }, + { + "name": "width", + "type": "int", + "label": "宽度" + }, + { + "name": "height", + "type": "int", + "label": "高度" + } + ] + } + ], + "blocks": [ + { + "name": "web.element.click", + "title": "点击元素(web)", + "description": "点击网页中的按钮、链接或者其他任何元素", + "comment": "在网页%browser%中,模拟人工%button%%clicks%网页元素%element%,点击%anchor_type%位置", + "icon": "BlockIcons/2-1.png", + "function": "xbot_visual.web.element.click", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.ClickElementControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/点击元素(web).html", + "video": { + "time": "04:00" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.ClickBrowserElementHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "simulate", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "注意:由于上方网页指令默认启用“运行时不抢占鼠标键盘”,需关闭后模拟人工点击才可生效。\r\n通过模拟人工点击执行操作,关闭将采用API方式执行操作。", + "type": "bool", + "editor": { + "label": "模拟人工点击", + "kind": "checkbox" + } + }, + { + "name": "move_mouse", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "是否显示鼠标移动轨迹", + "type": "bool", + "editor": { + "label": "显示鼠标移动轨迹", + "kind": "checkbox" + } + }, + { + "name": "clicks", + "label": "点击方式", + "required": true, + "default": "10:click", + "defaultDisplay": "单击", + "category": "advanced", + "tips": "选择点击的方式是单击还是双击", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单击", + "value": "click" + }, + { + "display": "双击", + "value": "dbclick" + } + ] + } + }, + { + "name": "button", + "label": "鼠标按钮", + "required": true, + "default": "10:left", + "defaultDisplay": "鼠标左键", + "category": "advanced", + "tips": "选择用于触发点击的鼠标按键", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "鼠标左键", + "value": "left" + }, + { + "display": "鼠标右键", + "value": "right" + } + ] + } + }, + { + "name": "keys", + "label": "辅助按键", + "required": true, + "default": "10:null", + "defaultDisplay": "无", + "category": "advanced", + "tips": "在点击时需要按下的键盘功能键", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "无", + "value": "null" + }, + { + "display": "Alt", + "value": "alt" + }, + { + "display": "Ctrl", + "value": "ctrl" + }, + { + "display": "Shift", + "value": "shift" + }, + { + "display": "Win", + "value": "win" + } + ] + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": true, + "tips": "支持点击元素中心位置(元素矩形区域的中心点)、随机位置(自动随机指定元素矩形范围内的点)、自定义位置(手动指定目标点)", + "type": "str", + "default": "10:center", + "category": "advanced", + "defaultDisplay": "中心点", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "default": "10:MiddleCenter", + "category": "advanced", + "label": "目标元素的部位", + "tips": "默认点击目标元素的中心位置,请根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.element.hover", + "title": "鼠标悬停在元素上(web)", + "description": "将鼠标悬停在网页中的元素上", + "keywords": "悬浮;停留", + "comment": "在网页%browser%中,模拟人工将鼠标移动在网页元素%element%上,到达位置为元素%anchor_type%", + "icon": "BlockIcons/2-2.png", + "function": "xbot_visual.web.element.hover", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.HoverElementControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/鼠标悬停在元素上(web).html", + "video": { + "time": "02:33" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.HoverBrowserElementHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "simulate", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "如果使用模拟人工悬停则通过模拟人工的方式触发悬停事件,否则将根据目标元素的自动化接口触发悬停", + "type": "bool", + "editor": { + "label": "模拟人工悬停", + "kind": "checkbox" + } + }, + { + "name": "delay_after", + "label": "延迟时间(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": true, + "tips": "支持悬停在元素中心位置、随机位置(在元素矩形范围内)、自定义位置", + "type": "str", + "default": "10:center", + "category": "advanced", + "defaultDisplay": "中心点", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "default": "10:middleCenter", + "category": "advanced", + "label": "目标元素的部位", + "tips": "默认悬停在目标元素的中心位置,请根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.element.input", + "title": "填写输入框(web)", + "description": "在网页的输入框中输入内容", + "comment": "在网页%browser%的%element%中,%input_type%%text%", + "icon": "BlockIcons/2-3.png", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.InputControl, ShadowBot.Shell.Development", + "function": "xbot_visual.web.element.input", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/填写输入框(web).html", + "video": { + "time": "06:49" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.InputBrowserHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "text", + "label": "输入内容", + "tips": "填写要输入的内容", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "append", + "label": "", + "required": true, + "default": "13:False", + "tips": "如果勾选追加输入则在现有内容后继续追加输入,否则清空现有内容后再进行输入", + "type": "bool", + "editor": { + "label": "追加输入", + "kind": "checkbox" + } + }, + { + "name": "simulate", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "如果使用模拟人工输入则通过模拟人工的方式触发输入事件,否则将根据目标元素的自动化接口触发输入", + "type": "bool", + "editor": { + "label": "模拟人工输入", + "kind": "checkbox" + } + }, + { + "name": "driver_input", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "如果使用驱动输入则通过驱动方式触发输入事件,否则将根据目标元素的自动化接口触发输入", + "type": "bool", + "editor": { + "label": "驱动输入", + "kind": "checkbox" + } + }, + { + "name": "save_to_clipboard", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "将输入内容添加到剪切板通过Ctrl+V指令将内容填写到输入框避免输入法问题", + "type": "bool", + "editor": { + "label": "剪切板输入", + "kind": "checkbox" + } + }, + { + "name": "input_type", + "label": "输入方式", + "required": true, + "tips": "注意:由于上方网页指令默认启用“运行时不抢占鼠标键盘”,需关闭后模拟人工输入才可生效。\r\n模拟人工输入: 通过模拟人工的方式触发输入事件(会自动切换当前输入法为英文输入状态, 以避免输入法造成的输入错误问题)\r\n剪切板输入: 将输入内容添加到剪切板通过Ctrl+V指令将内容填写到输入框避免输入法问题\r\n自动化接口输入: 调用元素自身实现的自动化接口输入", + "type": "str", + "default": "10:simulate", + "category": "advanced", + "defaultDisplay": "模拟人工输入", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "模拟人工输入", + "value": "simulate" + }, + { + "display": "剪切板输入", + "value": "clipboard" + }, + { + "display": "自动化接口输入", + "value": "automatic" + }, + { + "display": "驱动输入", + "value": "driver" + } + ] + } + }, + { + "name": "contains_hotkey", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "可以在输入内容中加入快捷键,如{enter}代表输入回车键", + "type": "bool", + "editor": { + "label": "输入内容包含快捷键", + "kind": "checkbox" + } + }, + { + "name": "force_ime_ENG", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "存在不常见的输入法切换英文输入状态不成功的情况\r\n需要指定强制加载美式键盘(ENG), 确保模拟输入不受中文输入法影响", + "type": "bool", + "editor": { + "label": "强制加载美式键盘(ENG)", + "kind": "checkbox" + } + }, + { + "name": "send_key_delay", + "label": "按键输入间隔(ms)", + "required": true, + "category": "advanced", + "default": "10:50", + "tips": "两次按键输入的间隔时间(对影刀浏览器该参数无效), 单位是毫秒, 为避免输入错误, 请将该值调大,最大值为1000ms", + "type": "int", + "editor": { + "kind": "spin", + "minValue": 5 + } + }, + { + "name": "focus_timeout", + "label": "焦点超时时间(ms)", + "category": "advanced", + "default": "10:1000", + "tips": "设置焦点超时时间(ms), 元素获取焦点后暂停指定时间后进行输入操作", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "click_before_input", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "在执行输入动作前,先点击元素,以便获取焦点", + "type": "bool", + "editor": { + "label": "输入前点击元素", + "kind": "checkbox" + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": false, + "tips": "支持点击元素中心位置(元素矩形区域的中心点)、随机位置(自动随机指定元素矩形范围内的点)、自定义位置(手动指定目标点)", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "default": "10:middleCenter", + "label": "鼠标点击位置", + "category": "advanced", + "tips": "该输入指令是通过(先点击输入框,后模拟键盘输入)实现的,默认点击输入框的中心位置,请根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "category": "advanced", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "category": "advanced", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标输入框存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.element.check", + "title": "设置复选框(web)", + "keywords": "勾选", + "description": "将网页中的复选框的状态设置为勾选或不勾选", + "comment": "在网页%browser%中%mode%复选框%element%", + "icon": "BlockIcons/2-4.png", + "function": "xbot_visual.web.element.check", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/元素操作/设置复选框(web).html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "mode", + "label": "操作", + "required": true, + "default": "10:check", + "defaultDisplay": "勾选", + "tips": "选择要对复选框进行的操作", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "勾选", + "value": "check" + }, + { + "display": "取消勾选", + "value": "uncheck" + }, + { + "display": "反选", + "value": "toggle" + } + ] + } + }, + { + "name": "delay_after", + "label": "延迟时间(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标复选框存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.element.select", + "title": "设置下拉框(web)", + "description": "设置网页中下拉框的选中项", + "comment": "在网页%browser%中%mode%元素%element%", + "icon": "BlockIcons/2-5.png", + "function": "xbot_visual.web.element.select", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.SetSelectOptionControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/元素操作/设置下拉框(web).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Element.SetSelectOptionHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "mode", + "label": "选择方式", + "required": true, + "default": "10:text", + "defaultDisplay": "按选项内容选择", + "tips": "选择设置选中项的依据", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "按选项内容选择", + "value": "text" + }, + { + "display": "按选项位置选择", + "value": "index" + } + ] + } + }, + { + "name": "value", + "label": "选择值", + "required": true, + "tips": "输入选项内容或者选项位置", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "match_mode", + "label": "匹配模式", + "required": false, + "default": "10:fuzzy", + "defaultDisplay": "匹配模式", + "tips": "选项内容的匹配模式, 默认是模糊匹配", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "模糊匹配", + "value": "fuzzy" + }, + { + "display": "精准匹配", + "value": "exact" + }, + { + "display": "正则匹配", + "value": "regex" + } + ] + } + }, + { + "name": "delay_after", + "label": "延迟时间(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标下拉框存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.element.input_password", + "title": "填写密码框(web)", + "description": "在网页中的密码框中输入密码", + "keywords": "输入框", + "comment": "在网页%browser%的%element%中%input_type%密码", + "icon": "BlockIcons/2-6.png", + "function": "xbot_visual.web.element.input_password", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.InputPasswordControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/元素操作/填写密码框(web).html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "text", + "label": "输入密码", + "required": true, + "tips": "填写要输入的密码", + "type": "str", + "editor": { + "kind": "password" + } + }, + { + "name": "simulate", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "如果使用模拟人工输入则通过模拟人工的方式触发输入事件,否则将根据目标元素的自动化接口触发输入", + "type": "bool", + "editor": { + "label": "模拟人工输入", + "kind": "checkbox" + } + }, + { + "name": "save_to_clipboard", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "将输入内容添加到剪切板通过Ctrl+V指令将内容填写到输入框避免输入法问题", + "type": "bool", + "editor": { + "label": "剪切板输入", + "kind": "checkbox" + } + }, + { + "name": "input_type", + "label": "输入方式", + "category": "advanced", + "required": true, + "tips": "模拟人工输入: 通过模拟人工的方式触发输入事件(会自动切换当前输入法为英文输入状态, 以避免输入法造成的输入错误问题)\r\n剪切板输入: 将输入内容添加到剪切板通过Ctrl+V指令将内容填写到输入框避免输入法问题\r\n自动化接口输入: 调用元素自身实现的自动化接口输入", + "type": "str", + "default": "10:simulate", + "defaultDisplay": "模拟人工输入", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "模拟人工输入", + "value": "simulate" + }, + { + "display": "剪切板输入", + "value": "clipboard" + }, + { + "display": "自动化接口输入", + "value": "automatic" + } + ] + } + }, + { + "name": "force_ime_ENG", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "存在不常见的输入法切换英文输入状态不成功的情况\r\n需要指定强制加载美式键盘(ENG), 确保模拟输入不受中文输入法影响", + "type": "bool", + "editor": { + "label": "强制加载美式键盘(ENG)", + "kind": "checkbox" + } + }, + { + "name": "send_key_delay", + "label": "按键输入间隔(ms)", + "required": true, + "category": "advanced", + "default": "10:50", + "tips": "两次按键输入的间隔时间(对影刀浏览器该参数无效), 单位是毫秒, 为避免输入错误, 请将该值调大,最大值为1000ms", + "type": "int", + "editor": { + "kind": "spin", + "minValue": 5 + } + }, + { + "name": "focus_timeout", + "label": "焦点超时时间(ms)", + "category": "advanced", + "default": "10:1000", + "tips": "设置焦点超时时间(ms), 元素获取焦点后暂停指定时间后进行输入操作", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "delay_after", + "label": "延迟时间(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标密码框存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "click_before_input", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "在执行输入动作前,先点击元素,以便获取焦点", + "type": "bool", + "editor": { + "label": "输入前点击元素", + "kind": "checkbox" + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": false, + "tips": "支持点击元素中心位置(元素矩形区域的中心点)、随机位置(自动随机指定元素矩形范围内的点)、自定义位置(手动指定目标点)", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "label": "鼠标点击位置", + "default": "10:middleCenter", + "category": "advanced", + "tips": "该输入指令是通过(先点击输入框,后模拟键盘输入)实现的,默认点击输入框的中心位置,请根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "web.element.set_value", + "title": "设置元素值(web)", + "description": "设置网页中元素的值,一般是input、select元素的value", + "comment": "在网页%browser%中设置%element%的值为%value%", + "icon": "BlockIcons/2-7.png", + "function": "xbot_visual.web.element.set_value", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/元素操作/设置元素值(web).html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素,若存在相似元素,则会默认选择第一个可见元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "value", + "label": "元素值", + "required": true, + "tips": "填写要设置的元素值", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.element.set_attribute", + "title": "设置元素属性(web)", + "description": "设置网页元素属性", + "comment": "在网页%browser%中设置%element%的属性%attribute_name%值为%value%", + "icon": "BlockIcons/2-8.png", + "function": "xbot_visual.web.element.set_attribute", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/元素操作/设置元素属性(web).html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "attribute_name", + "label": "属性名称", + "required": true, + "tips": "填写要设置的属性名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "value", + "label": "属性值", + "required": true, + "tips": "填写要设置的属性值", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.element.wait", + "title": "等待元素(web)", + "description": "等待网页中元素出现或消失,再执行接下来的流程", + "comment": "等待网页%browser%中元素%element%出现,最多等待%timeout%秒", + "icon": "BlockIcons/2-9.png", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.WaitElementControl, ShadowBot.Shell.Development", + "function": "xbot_visual.web.element.wait", + "helpUrl": "yddoc/language/zh-cn/指令文档/等待/等待元素(web).html", + "video": { + "time": "08:03" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.WaitBrowserElementHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "state", + "label": "等待状态", + "required": true, + "default": "10:appear", + "defaultDisplay": "等待元素出现", + "tips": "选择等待状态", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "等待元素出现", + "value": "appear" + }, + { + "display": "等待元素消失", + "value": "disappear" + } + ] + } + }, + { + "name": "iswait", + "label": "", + "required": true, + "default": "13:True", + "tips": "设置等待超时时间,超时后流程将自动往下继续执行", + "type": "bool", + "editor": { + "label": "设置超时时间", + "kind": "checkbox" + } + }, + { + "name": "timeout", + "label": "超时时间(s)", + "default": "10:20", + "tips": "设置最大等待时间", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "wait_result", + "label": "等待结果", + "tips": "如果为True则等待成功,否则等待超时", + "name": "web_wait_result", + "type": "bool" + } + ] + }, + { + "name": "web.element.get_details", + "title": "获取元素信息(web)", + "keywords": "源代码;属性值;元素位置", + "description": "获取网页中的元素的文本内容、源代码、属性值、元素位置等信息", + "comment": "%operation%,目标元素为%element%,将结果保存到%element_attribute%", + "icon": "BlockIcons/3-2.png", + "function": "xbot_visual.web.element.get_details", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/获取元素信息(web).html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.GetElementDetailsControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetElementDetailsHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple", + "elementType": "xbot._web.browser.WebBrowser" + } + }, + { + "name": "operation", + "label": "操作", + "required": true, + "default": "10:text", + "defaultDisplay": "获取元素文本内容", + "tips": "选择要获取的网页元素信息", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "获取元素文本内容", + "value": "text" + }, + { + "display": "获取元素源代码", + "value": "html" + }, + { + "display": "获取元素值", + "value": "value" + }, + { + "display": "获取网页链接地址", + "value": "href" + }, + { + "display": "获取元素属性", + "value": "other" + }, + { + "display": "获取元素位置", + "value": "bound" + } + ] + } + }, + { + "name": "absolute_url", + "label": "", + "required": true, + "default": "13:False", + "tips": "智能识别并补充地址前缀(http:// 或 https://)", + "type": "bool", + "editor": { + "label": "智能识别并补充地址前缀(http:// 或 https://)", + "kind": "checkbox" + } + }, + { + "name": "attribute_name", + "label": "属性名称", + "tips": "填写要获取的网页元素的属性名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "relative_to", + "label": "相对于", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕左上角", + "tips": "在整个屏幕中的位置还是在浏览器客户区域中的位置", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕左上角", + "value": "screen" + }, + { + "display": "浏览器页面左上角", + "value": "window" + } + ] + } + }, + { + "name": "to96dpi", + "label": "", + "required": true, + "category": "advanced", + "default": "13:True", + "tips": "是否需要将边框属性转换成与设备无关的单位 (每个单位1/96英寸)", + "type": "bool", + "editor": { + "label": "转为dpi为96对应值", + "kind": "checkbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "element_attribute", + "label": "保存元素信息至", + "variableLabel": "元素信息", + "tips": "指定一个变量名称,该变量用于保存获取到的网页元素信息", + "name": "web_element_attribute", + "type": "str" + } + ] + }, + { + "name": "web.element.get_bounding", + "title": "获取元素位置(web)", + "description": "获取元素相对于屏幕或浏览器客户区域左上角的位置信息", + "comment": "获取网页%browser%中%element%相对于%relative_to%的位置信息,将结果保存到%bound%", + "icon": "BlockIcons/3-13.png", + "function": "xbot_visual.web.element.get_bounding", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/获取元素位置(web).html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple", + "elementType": "xbot._web.browser.WebBrowser" + } + }, + { + "name": "to96dpi", + "label": "", + "required": true, + "category": "advanced", + "default": "13:True", + "tips": "是否需要将边框属性转换成与设备无关的单位 (每个单位1/96英寸)", + "type": "bool", + "editor": { + "label": "转为dpi为96对应值", + "kind": "checkbox" + } + }, + { + "name": "relative_to", + "label": "相对于", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕左上角", + "tips": "在整个屏幕中的位置还是在浏览器客户区域中的位置", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕左上角", + "value": "screen" + }, + { + "display": "浏览器页面左上角", + "value": "window" + } + ] + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "bound", + "label": "保存位置信息至", + "variableLabel": "元素位置信息", + "tips": "输入一个名称来保存元素位置信息", + "type": "xbot_visual._core.Rectangle", + "name": "bound" + } + ] + }, + { + "name": "web.element.get_element", + "title": "获取元素对象(web)", + "keywords": "CSS;XPath", + "description": "可通过捕获、CSS、XPath三种方式定位网页上的一个元素", + "comment": "获取网页%browser%中%selector%的对象,将对象保存到%element%", + "icon": "BlockIcons/3-3.png", + "function": "xbot_visual.web.element.get_element", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.GetElementControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/元素操作/获取元素对象(web).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetElementHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "select_type", + "label": "定位方式", + "required": true, + "default": "10:selector", + "defaultDisplay": "默认方式", + "tips": "指定一种定位元素的方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "默认方式", + "value": "selector" + }, + { + "display": "CSS选择器", + "value": "css_selector" + }, + { + "display": "XPath选择器", + "value": "xpath_selector" + } + ] + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "css_selector", + "label": "CSS选择器", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "xpath_selector", + "label": "XPath选择器", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_related_parent", + "label": "", + "required": true, + "default": "13:False", + "tips": "是否关联父元素", + "type": "bool", + "editor": { + "label": "关联父元素", + "kind": "checkbox" + } + }, + { + "name": "parent", + "label": "父元素", + "required": false, + "tips": "在指定的父元素内查找目标元素", + "autoFill": false, + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "element", + "label": "保存元素对象至", + "variableLabel": "元素对象", + "tips": "指定一个变量名称,该变量用于保存获取到的元素对象", + "name": "web_element", + "type": "xbot._web.element.WebElement" + } + ] + }, + { + "name": "web.element.get_all_elements", + "title": "获取相似元素列表(web)", + "statement": "workflow.getall", + "keywords": "css;xpath", + "description": "可通过捕获元素、CSS、XPath三种方式定位到网页上的一组相似元素,获取他们的对象或文本等信息", + "comment": "在网页%browser%中获取一组与元素%selector%相似的元素,将结果保存到%element_list%", + "icon": "BlockIcons/3-4.png", + "function": "xbot_visual.web.element.get_all_elements", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.GetAllElementsControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/元素操作/获取相似元素列表(web).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetAllElementsHandler", + "settings": { + "inputName": "output_with_element_count", + "outputName": "element_count" + } + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "select_type", + "label": "定位方式", + "required": true, + "default": "10:selector", + "defaultDisplay": "默认方式", + "category": "advanced", + "tips": "指定一种定位元素的方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "默认方式", + "value": "selector" + }, + { + "display": "CSS选择器", + "value": "css_selector" + }, + { + "display": "XPath选择器", + "value": "xpath_selector" + } + ] + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "css_selector", + "label": "CSS选择器", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "xpath_selector", + "label": "XPath选择器", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_related_parent", + "label": "", + "required": true, + "default": "13:False", + "tips": "是否关联父元素", + "type": "bool", + "editor": { + "label": "关联父元素", + "kind": "checkbox" + } + }, + { + "name": "parent", + "label": "父元素", + "autoFill": false, + "tips": "在指定的父元素内查找目标元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "operation", + "label": "元素操作", + "required": true, + "default": "10:element", + "defaultDisplay": "元素操作", + "tips": "获取的元素信息", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "获取元素对象", + "value": "element" + }, + { + "display": "获取元素文本内容", + "value": "text" + }, + { + "display": "获取元素值", + "value": "value" + }, + { + "display": "获取元素链接地址", + "value": "href" + }, + { + "display": "获取元素源代码", + "value": "html" + }, + { + "display": "获取元素属性", + "value": "attr" + } + ] + } + }, + { + "name": "absolute_url", + "label": "", + "default": "13:False", + "tips": "智能识别并补充地址前缀(http:// 或 https://)", + "type": "bool", + "editor": { + "label": "智能识别并补充地址前缀(http:// 或 https://)", + "kind": "checkbox" + } + }, + { + "name": "attribute_name", + "label": "属性名称", + "tips": "填写要获取的网页元素的属性名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "output_with_element_count", + "label": "", + "required": true, + "default": "13:False", + "tips": "是否输出相似元素个数", + "type": "bool", + "editor": { + "label": "输出相似元素个数", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "element_list", + "label": "保存相似元素列表至", + "variableLabel": "相似元素对象列表", + "tips": "指定一个变量名称,该变量用于保存获取到的相似元素列表", + "name": "web_element_list", + "type": "list" + }, + { + "id": "element_count", + "label": "保存相似元素个数至", + "variableLabel": "相似元素对象个数", + "tips": "指定一个变量名称,该变量用于保存获取到的相似元素个数", + "name": "web_element_count", + "type": "int" + } + ] + }, + { + "name": "web.element.screenshot", + "title": "网页截图", + "description": "对指定区域内元素进行截图,保存至文件或添加到剪切板中", + "comment": "在网页%browser%中对元素%element%进行截图,将结果保存到文件夹%folder_path%中,将存图路径保存到%screenshot_save_file_name%", + "icon": "BlockIcons/3-6.png", + "function": "xbot_visual.web.element.screenshot", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/网页截图.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.ScreenShotControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.ScreenShotHandler" + }, + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.ScreenShotOutputPathHandler", + "settings": { + "inputName": "save_to_clipboard", + "outputName": "screenshot_save_file_name" + } + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "capture_area", + "label": "截图区域", + "required": true, + "tips": "三种区域,若选择整个网页,会生成整个页面的长图", + "default": "10:Element", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "网页元素", + "value": "Element" + }, + { + "display": "网页可见区域", + "value": "ViewPort" + }, + { + "display": "整个网页", + "value": "Whole" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": false, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "folder_path", + "label": "保存文件夹", + "tips": "截图保存的文件夹", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "random_filename", + "label": "", + "required": true, + "default": "13:True", + "tips": "自动生成不重复的文件名", + "type": "bool", + "editor": { + "label": "使用自动随机文件名", + "kind": "checkbox" + } + }, + { + "name": "filename", + "label": "自定义文件名", + "tips": "自定义文件名 如: screenshot.png, 注意文件名不能包含下列任何字符: \\ / : * ? \" < > |", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "overwrite_file", + "label": "", + "default": "13:True", + "tips": "", + "type": "bool", + "editor": { + "label": "如果文件存在则覆盖", + "kind": "checkbox" + } + }, + { + "name": "save_to_clipboard", + "label": "", + "required": true, + "default": "13:False", + "tips": "保存图片至剪切板", + "type": "bool", + "editor": { + "label": "保存图片至剪切板", + "kind": "checkbox" + } + }, + { + "name": "height", + "label": "最大截图高度", + "required": false, + "tips": "设置最大截图的高度(相对于缩放100%)。用于因网页过长,导致截图失败的情况。默认值25000", + "default": "10:25000", + "type": "int", + "editor": { + "label": "最大截图高度", + "kind": "spin", + "minValue": 0, + "maxValue": 100000 + } + }, + { + "name": "piece_height", + "label": "单次截图高度", + "required": false, + "tips": "设置单次截图高度(相对于缩放100%)。对于长页面,采用分次截图再拼接来完成。可根据机器性能来调整每次截图高度,以提高截图的效率,建议每次不要超过5000", + "default": "10:3000", + "type": "int", + "editor": { + "label": "单次截图高度", + "kind": "spin", + "minValue": 0, + "maxValue": 10000 + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "设置网页截图的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "screenshot_save_file_name", + "label": "截图保存位置", + "variableLabel": "元素截图位置", + "tips": "截图文件所在的位置:文件路径+名称", + "name": "screenshot_save_file_name", + "type": "str" + } + ] + }, + { + "name": "web.element.data_scraping", + "title": "批量数据抓取", + "description": "在网页中抓取批量数据,常用于抓取列表页、详情页,同时可通过设置分页按钮抓取多页数据", + "comment": "在网页%browser%中抓取%table_element%,将结果保存到%data_table%,同时保存到数据表格", + "icon": "BlockIcons/3-5.png", + "function": "xbot_visual.web.element.data_scraping", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/批量数据抓取.html", + "video": { + "time": "12:30" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.DataScrapingControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.DataScrapingHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "table_element", + "label": "抓取目标", + "required": true, + "tips": "要抓取的表格元素", + "autoFill": false, + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "table" + } + }, + { + "name": "handle_pager", + "label": "抓取页数", + "required": true, + "default": "13:False", + "tips": "是否要处理分页,勾选后可抓取多页数据", + "type": "bool", + "editor": { + "label": "抓取多页", + "kind": "checkbox" + } + }, + { + "name": "page_element", + "label": "下一页按钮", + "required": false, + "tips": "分页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "scrape_multi_page", + "label": "", + "required": "false", + "default": "13:False", + "type": "bool", + "editor": { + "label": "", + "kind": "checkbox" + } + }, + { + "name": "max_page", + "label": "页数", + "required": false, + "default": "10:", + "tips": "要抓取的最大页数(必填)", + "type": "any", + "editor": { + "kind": "textbox", + "placeholder": "请填写要抓取的页数" + } + }, + { + "name": "page_interval", + "label": "翻页间隔(秒)", + "required": false, + "default": "10:1", + "category": "advanced", + "tips": "为了获取某些动态加载的数据,需要在抓取数据前等待其加载,\"翻页间隔\"即是在抓取数据前的等待时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "simulate_click_page", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "如果使用模拟人工点击则通过模拟人工的方式触发点击事件,否则将根据目标元素的自动化接口触发点击", + "type": "bool", + "editor": { + "label": "模拟人工点击翻页按钮", + "kind": "checkbox" + } + }, + { + "name": "scroll_to_bottom", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "抓取前会自动滚动以加载页面。可在不需要自动滚动时取消勾选", + "type": "bool", + "editor": { + "label": "自动滚到页面底部", + "kind": "checkbox" + } + }, + { + "name": "simulate_delay", + "label": "", + "required": false, + "default": "13:False", + "tips": "模拟真人在翻页操作之间随机停顿", + "category": "advanced", + "type": "bool", + "editor": { + "label": "模拟翻页停顿", + "kind": "checkbox" + } + }, + { + "name": "min_time", + "label": "最小停顿时长(秒)", + "required": false, + "tips": "指令执行完成后的最短等待时间", + "type": "int", + "default": "10:1", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "max_time", + "label": "最大停顿时长(秒)", + "required": false, + "tips": "指令执行完成后的最长等待时间", + "type": "int", + "default": "10:3", + "editor": { + "kind": "textbox", + "minValue": 1 + } + }, + { + "name": "save_to_datasheet", + "label": "", + "required": true, + "default": "13:True", + "tips": "是否将结果保存至数据表格", + "type": "bool", + "editor": { + "label": "保存至数据表格", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "data_table", + "label": "保存批量数据至", + "variableLabel": "批量数据", + "tips": "指定一个变量名称,该变量用于保存获取到的网页批量数据", + "name": "web_data_table", + "type": "list" + } + ] + }, + { + "name": "web.element.foreach_element", + "statement": "workflow.forin", + "function": "xbot_visual.web.element.iter_all_elements", + "title": "循环相似元素(web)", + "description": "依次循环网页中相似元素列表的每一项进行自动化操作", + "comment": "从网页%browser%中获取相似元素%selector%,将结果依次循环保存到%loop_item%", + "indent": "1", + "scope": "1", + "isLoop": true, + "icon": "BlockIcons/3-8.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/相似元素操作/循环相似元素(web).html", + "video": { + "time": "03:18" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.ForInControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Element.ForeachElementHandler", + "settings": { + "inputName": "output_with_index", + "outputName": "loop_index" + } + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "selector", + "label": "操作目标", + "required": true, + "tips": "选择相似元素的控件", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "operation", + "label": "元素操作", + "required": true, + "default": "10:element", + "defaultDisplay": "元素操作", + "tips": "设置循环的相似元素内容:元素对象or元素的信息,比如文本内容等", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "获取元素对象", + "value": "element" + }, + { + "display": "获取元素文本内容", + "value": "text" + }, + { + "display": "获取元素值", + "value": "value" + }, + { + "display": "获取元素链接地址", + "value": "href" + }, + { + "display": "获取元素源代码", + "value": "html" + }, + { + "display": "获取元素属性", + "value": "attr" + } + ] + } + }, + { + "name": "absolute_url", + "label": "", + "default": "13:False", + "tips": "智能识别并补充地址前缀(http:// 或 https://)", + "type": "bool", + "editor": { + "label": "智能识别并补充地址前缀(http:// 或 https://)", + "kind": "checkbox" + } + }, + { + "name": "attribute_name", + "label": "属性名称", + "tips": "填写要获取的网页元素的属性名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "超时时间(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "loop_start_index", + "label": "循环开始位置", + "required": false, + "category": "advanced", + "default": "10:0", + "tips": "循环开始位置,0表示第一项", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "loop_end_index", + "label": "循环结束位置", + "required": false, + "category": "advanced", + "default": "10:-1", + "tips": "循环结束位置,-1表示倒数第一项,结果包含结束位置的项", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "output_with_index", + "label": "", + "required": true, + "default": "13:False", + "tips": "是否输出循环项的位置", + "type": "bool", + "editor": { + "label": "输出循环项的位置", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "loop_item", + "label": "保存当前循环项至", + "variableLabel": "当前循环项的元素对象", + "tips": "指定一个变量名称,用于存储一组相似元素中的当前循环项", + "name": "web_loop_element", + "type": "xbot._web.element.WebElement" + }, + { + "id": "loop_index", + "label": "保存当前循环位置至", + "variableLabel": "当前循环项的位置", + "tips": "指定一个变量名称,用于存储一组相似元素中的当前循环项的位置", + "name": "web_loop_element_index", + "type": "int" + } + ] + }, + { + "name": "web.element.drag_to", + "title": "拖拽元素(web)", + "keywords": "拖动;滑动", + "description": "在指定的网页中将元素拖拽到指定位置", + "comment": "将元素拖拽到指定位置", + "icon": "BlockIcons/2-10.png", + "function": "xbot_visual.web.element.drag_to", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.DragElementControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/元素操作/元素拖拽(web).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.DragElementToHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple", + "elementType": "xbot._web.browser.WebBrowser" + } + }, + { + "name": "drag_way", + "label": "拖拽方式", + "required": true, + "default": "10:default", + "defaultDisplay": "拖拽至目标点", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "拖拽至目标点", + "value": "default" + }, + { + "display": "拖拽至目标元素上", + "value": "targetElement" + } + ] + } + }, + { + "name": "target_element", + "label": "操作目标", + "tips": "要操作的元素,可以从元素列表中选择一个录制好的网页元素,也可以使用动态元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "left", + "label": "X", + "default": "10:0", + "tips": "鼠标移动到的目标位置的横坐标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "top", + "label": "Y", + "default": "10:0", + "tips": "鼠标移动到的目标位置的纵坐标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "delay_after", + "label": "延迟时间(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "anchor_type", + "label": "鼠标按下位置锚点", + "required": true, + "tips": "支持鼠标在拖拽元素中心位置、随机位置(在元素矩形范围内)、自定义位置处按下", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "default": "10:middleCenter", + "label": "鼠标按下元素部位", + "tips": "默认鼠标在拖拽元素的中心位置按下,根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "move_speed", + "label": "移动速度", + "required": false, + "category": "advanced", + "default": "10:middle", + "defaultDisplay": "中速", + "tips": "选择移动鼠标的速度", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "瞬间", + "value": "instant" + }, + { + "display": "快速", + "value": "fast" + }, + { + "display": "中速", + "value": "middle" + }, + { + "display": "慢速", + "value": "slow" + } + ] + } + }, + { + "name": "release_anchor_type", + "label": "鼠标释放位置锚点", + "required": true, + "tips": "支持鼠标在拖拽至元素的中心位置、随机位置(在元素矩形范围内)、自定义位置释放", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "release_sudoku_part", + "default": "10:middleCenter", + "label": "鼠标释放元素部位", + "tips": "默认鼠标在拖拽至元素的中心位置释放,请根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "release_offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "release_offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.element.get_select_item", + "title": "获取下拉框选项(web)", + "description": "获取网页中下拉框的选项", + "comment": "获取网页%browser%中%element%的%get_way%,将结果保存到%select_items%", + "icon": "BlockIcons/2-10.png", + "function": "xbot_visual.web.element.get_select_item", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Element.GetSelectItemHandler" + } + ], + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/数据提取/获取下拉框选项(web).html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple", + "elementType": "xbot._web.browser.WebBrowser" + } + }, + { + "name": "get_way", + "label": "获取内容", + "required": true, + "default": "10:selected", + "defaultDisplay": "当前选中项", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "当前选中项", + "value": "selected" + }, + { + "display": "全部下拉项", + "value": "select_all" + } + ] + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标下拉框存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "select_items", + "label": "保存获取到的内容至", + "tips": "指定一个变量名称,用于存储获取到的下拉选项内容", + "name": "select_items", + "type": "list" + } + ] + }, + { + "name": "web.element.get_associated_elements", + "title": "获取关联元素(web)", + "keywords": "父元素;子元素;相邻元素", + "description": "在指定的网页中获取元素的关联元素(父元素、子元素、相邻元素)", + "comment": "获取网页%browser%中%element%的%associated_kind%对象,将对象保存到%web_element_result%", + "icon": "BlockIcons/2-11.png", + "function": "xbot_visual.web.element.get_associated_elements", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.GetAssociatedElementsControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/元素操作/获取关联元素(web).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.GetAssociatedElementsHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "associated_kind", + "label": "关联方式", + "required": true, + "default": "10:parent", + "defaultDisplay": "父元素", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "父元素", + "value": "parent" + }, + { + "display": "子元素", + "value": "child" + }, + { + "display": "相邻元素", + "value": "sibling" + } + ] + } + }, + { + "name": "child_access_kind", + "label": "子元素获取方式", + "default": "10:all", + "defaultDisplay": "所有子元素", + "tips": "指定子元素的获取方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "所有子元素", + "value": "all" + }, + { + "display": "指定位置的子元素", + "value": "index" + } + ] + } + }, + { + "name": "child_index", + "label": "子元素位置", + "default": "10:0", + "tips": "在父元素中的索引位置,从0开始计数", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "sibling_direction", + "label": "相邻方向", + "default": "10:next", + "defaultDisplay": "下一个相邻元素", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "上一个相邻元素", + "value": "previous" + }, + { + "display": "下一个相邻元素", + "value": "next" + } + ] + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标关联元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "web_element_result", + "label": "保存网页元素至", + "variableLabel": "网页元素", + "tips": "指定一个变量名称,该变量用于保存获取到的网页元素", + "name": "web_element_result", + "type": "xbot._web.element.WebElement" + } + ] + }, + { + "name": "web.element.upload", + "title": "上传文件", + "description": "自动完成点击上传按钮、在文件选择对话框中输入待上传文件等系列操作", + "comment": "在网页%browser%中点击%element%,在弹出的文件选择对话框中输入文件%file_name%", + "icon": "BlockIcons/4-4.png", + "function": "xbot_visual.web.element.upload", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.UploadControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/对话框处理/上传文件.html", + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "element", + "label": "上传按钮", + "required": true, + "tips": "选择要点击的上传按钮对应的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "file_name", + "label": "上传文件路径", + "required": true, + "tips": "待上传文件完整路径。若要选择多个文件,切换到Python模式下,输入文件列表,比如: [\"文件1路径\",\"文件2路径\"]", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "All Files (*.*)|*.*" + } + } + }, + { + "name": "simulate", + "label": "", + "default": "13:False", + "category": "advanced", + "tips": "如果使用模拟人工输入则通过模拟人工的方式触发输入事件,否则将根据目标元素的自动化接口触发输入", + "type": "bool", + "editor": { + "label": "模拟人工输入", + "kind": "checkbox" + } + }, + { + "name": "clipboard_input", + "label": "", + "default": "13:False", + "category": "advanced", + "tips": "将输入路径和文件名添加到剪切板, 通过Ctrl+V的方式将内容填写到上传对话框的文件名输入框中,避免输入法问题", + "type": "bool", + "editor": { + "label": "剪切板输入", + "kind": "checkbox" + } + }, + { + "name": "input_type", + "label": "输入方式", + "required": true, + "tips": "自动化接口输入: 调用文件名输入框自身实现的自动化接口输入\r\n剪切板输入: 将输入路径和文件名添加到剪切板, 通过Ctrl+V的方式将内容填写到上传对话框的文件名输入框中,避免输入法问题\r\n模拟人工输入: 如果使用模拟人工输入则通过模拟人工的方式触发输入事件(会自动切换当前输入法为英文输入状态, 以避免输入法造成的输入错误问题),否则将根据目标元素的自动化接口触发输入", + "type": "str", + "default": "10:automatic", + "defaultDisplay": "自动化接口输入", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "自动化接口输入", + "value": "automatic" + }, + { + "display": "剪切板输入", + "value": "clipboard" + }, + { + "display": "模拟人工输入", + "value": "simulate" + } + ] + } + }, + { + "name": "wait_dialog_appear_timeout", + "label": "等待对话框出现(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "点击上传按钮后,等待上传对话框出现的超时时间,单位(秒)", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "force_ime_ENG", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "存在不常见的输入法切换英文输入状态不成功的情况\r\n需要指定强制加载美式键盘(ENG), 确保模拟输入不受中文输入法影响", + "type": "bool", + "editor": { + "label": "强制加载美式键盘(ENG)", + "kind": "checkbox" + } + }, + { + "name": "send_key_delay", + "label": "按键输入间隔(ms)", + "required": true, + "category": "advanced", + "default": "10:50", + "tips": "两次按键输入的间隔时间(仅模拟输入有效, 对影刀浏览器该参数无效), 单位是毫秒, 为避免输入错误, 请将该值调大,最大值为1000ms", + "type": "int", + "editor": { + "kind": "spin", + "minValue": 5 + } + }, + { + "name": "focus_timeout", + "label": "焦点超时时间(ms)", + "category": "advanced", + "default": "10:1000", + "tips": "设置焦点超时时间,单位(毫秒)", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "web.element.download", + "title": "下载文件", + "description": "自动完成点击下载按钮、在文件保存对话框中输入保存文件信息等系列操作", + "comment": "在网页%browser%中点击%download_button%下载,保存到路径%filename%下,最多等待%wait_complete_timeout%秒直到下载完成,将文件路径保存到%download_file_name%", + "icon": "BlockIcons/4-5.png", + "function": "xbot_visual.web.element.download", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Web.DownloadControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/网页自动化/对话框处理/下载文件.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Web.DownloadHandler" + } + ], + "inputs": [ + { + "name": "browser", + "label": "网页对象", + "required": true, + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "scene", + "label": "下载场景", + "required": true, + "default": "10:Button", + "defaultDisplay": "点击下载按钮", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "点击下载按钮", + "value": "Button" + }, + { + "display": "指定下载地址", + "value": "Url" + } + ] + } + }, + { + "name": "download_button", + "label": "下载按钮", + "required": false, + "tips": "选择要点击的下载按钮对应的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "download_url", + "label": "下载地址", + "required": false, + "tips": "需要下载的请求地址", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "file_folder", + "label": "保存文件夹", + "required": true, + "tips": "保存下载文件的文件夹", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder", + "filter": "All Files (*.*)|*.*" + } + } + }, + { + "name": "use_custom_filename", + "label": "是否自定文件名", + "required": true, + "default": "13:False", + "tips": "是否自定义保存文件名,不勾选则使用默文件名", + "type": "bool", + "editor": { + "label": "是否自定义保存文件名", + "kind": "checkbox" + } + }, + { + "name": "file_name", + "label": "保存文件名", + "required": false, + "tips": "自定义保存的文件名", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "wait_complete", + "label": "是否等待下载完成", + "required": true, + "default": "13:True", + "tips": "若是,会在最大超时时间内一直等待,直到文件下载完成", + "type": "bool", + "editor": { + "label": "是否等待下载完成", + "kind": "checkbox" + } + }, + { + "name": "wait_complete_timeout", + "label": "超时时间(s)", + "required": false, + "default": "10:300", + "tips": "等待下载超时时间,单位(秒)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "simulate", + "label": "", + "default": "13:False", + "category": "advanced", + "tips": "如果使用模拟人工输入则通过模拟人工的方式触发输入事件,否则将根据目标元素的自动化接口触发输入", + "type": "bool", + "editor": { + "label": "模拟人工输入", + "kind": "checkbox" + } + }, + { + "name": "clipboard_input", + "label": "", + "default": "13:False", + "category": "advanced", + "tips": "将输入路径和文件名添加到剪切板, 通过Ctrl+V的方式将内容填写到上传对话框的文件名输入框中,避免输入法问题", + "type": "bool", + "editor": { + "label": "剪切板输入", + "kind": "checkbox" + } + }, + { + "name": "input_type", + "label": "输入方式", + "required": true, + "tips": "自动化接口输入: 调用文件名输入框自身实现的自动化接口输入\r\n剪切板输入: 将输入路径和文件名添加到剪切板, 通过Ctrl+V的方式将内容填写到上传对话框的文件名输入框中,避免输入法问题\r\n模拟人工输入: 如果使用模拟人工输入则通过模拟人工的方式触发输入事件(会自动切换当前输入法为英文输入状态, 以避免输入法造成的输入错误问题),否则将根据目标元素的自动化接口触发输入", + "type": "str", + "default": "10:automatic", + "defaultDisplay": "自动化接口输入", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "自动化接口输入", + "value": "automatic" + }, + { + "display": "剪切板输入", + "value": "clipboard" + }, + { + "display": "模拟人工输入", + "value": "simulate" + } + ] + } + }, + { + "name": "wait_dialog_appear_timeout", + "label": "等待对话框出现(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "点击上传按钮后,等待上传对话框出现的超时时间,单位(秒)", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "force_ime_ENG", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "存在不常见的输入法切换英文输入状态不成功的情况\r\n需要指定强制加载美式键盘(ENG), 确保模拟输入不受中文输入法影响", + "type": "bool", + "editor": { + "label": "强制加载美式键盘(ENG)", + "kind": "checkbox" + } + }, + { + "name": "send_key_delay", + "label": "按键输入间隔(ms)", + "required": true, + "category": "advanced", + "default": "10:50", + "tips": "两次按键输入的间隔时间(仅模拟输入有效), 单位是毫秒, 为避免输入错误, 请将该值调大,最大值为1000ms", + "type": "int", + "editor": { + "kind": "spin", + "minValue": 5 + } + }, + { + "name": "focus_timeout", + "label": "焦点超时时间(ms)", + "category": "advanced", + "default": "10:1000", + "tips": "设置焦点超时时间,单位(毫秒)", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "download_file_name", + "label": "文件保存位置", + "tips": "下载文件所在的位置:文件路径+名称", + "name": "download_file_name", + "type": "str" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/web.service.blocks.json b/src/assert/block_settings/web.service.blocks.json new file mode 100644 index 0000000..fc657c3 --- /dev/null +++ b/src/assert/block_settings/web.service.blocks.json @@ -0,0 +1,2135 @@ +{ + "types": [ + { + "name": "xbot_visual.web_service.HttpResponse", + "localName": "HTTP请求结果", + "props": [ + { + "name": "status_code", + "type": "int", + "label": "HTTP状态码" + }, + { + "name": "headers", + "type": "dict", + "label": "HTTP响应头" + }, + { + "name": "body", + "type": "str", + "label": "HTTP响应体" + } + ] + }, + { + "name": "xbot_visual_web_service_rest_response", + "localName": "HTTP请求结果", + "pythonName": "xbot_visual._core.xbot_visual_web_service_rest_response", + "props": [ + { + "name": "status_code", + "type": "int", + "label": "状态码" + }, + { + "name": "content_type", + "type": "str", + "label": "内容类型" + }, + { + "name": "content_encoding", + "type": "str", + "label": "内容编码" + }, + { + "name": "content", + "type": "str", + "label": "响应内容" + } + ] + } + ], + "blocks": [ + { + "name": "web_service.http_request", + "icon": "BlockIcons/34-1.png", + "description": "Http 请求", + "comment": "使用%method%方法请求%url%网页,将请求结果保存到%http_response%", + "title": "Http 请求", + "function": "xbot_visual.web_service.http_request", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/http/http请求.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.WebService.HttpRequest, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WebService.HttpRequestHandler" + } + ], + "inputs": [ + { + "name": "url", + "label": "网址", + "required": true, + "tips": "输入目标网址", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "method", + "label": "方法", + "required": true, + "default": "10:GET", + "defaultDisplay": "GET", + "tips": "选择目标网页的操作方法", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "GET", + "value": "GET" + }, + { + "display": "POST", + "value": "POST" + }, + { + "display": "CONNECT", + "value": "CONNECT" + }, + { + "display": "HEAD", + "value": "HEAD" + }, + { + "display": "PUT", + "value": "PUT" + }, + { + "display": "DELETE", + "value": "DELETE" + }, + { + "display": "OPTIONS", + "value": "OPTIONS" + }, + { + "display": "TRACE", + "value": "TRACE" + }, + { + "display": "PATCH", + "value": "PATCH" + } + ] + } + }, + { + "name": "accept", + "label": "Accept", + "required": true, + "default": "10:text/html", + "defaultDisplay": "text/html", + "tips": "设置HTTP协议头的Accept字段值", + "type": "str", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "content_type", + "label": "Content Type", + "required": true, + "default": "10:text/html", + "defaultDisplay": "text/html", + "tips": "设置HTTP协议头的Content-Type字段值", + "type": "str", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "custom_headers", + "label": "自定义协议头", + "required": false, + "tips": "自定义协议头,多行,每行格式为“协议头名称:协议头内容”", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "request_body", + "label": "自定义协议体", + "required": false, + "tips": "自定义协议体,填写待发送到服务器的内容", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "return_data_save_way", + "label": "返回数据保存方式", + "required": true, + "default": "10:save_to_variable", + "defaultDisplay": "保存到变量(网页)", + "tips": "选择返回数据保存方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "保存到变量(网页)", + "value": "save_to_variable" + }, + { + "display": "保存到硬盘(文件)", + "value": "save_to_disk" + } + ] + } + }, + { + "name": "file_save_way", + "label": "文件保存方式", + "required": false, + "default": "10:specify_folder", + "defaultDisplay": "指定保存目录(保留原始文件名)", + "tips": "选择返回数据保存方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "指定保存目录(保留原始文件名)", + "value": "specify_folder" + }, + { + "display": "指定全路径(保存目录+文件名)", + "value": "specify_full_path" + } + ] + } + }, + { + "name": "folder_save_path", + "label": "保存到目录", + "required": false, + "tips": "输入保存路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "file_save_path", + "label": "保存到文件", + "required": false, + "tips": "输入保存路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile" + } + } + }, + { + "name": "connect_timeout_seconds", + "label": "连接超时秒数", + "required": true, + "default": "10:30", + "category": "advanced", + "tips": "输入连接超时秒数", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "follow_redirection", + "label": "", + "required": true, + "category": "advanced", + "tips": "是否支持网页重定向", + "type": "bool", + "default": "13:True", + "editor": { + "label": "重定向", + "kind": "checkbox" + } + }, + { + "name": "fail_on_error_status", + "label": "", + "required": true, + "category": "advanced", + "tips": "是否失败时抛出异常", + "type": "bool", + "default": "13:False", + "editor": { + "label": "失败时抛出异常", + "kind": "checkbox" + } + }, + { + "name": "encode_request_body", + "label": "", + "required": true, + "category": "advanced", + "tips": "是否编码协议体", + "type": "bool", + "default": "13:False", + "editor": { + "label": "编码协议体", + "kind": "checkbox" + } + }, + { + "name": "user_agent", + "label": "User Agent", + "required": true, + "category": "advanced", + "default": "10:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Chrome/5.0.355.0 Safari/533.3", + "defaultDisplay": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Chrome/5.0.355.0 Safari/533.3", + "tips": "设置HTTP协议头的User Agent字段值", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6", + "value": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6" + }, + { + "display": "Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)", + "value": "Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)" + }, + { + "display": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Chrome/5.0.355.0 Safari/533.3", + "value": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Chrome/5.0.355.0 Safari/533.3" + }, + { + "display": "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7", + "value": "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7" + } + ] + } + }, + { + "name": "encoding", + "label": "返回数据编码格式", + "required": true, + "category": "advanced", + "default": "10:utf-8", + "defaultDisplay": "utf-8", + "tips": "设置HTTP协议头的User Agent字段值", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "自动检测", + "value": "Auto-detect" + }, + { + "display": "utf-8", + "value": "utf-8" + }, + { + "display": "gb2312", + "value": "gb2312" + }, + { + "display": "big5", + "value": "big5" + } + ] + } + }, + { + "name": "http_authentication", + "label": "", + "required": false, + "category": "advanced", + "tips": "HTTP 验证", + "type": "bool", + "default": "13:False", + "editor": { + "label": "HTTP 验证", + "kind": "checkbox" + } + }, + { + "name": "user_name", + "label": "用户名", + "required": false, + "category": "advanced", + "tips": "输入用户名", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "password", + "label": "密码", + "required": false, + "category": "advanced", + "tips": "输入密码", + "type": "str", + "editor": { + "kind": "password" + } + } + ], + "outputs": [ + { + "id": "http_response", + "label": "保存响应文件头到", + "tips": "指定一个变量名称,该变量用于存储响应协议头", + "name": "http_response", + "type": "xbot_visual.web_service.HttpResponse" + } + ] + }, + { + "name": "web_service.http_download", + "icon": "BlockIcons/34-2.png", + "description": "Http 下载", + "comment": "使用%method%方法向%url%网址发起下载请求,将结果保存到%file_instance%", + "title": "Http 下载", + "function": "xbot_visual.web_service.http_download", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/http/http下载.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.WebService.HttpDownload, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WebService.HttpDownloadHandler" + } + ], + "inputs": [ + { + "name": "url", + "label": "网址", + "required": true, + "tips": "输入目标网址", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "method", + "label": "方法", + "required": true, + "default": "10:GET", + "defaultDisplay": "GET", + "tips": "选择目标网页的操作方法", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "GET", + "value": "GET" + }, + { + "display": "POST", + "value": "POST" + } + ] + } + }, + { + "name": "post_parameters", + "label": "Post 参数", + "required": false, + "tips": "Post 参数", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "return_data_save_way", + "label": "返回数据保存方式", + "required": true, + "default": "10:save_to_variable", + "defaultDisplay": "保存到变量(网页)", + "tips": "选择返回数据保存方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "保存到变量(网页)", + "value": "save_to_variable" + }, + { + "display": "保存到硬盘(文件)", + "value": "save_to_disk" + } + ] + } + }, + { + "name": "file_save_way", + "label": "文件保存方式", + "required": false, + "default": "10:specify_folder", + "defaultDisplay": "指定保存目录(保留原始文件名)", + "tips": "选择返回数据保存方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "指定保存目录(保留原始文件名)", + "value": "specify_folder" + }, + { + "display": "指定全路径(保存目录+文件名)", + "value": "specify_full_path" + } + ] + } + }, + { + "name": "folder_save_path", + "label": "保存到目录", + "required": false, + "tips": "输入保存路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "file_save_path", + "label": "文件保存路径", + "required": false, + "tips": "输入保存路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile" + } + } + }, + { + "name": "connect_timeout_seconds", + "label": "连接超时秒数", + "required": true, + "default": "10:30", + "category": "advanced", + "tips": "输入连接超时秒数", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "follow_redirection", + "label": "", + "required": true, + "category": "advanced", + "tips": "是否支持网页重定向", + "type": "bool", + "default": "13:True", + "editor": { + "label": "重定向", + "kind": "checkbox" + } + }, + { + "name": "user_agent", + "label": "User Agent", + "required": true, + "category": "advanced", + "default": "10:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Chrome/5.0.355.0 Safari/533.3", + "defaultDisplay": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Chrome/5.0.355.0 Safari/533.3", + "tips": "设置HTTP协议头的User Agent字段值", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6", + "value": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6" + }, + { + "display": "Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)", + "value": "Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)" + }, + { + "display": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Chrome/5.0.355.0 Safari/533.3", + "value": "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.3 (KHTML, like Gecko) Chrome/5.0.355.0 Safari/533.3" + }, + { + "display": "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7", + "value": "Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ) AppleWebKit/531.22.7 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7" + } + ] + } + }, + { + "name": "encoding", + "label": "返回数据编码格式", + "required": true, + "category": "advanced", + "default": "10:utf-8", + "defaultDisplay": "utf-8", + "tips": "设置HTTP协议头的User Agent字段值", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "自动检测", + "value": "Auto-detect" + }, + { + "display": "utf-8", + "value": "utf-8" + }, + { + "display": "gb2312", + "value": "gb2312" + }, + { + "display": "big5", + "value": "big5" + } + ] + } + }, + { + "name": "http_authentication", + "label": "", + "required": false, + "category": "advanced", + "tips": "HTTP 验证", + "type": "bool", + "default": "13:False", + "editor": { + "label": "HTTP 验证", + "kind": "checkbox" + } + }, + { + "name": "user_name", + "label": "用户名", + "required": false, + "category": "advanced", + "tips": "输入用户名", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "password", + "label": "密码", + "required": false, + "category": "advanced", + "tips": "输入密码", + "type": "str", + "editor": { + "kind": "password" + } + } + ], + "outputs": [ + { + "id": "file_instance", + "label": "保存下载的文件到", + "tips": "指定一个变量名称,该变量用于存储下载的文件内容", + "name": "file_instance", + "type": "str" + } + ] + }, + { + "name": "web_service.send_dingtalk_msg", + "icon": "BlockIcons/33-2.png", + "description": "发送内容至钉钉群", + "comment": "发送内容至钉钉群", + "title": "钉钉群通知", + "function": "xbot_visual.web_service.send_dingtalk_msg", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.WebService.SendDingTalkMsgControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/企业群通知/钉钉群通知.html", + "inputs": [ + { + "name": "webhook", + "label": "机器人地址", + "required": true, + "tips": "机器人的网络地址, 即webhook, 需要自行申请", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "secret", + "label": "密钥", + "required": true, + "tips": "机器人安全设置页面,加签一栏下面显示的SEC开头的字符串", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "msgtype", + "label": "消息格式类型", + "required": true, + "default": "10:text", + "defaultDisplay": "文本类型", + "tips": "消息类型及数据格式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "文本类型", + "value": "text" + }, + { + "display": "markdown类型", + "value": "markdown" + } + ] + } + }, + { + "name": "text_content", + "label": "文本内容", + "tips": "文本内容", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "markdown_text", + "label": "markdown内容", + "tips": "markdown格式的消息", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "at_mobiles", + "label": "@某人", + "tips": "填写需@成员所绑定的手机号码。多个成员时需切换为 Python 模式后输入号码列表,如['手机号1','手机号2']", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "135xxxxxxxx" + } + }, + { + "name": "is_at_all", + "tips": "@所有人", + "type": "bool", + "default": "13:False", + "editor": { + "kind": "checkbox", + "label": "@所有人" + } + } + ] + }, + { + "name": "web_service.send_wxwork_msg", + "icon": "BlockIcons/33-1.png", + "description": "发送内容至企业微信群", + "keywords": "企微", + "comment": "发送内容至企业微信群", + "title": "企业微信群通知", + "function": "xbot_visual.web_service.send_wxwork_msg", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/企业群通知/企业微信群通知.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.WebService.SendWXWorkMsgControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "webhook", + "label": "机器人地址", + "required": true, + "tips": "机器人的网络地址, 即webhook, 需要自行申请", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "msgtype", + "label": "消息格式类型", + "required": true, + "default": "10:text", + "defaultDisplay": "文本类型", + "tips": "消息类型及数据格式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "文本类型", + "value": "text" + }, + { + "display": "markdown类型", + "value": "markdown" + }, + { + "display": "文件类型", + "value": "file" + }, + { + "display": "图片类型", + "value": "image" + } + ] + } + }, + { + "name": "text_content", + "label": "文本内容", + "tips": "文本内容,最长不超过2048个字节", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "markdown_content", + "label": "markdown内容", + "tips": "markdown内容,最长不超过4096个字节", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "file_path", + "label": "文件路径", + "tips": "要求文件大小在5B~20M之间", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件(*.*)|*.*" + } + } + }, + { + "name": "image_file_path", + "label": "图片路径", + "tips": "最大不能超过2M,支持JPG,PNG格式", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.png)|*.jpg;*.png" + } + } + }, + { + "name": "at_mobiles", + "label": "@某人", + "tips": "填写需@成员所绑定的手机号码。多个成员时需切换为 Python 模式后输入号码列表,如['手机号1','手机号2']", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "135xxxxxxxx" + } + }, + { + "name": "is_at_all", + "tips": "@所有人", + "type": "bool", + "default": "13:False", + "editor": { + "kind": "checkbox", + "label": "@所有人" + } + } + ] + }, + { + "name": "web_service.send_feishu_msg", + "icon": "BlockIcons/33-3.png", + "description": "发送内容至飞书群", + "comment": "发送内容至飞书群", + "title": "飞书群通知", + "function": "xbot_visual.web_service.send_feishu_msg", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/企业群通知/飞书群通知.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.WebService.SendFeiShuMsgControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WebService.SendFeiShuMsgHandler" + } + ], + "inputs": [ + { + "name": "webhook", + "label": "机器人地址", + "required": true, + "tips": "机器人的网络地址, 即webhook, 需要自行申请", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "secret", + "label": "签名校验", + "tips": "机器人安全设置中的签名校验,如果没设置签名校验,则不需要输入", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "msgtype", + "label": "消息格式类型", + "required": true, + "default": "10:text", + "defaultDisplay": "文本类型", + "tips": "消息类型及数据格式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "文本类型", + "value": "text" + }, + { + "display": "图片类型", + "value": "image" + }, + { + "display": "富文本类型", + "value": "post" + }, + { + "display": "消息卡片类型", + "value": "interactive" + } + ] + } + }, + { + "name": "text_content", + "label": "文本内容", + "tips": "文本内容", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "app_id", + "label": "app_id", + "tips": "用于获取tenant_access_token,请在使用文档中查看如何获取,在富文本消息和消息卡片中,如果不包含图片或者不需要通过电话或邮箱@用户,则不需要输入", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "app_secret", + "label": "app_secret", + "tips": "用于获取tenant_access_token,请在使用说明中查看如何获取,在发送富文本消息和消息卡片中,如果不包含图片或者不需要通过电话或邮箱@用户,则不需要输入", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_file_path", + "label": "图片路径", + "tips": "最大不能超过10M,支持JPG,PNG格式", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.png)|*.jpg;*.png" + } + } + }, + { + "name": "post_content", + "label": "富文本内容", + "tips": "富文本内容,格式内容请查看使用说明文档", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "interactive_content", + "label": "消息卡片内容", + "tips": "消息卡片内容,格式内容请查看使用说明文档", + "type": "str", + "editor": { + "kind": "memoedit" + } + } + ] + }, + { + "name": "web_service.rest_request", + "icon": "BlockIcons/34-1.png", + "description": "Http 请求", + "comment": "使用%method%方法请求%url%,将结果保存到%http_response%", + "title": "Http 请求", + "function": "xbot_visual.web_service.rest_request", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/http/http请求.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.WebService.RestRequest, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WebService.RestRequestHandler" + } + ], + "inputs": [ + { + "name": "url", + "label": "URL", + "required": true, + "tips": "请输入请求地址", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "method", + "label": "方法", + "required": true, + "default": "10:GET", + "defaultDisplay": "GET", + "tips": "选择操作方法", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "GET", + "value": "GET" + }, + { + "display": "POST", + "value": "POST" + }, + { + "display": "CONNECT", + "value": "CONNECT" + }, + { + "display": "HEAD", + "value": "HEAD" + }, + { + "display": "PUT", + "value": "PUT" + }, + { + "display": "DELETE", + "value": "DELETE" + }, + { + "display": "OPTIONS", + "value": "OPTIONS" + }, + { + "display": "TRACE", + "value": "TRACE" + }, + { + "display": "PATCH", + "value": "PATCH" + } + ] + } + }, + { + "name": "headers", + "label": "协议头", + "required": false, + "tips": "协议头,多行,每行格式为“协议头名称:协议头内容”", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "body", + "label": "协议体", + "required": false, + "tips": "协议体,填写待发送到服务器的内容", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "save_to_file", + "label": "响应结果保存到文件", + "required": false, + "category": "advanced", + "default": "13:False", + "tips": "将响应结果保存到文本中", + "type": "bool", + "editor": { + "label": "响应结果保存到文件", + "kind": "checkbox" + } + }, + { + "name": "save_folder", + "label": "文件保存目录", + "required": false, + "category": "advanced", + "tips": "输入要保存到文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "save_filename", + "label": "文件名称", + "required": false, + "category": "advanced", + "tips": "输入要保存到的文件名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "connect_timeout_seconds", + "label": "连接超时秒数", + "required": true, + "default": "10:30", + "category": "advanced", + "tips": "输入连接超时秒数", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "send_by_web", + "label": "通过网页发送Http请求", + "required": false, + "category": "advanced", + "default": "13:False", + "tips": "适用场景:请求需要认证信息才可以发送成功。请选择已完成认证的相应网页", + "type": "bool", + "editor": { + "label": "通过网页发送Http请求", + "kind": "checkbox" + } + }, + { + "name": "browser", + "label": "网页对象", + "required": false, + "category": "advanced", + "tips": "输入一个通过\"获取已打开网页对象\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + } + ], + "outputs": [ + { + "id": "http_response", + "label": "保存响应结果到", + "tips": "指定一个变量名称,该变量用于存储响应信息", + "name": "http_response", + "type": "xbot_visual_web_service_rest_response" + } + ] + }, + { + "name": "web_service.download", + "icon": "BlockIcons/34-2.png", + "description": "Http 下载", + "comment": "向%url%发起下载请求,将下载文件保存到文件夹%save_folder%中,使用默认文件名,将下载文件名保存到%http_dowload_filename%", + "title": "Http 下载", + "function": "xbot_visual.web_service.download", + "helpUrl": "yddoc/language/zh-cn/指令文档/其他/http/http下载.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.WebService.Download, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WebService.DownloadHandler" + } + ], + "inputs": [ + { + "name": "url", + "label": "下载地址", + "required": true, + "tips": "请输入下载地址", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "save_folder", + "label": "文件保存目录", + "required": false, + "tips": "输入要保存到文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "custom_filename", + "label": "指定文件名", + "required": false, + "default": "13:False", + "tips": "若不指定,用默认文件名。若没有默认文件名会抛异常", + "type": "bool", + "editor": { + "label": "指定文件名", + "kind": "checkbox" + } + }, + { + "name": "save_filename", + "label": "文件名称", + "required": false, + "tips": "输入要保存到的文件名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "wait_complete_timeout", + "label": "超时时间(秒)", + "required": true, + "default": "10:300", + "tips": "等待下载超时时间,单位(秒)", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "connect_timeout_seconds", + "label": "连接超时秒数", + "required": true, + "default": "10:30", + "category": "advanced", + "tips": "输入连接超时秒数", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "send_by_web", + "label": "通过网页发送Http请求", + "required": false, + "default": "13:False", + "category": "advanced", + "tips": "适用场景:请求需要认证信息才可以发送成功。请选择已完成认证的相应网页", + "type": "bool", + "editor": { + "label": "通过网页发送Http请求", + "kind": "checkbox" + } + }, + { + "name": "browser", + "label": "网页对象", + "required": false, + "category": "advanced", + "tips": "输入一个通过\"获取已打开网页对象\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + } + ], + "outputs": [ + { + "id": "http_dowload_filename", + "label": "保存下载文件名称到", + "tips": "指定一个变量名称,该变量用于存储保存下载文件名称(包括路径)", + "name": "http_download_filename", + "type": "str" + } + ] + }, + { + "name": "web_service.captcha", + "icon": "BlockIcons/23-1.png", + "description": "基于图鉴网络科技提供的验证码识别服务", + "comment": "提取%image_source%中类型为%captcha_type%的验证码信息", + "title": "验证码识别", + "function": "xbot_visual.web_service.captcha", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.WebService.CaptchaControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/ocr/验证码识别.html", + "inputs": [ + { + "name": "username", + "label": "用户名", + "required": true, + "tips": "需要在图鉴网络科技官网注册申请, 具体操作详见使用说明", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "password", + "label": "密码", + "required": true, + "tips": "需要在图鉴网络科技官网注册申请, 具体操作详见使用说明", + "type": "str", + "editor": { + "kind": "password" + } + }, + { + "name": "captcha_type", + "label": "验证码类型", + "required": true, + "default": "10:3", + "defaultDisplay": "数英混合", + "tips": "请选择要识别的验证码类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "数英混合", + "value": "3" + }, + { + "display": "问答题", + "value": "66" + }, + { + "display": "计算题", + "value": "11" + }, + { + "display": "快速计算题", + "value": "1005" + }, + { + "display": "单缺口滑块(返回X轴坐标)", + "value": "33" + }, + { + "display": "缺口识别", + "value": "18" + }, + { + "display": "点选1个坐标", + "value": "19" + }, + { + "display": "点选3个坐标", + "value": "20" + }, + { + "display": "点选3~5个坐标", + "value": "21" + }, + { + "display": "点选5~8个坐标", + "value": "22" + }, + { + "display": "点选1~4个坐标", + "value": "27" + }, + { + "display": "图片旋转", + "value": "29" + }, + { + "display": "图片拼图", + "value": "53" + }, + { + "display": "纯数字", + "value": "1" + }, + { + "display": "纯英文", + "value": "2" + }, + { + "display": "纯数字2", + "value": "1001" + }, + { + "display": "纯英文2", + "value": "1002" + }, + { + "display": "数英混合2", + "value": "1003" + }, + { + "display": "汉字", + "value": "16" + }, + { + "display": "无感学习", + "value": "7" + }, + { + "display": "通用文字识别(证件、单据)", + "value": "32" + }, + { + "display": "描绘轨迹", + "value": "48" + } + ] + } + }, + { + "name": "image_source", + "label": "图片来源", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕指定位置", + "tips": "选择一个验证码来源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕指定位置", + "value": "screen" + }, + { + "display": "网页元素", + "value": "web_element" + }, + { + "display": "win元素", + "value": "win_element" + }, + { + "display": "剪贴板", + "value": "clipboard" + } + ] + } + }, + { + "name": "image_browser", + "label": "网页对象", + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "image_web_selector", + "label": "操作目标", + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "image_window", + "label": "窗口对象", + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "image_win_selector", + "label": "操作目标", + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "image_region_x1", + "label": "X1", + "tips": "图片左上角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_region_y1", + "label": "Y1", + "tips": "图片左上角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_region_x2", + "label": "X2", + "tips": "图片右下角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_region_y2", + "label": "Y2", + "tips": "图片右下角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "imageback_source", + "label": "背景图来源", + "default": "10:screen", + "defaultDisplay": "屏幕指定位置", + "tips": "选择一个背景图来源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕指定位置", + "value": "screen" + }, + { + "display": "网页元素", + "value": "web_element" + }, + { + "display": "win元素", + "value": "win_element" + }, + { + "display": "剪贴板", + "value": "clipboard" + } + ] + } + }, + { + "name": "imageback_browser", + "label": "网页对象", + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "imageback_web_selector", + "label": "操作目标", + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "imageback_window", + "label": "窗口对象", + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "imageback_win_selector", + "label": "操作目标", + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "imageback_region_x1", + "label": "X1", + "tips": "图片左上角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "imageback_region_y1", + "label": "Y1", + "tips": "图片左上角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "imageback_region_x2", + "label": "X2", + "tips": "图片右下角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "imageback_region_y2", + "label": "Y2", + "tips": "图片右下角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "typename", + "label": "子类型名称", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "remark", + "label": "备注字段", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "captcha_result", + "label": "保存验证码识别结果至", + "variableLabel": "验证码识别结果", + "tips": "指定一个变量名称,该变量用于保存验证码识别结果", + "name": "captcha_result", + "type": "str" + } + ] + }, + { + "name": "web_service.captcha_paid", + "icon": "BlockIcons/23-1.png", + "description": "基于AI引擎提供的验证码识别服务", + "comment": "使用%engine_type%AI引擎,识别%image_source%中类型为%captcha_type%的验证码信息,将结果保存到%captcha_result%", + "title": "验证码识别", + "function": "xbot_visual.web_service.captcha", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.WebService.CaptchaPaidControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/ocr/验证码识别.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WebService.CaptchaHandler" + } + ], + "inputs": [ + { + "name": "engine_type", + "label": "识别引擎", + "tips": "选择一个识别引擎", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "value": "shadowbot", + "display": "影刀" + }, + { + "value": "ttshitu", + "display": "图鉴" + } + ] + } + }, + { + "name": "username", + "label": "用户名", + "tips": "需要在图鉴网络科技官网注册申请, 具体操作详见使用说明", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "password", + "label": "密码", + "tips": "需要在图鉴网络科技官网注册申请, 具体操作详见使用说明", + "type": "str", + "editor": { + "kind": "password" + } + }, + { + "name": "captcha_type", + "label": "验证码类型", + "required": true, + "default": "10:3", + "defaultDisplay": "数英混合", + "tips": "请选择要识别的验证码类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "纯数字", + "value": "1" + }, + { + "display": "纯数字2", + "value": "1001" + }, + { + "display": "纯英文", + "value": "2" + }, + { + "display": "纯英文2", + "value": "1002" + }, + { + "display": "数英混合", + "value": "3" + }, + { + "display": "数英混合2", + "value": "1003" + }, + { + "display": "闪动GIF", + "value": "4" + }, + { + "display": "计算题", + "value": "11" + }, + { + "display": "快速计算题", + "value": "1005" + }, + { + "display": "通用文字识别(证件、单据)", + "value": "32" + }, + { + "display": "问答题", + "value": "66" + }, + { + "display": "图片旋转", + "value": "29" + }, + { + "display": "点选1个坐标", + "value": "19" + }, + { + "display": "点选3个坐标", + "value": "20" + }, + { + "display": "点选1~4个坐标", + "value": "27" + }, + { + "display": "点选3~5个坐标", + "value": "21" + }, + { + "display": "点选5~8个坐标", + "value": "22" + }, + { + "display": "缺口识别", + "value": "18" + }, + { + "display": "单缺口滑块(返回X轴坐标)", + "value": "33" + }, + { + "display": "图片拼图", + "value": "53" + } + ] + } + }, + { + "name": "third_party_code", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_source", + "label": "图片来源", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕指定位置", + "tips": "选择一个验证码来源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕指定位置", + "value": "screen" + }, + { + "display": "网页元素", + "value": "web_element" + }, + { + "display": "win元素", + "value": "win_element" + }, + { + "display": "剪贴板", + "value": "clipboard" + }, + { + "display": "本地文件", + "value": "image_file" + } + ] + } + }, + { + "name": "image_file", + "label": "文件路径", + "tips": "选择本地需要识别的图片文件", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.PNG)|*.png|(.JPEG)|*.jpeg|(.JPG)|*.jpg|(*.*)|*.*" + } + } + }, + { + "name": "image_browser", + "label": "网页对象", + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "image_web_selector", + "label": "操作目标", + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "image_window", + "label": "窗口对象", + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "image_win_selector", + "label": "操作目标", + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "image_region_x1", + "label": "X1", + "tips": "图片左上角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_region_y1", + "label": "Y1", + "tips": "图片左上角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_region_x2", + "label": "X2", + "tips": "图片右下角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "image_region_y2", + "label": "Y2", + "tips": "图片右下角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "imageback_source", + "label": "背景图来源", + "default": "10:screen", + "defaultDisplay": "屏幕指定位置", + "tips": "选择一个背景图来源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕指定位置", + "value": "screen" + }, + { + "display": "网页元素", + "value": "web_element" + }, + { + "display": "win元素", + "value": "win_element" + }, + { + "display": "剪贴板", + "value": "clipboard" + }, + { + "display": "本地文件", + "value": "image_file" + } + ] + } + }, + { + "name": "back_image_file", + "label": "文件路径", + "tips": "选择本地需要识别的图片文件", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "所有文件 (.PNG)|*.png|(.JPEG)|*.jpeg|(.JPG)|*.jpg|(*.*)|*.*" + } + } + }, + { + "name": "imageback_browser", + "label": "网页对象", + "tips": "输入一个获取到的或者通过\"打开网页\"创建的网页对象", + "type": "xbot._web.browser.WebBrowser", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "imageback_web_selector", + "label": "操作目标", + "tips": "选择要操作的网页元素", + "type": "xbot._web.element.WebElement", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "imageback_window", + "label": "窗口对象", + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "imageback_win_selector", + "label": "操作目标", + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "imageback_region_x1", + "label": "X1", + "tips": "图片左上角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "imageback_region_y1", + "label": "Y1", + "tips": "图片左上角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "imageback_region_x2", + "label": "X2", + "tips": "图片右下角X值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "imageback_region_y2", + "label": "Y2", + "tips": "图片右下角Y值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "typename", + "label": "子类型名称", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "is_to96dpi", + "label": "", + "required": false, + "category": "advanced", + "default": "13:False", + "tips": "是否需要将位置信息值转换成与设备无关的单位 (每个单位1/96英寸)", + "type": "bool", + "editor": { + "label": "转为dpi为96对应值", + "kind": "checkbox" + } + }, + { + "name": "remark", + "label": "备注字段", + "tips": "", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "captcha_result", + "label": "保存验证码识别结果至", + "variableLabel": "验证码识别结果", + "tips": "指定一个变量名称,该变量用于保存验证码识别结果", + "name": "captcha_result", + "type": "str" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/win32.blocks.json b/src/assert/block_settings/win32.blocks.json new file mode 100644 index 0000000..8ee84cf --- /dev/null +++ b/src/assert/block_settings/win32.blocks.json @@ -0,0 +1,808 @@ +{ + "types": [ + { + "name": "xbot.win32.window.Win32Window", + "localName": "窗口对象", + "methods": [ + { + "display": "该窗口的标题", + "function": "$0.get_detail('title')", + "type": "str" + }, + { + "display": "该窗口的进程名称", + "function": "$0.get_detail('process_name')", + "type": "str" + } + ] + } + ], + "blocks": [ + { + "name": "win32.manual_motion_on", + "title": "开启模拟真人操作", + "description": "一次对多个鼠标操作指令用模拟真人的操作习惯运行(从开启到结束区间内的指令)", + "comment": "开启仿真操作,区间内的所有鼠标操作指令将依据设置,模拟真人操作习惯运行", + "icon": "BlockIcons/manual_motion_on.png", + "indent": "1", + "scope": "1", + "canDebug": false, + "function": "xbot_visual.win32.manual_motion_on", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/开启模拟真人操作.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.ManualMotionOnControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "motion_move", + "label": "", + "required": true, + "default": "13:True", + "tips": "模拟真人按随机路线和速度移动鼠标", + "type": "bool", + "editor": { + "label": "仿真移动鼠标", + "kind": "checkbox" + } + }, + { + "name": "motion_click", + "label": "", + "default": "13:True", + "tips": "模拟真人在随机位置点击元素", + "type": "bool", + "editor": { + "label": "仿真点击元素", + "kind": "checkbox" + } + }, + { + "name": "motion_delay", + "label": "", + "default": "13:False", + "tips": "模拟真人在操作之间随机停顿", + "type": "bool", + "editor": { + "label": "仿真操作停顿", + "kind": "checkbox" + } + }, + { + "name": "min_time", + "label": "最小停顿时长(秒)", + "required": false, + "tips": "指令执行完成后的最短等待时间", + "type": "int", + "default": "10:1", + "editor": { + "kind": "textbox" + } + }, + { + "name": "max_time", + "label": "最大停顿时长(秒)", + "required": false, + "tips": "指令执行完成后的最长等待时间", + "type": "int", + "default": "10:3", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "win32.manual_motion_off", + "title": "结束模拟真人操作", + "description": "结束模拟真人操作", + "comment": "结束模拟真人操作", + "icon": "BlockIcons/manual_motion_off.png", + "indent": "2", + "scope": "2", + "canDebug": false, + "function": "xbot_visual.win32.manual_motion_off", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/结束模拟真人操作.html" + }, + { + "name": "win32.minimize_all", + "title": "最小化所有窗口", + "icon": "BlockIcons/1-3.png", + "comment": "最小化所有窗口", + "description": "最小化所有窗口", + "function": "xbot_visual.win32.minimize_all", + "helpUrl": "" + }, + { + "name": "win32.move_mouse", + "title": "移动鼠标", + "icon": "BlockIcons/20-5.png", + "comment": "将鼠标相对于%relative_to%%move_speed%移动到指定坐标位置(%point_x%,%point_y%)", + "description": "将鼠标移动到指定位置", + "function": "xbot_visual.win32.move_mouse", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.MoveMouseControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/移动鼠标.html", + "inputs": [ + { + "name": "point_x", + "label": "移动鼠标至 X", + "required": true, + "default": "10:0", + "tips": "鼠标移动到指定位置的坐标 ,通过快捷键Ctrl+Alt可捕获当前鼠标位置,支持在ShadowBot窗口最小化的状况下通过快捷键来输入坐标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "point_y", + "label": "移动鼠标至 Y", + "required": true, + "default": "10:0", + "tips": "鼠标移动到指定位置的坐标 ,通过快捷键Ctrl+Alt可捕获当前鼠标位置,支持在ShadowBot窗口最小化的状况下通过快捷键来输入坐标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "relative_to", + "label": "相对于", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕左上角", + "tips": "选择新鼠标位置是相对于屏幕左上角、激活窗口左上角或 运行过程中鼠标当前位置", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕左上角", + "value": "screen" + }, + { + "display": "激活窗口左上角", + "value": "currentactivatedwindow" + }, + { + "display": "运行中当前鼠标位置", + "value": "currentmouseposition" + } + ] + } + }, + { + "name": "move_speed", + "label": "移动速度", + "required": true, + "default": "10:middle", + "defaultDisplay": "中速", + "tips": "选择移动鼠标的速度", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "瞬间", + "value": "instant" + }, + { + "display": "快速", + "value": "fast" + }, + { + "display": "中速", + "value": "middle" + }, + { + "display": "慢速", + "value": "slow" + } + ] + } + }, + { + "name": "delay_after", + "label": "执行后延迟(秒)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.send_keys", + "title": "键盘输入", + "icon": "BlockIcons/20-4.png", + "keywords": "填写;填入", + "comment": "将文本内容%keys%发送给当前激活的窗口", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.SendKeysControl, ShadowBot.Shell.Development", + "description": "给当前激活窗口发送文本", + "function": "xbot_visual.win32.send_keys", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/键盘输入.html", + "inputs": [ + { + "name": "keys", + "label": "文本内容", + "required": true, + "tips": "键盘的输入可以分为两种模式,普通模式和特殊按键模式。通过勾选高级->输入内容包含特殊按键来使用特殊按键模式,不勾选则使用普通模式,默认为特殊按键模式。", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "hardware_driver_input", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "通过硬件驱动的方式输入", + "type": "bool", + "editor": { + "label": "驱动输入", + "kind": "checkbox" + } + }, + { + "name": "force_ime_eng", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "使用模拟输入时会自动切换当前输入法为英文输入状态, 以避免输入法造成的输入错误问题。存在不常见的输入法切换英文输入状态不成功的情况, 需要指定强制加载美式键盘(ENG), 确保模拟输入不受中文输入法影响, 默认值为`False`", + "type": "bool", + "editor": { + "label": "强制加载美式键盘", + "kind": "checkbox" + } + }, + { + "name": "contains_hotkey", + "label": "", + "default": "13:True", + "category": "advanced", + "tips": "特殊按键模式,即可输入特殊的按键,包括快捷键(ctrl+a等)和按键特殊操作(持续按下shift键不弹起等)。", + "type": "bool", + "editor": { + "label": "输入内容包含特殊按键(快捷键和按键特殊操作)", + "kind": "checkbox" + } + }, + { + "name": "send_key_delay", + "label": "按键输入间隔(毫秒)", + "required": true, + "category": "advanced", + "default": "10:50", + "tips": "两次按键输入的间隔时间, 单位是毫秒, 为避免输入错误, 请将该值调大,最大值为1000ms", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 5 + } + }, + { + "name": "delay_after", + "label": "执行后延迟(秒)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.click_mouse", + "title": "鼠标点击", + "keywords": "单击;双击;右键", + "icon": "BlockIcons/20-3.png", + "comment": "鼠标%button%%click_type%", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.ClickMouseControl, ShadowBot.Shell.Development", + "description": "可进行鼠标按下、弹起、单击、双击、右键点击等动作", + "function": "xbot_visual.win32.click_mouse", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/鼠标点击.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.ClickMouseHandler" + } + ], + "inputs": [ + { + "name": "is_move_mouse_before_click", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "type": "bool", + "editor": { + "label": "点击前将鼠标移动到指定位置", + "kind": "checkbox" + } + }, + { + "name": "point_x", + "label": "移动鼠标至 X", + "required": true, + "default": "10:0", + "tips": "", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "point_y", + "label": "移动鼠标至 Y", + "required": true, + "default": "10:0", + "tips": "", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "relative_to", + "label": "相对于", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕左上角", + "tips": "选择新鼠标位置是相对于屏幕左上角、激活窗口左上角或 运行过程中鼠标当前位置", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕左上角", + "value": "screen" + }, + { + "display": "激活窗口左上角", + "value": "currentactivatedwindow" + }, + { + "display": "运行中当前鼠标位置", + "value": "currentmouseposition" + } + ] + } + }, + { + "name": "move_speed", + "label": "移动速度", + "required": true, + "default": "10:middle", + "defaultDisplay": "中速", + "tips": "鼠标移动的速度", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "瞬间", + "value": "instant" + }, + { + "display": "快速", + "value": "fast" + }, + { + "display": "中速", + "value": "middle" + }, + { + "display": "慢速", + "value": "slow" + } + ] + } + }, + { + "name": "button", + "label": "鼠标按钮", + "required": true, + "default": "10:left", + "defaultDisplay": "左键", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "左键", + "value": "left" + }, + { + "display": "右键", + "value": "right" + }, + { + "display": "中键", + "value": "middle" + } + ] + } + }, + { + "name": "click_type", + "label": "点击方式", + "required": true, + "default": "10:click", + "defaultDisplay": "单击", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单击", + "value": "click" + }, + { + "display": "双击", + "value": "dbclick" + }, + { + "display": "按下", + "value": "down" + }, + { + "display": "弹起", + "value": "up" + } + ] + } + }, + { + "name": "hardware_driver_click", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "通过硬件驱动的方式点击", + "type": "bool", + "editor": { + "label": "驱动点击", + "kind": "checkbox" + } + }, + { + "name": "keys", + "label": "键盘辅助按钮", + "required": true, + "default": "10:null", + "defaultDisplay": "无", + "category": "advanced", + "tips": "在点击时需要按下的键盘功能键", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "无", + "value": "null" + }, + { + "display": "Alt", + "value": "alt" + }, + { + "display": "Ctrl", + "value": "ctrl" + }, + { + "display": "Shift", + "value": "shift" + }, + { + "display": "Win", + "value": "win" + } + ] + } + }, + { + "name": "delay_after", + "label": "执行后延迟(秒)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.wheel_mouse", + "title": "滚动鼠标滚轮", + "icon": "BlockIcons/20-2.png", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.WheelMouseControl, ShadowBot.Shell.Development", + "comment": "%wheel_direction%鼠标滚轮%wheel_times%次", + "description": "滚动鼠标滚轮", + "function": "xbot_visual.win32.wheel_mouse", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/滚动鼠标滚轮.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.WheelMouseHandler" + } + ], + "inputs": [ + { + "name": "wheel_direction", + "label": "滚动方向", + "required": true, + "default": "10:down", + "defaultDisplay": "向下滚动", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "向下滚动", + "value": "down" + }, + { + "display": "向上滚动", + "value": "up" + } + ] + } + }, + { + "name": "wheel_times", + "label": "滚动次数", + "required": true, + "default": "10:1", + "tips": "指定滚轮需要滚动的次数", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": "0" + } + }, + { + "name": "keys", + "label": "键盘辅助按钮", + "required": true, + "default": "10:null", + "defaultDisplay": "无", + "category": "advanced", + "tips": "在点击时需要按下的键盘功能键", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "无", + "value": "null" + }, + { + "display": "Alt", + "value": "alt" + }, + { + "display": "Ctrl", + "value": "ctrl" + }, + { + "display": "Shift", + "value": "shift" + }, + { + "display": "Win", + "value": "win" + } + ] + } + }, + { + "name": "delay_after", + "label": "执行后延迟(秒)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "is_wheel_point", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "type": "bool", + "editor": { + "label": "滚动前将鼠标移动至指定位置", + "kind": "checkbox" + } + }, + { + "name": "point_x", + "label": "移动鼠标至 X", + "required": true, + "category": "advanced", + "default": "10:0", + "tips": "", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "point_y", + "label": "移动鼠标至 Y", + "required": true, + "category": "advanced", + "default": "10:0", + "tips": "", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "relative_to", + "label": "相对于", + "required": true, + "category": "advanced", + "default": "10:screen", + "defaultDisplay": "屏幕左上角", + "tips": "选择新鼠标位置是相对于屏幕左上角、激活窗口左上角或 运行过程中鼠标当前位置", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕左上角", + "value": "screen" + }, + { + "display": "激活窗口左上角", + "value": "currentactivatedwindow" + }, + { + "display": "运行中当前鼠标位置", + "value": "currentmouseposition" + } + ] + } + }, + { + "name": "move_speed", + "label": "移动速度", + "required": true, + "category": "advanced", + "default": "10:middle", + "defaultDisplay": "中速", + "tips": "鼠标移动的速度", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "瞬间", + "value": "instant" + }, + { + "display": "快速", + "value": "fast" + }, + { + "display": "中速", + "value": "middle" + }, + { + "display": "慢速", + "value": "slow" + } + ] + } + } + ] + }, + { + "name": "win32.get_mouse_position", + "title": "获取鼠标当前位置", + "icon": "BlockIcons/20-1.png", + "comment": "获取应用运行中的鼠标相对于%relative_to%的位置,将坐标保存到(%point_x%,%point_y%)", + "description": "获取机器人在运行过程中,执行该条指令时的鼠标位置", + "function": "xbot_visual.win32.get_mouse_position", + "helpUrl": "yddoc/language/zh-cn/指令文档/鼠标键盘/获取鼠标当前位置.html", + "video": { + "time": "06:30" + }, + "inputs": [ + { + "name": "relative_to", + "label": "相对于", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕左上角", + "tips": "在整个屏幕中的坐标还是在激活窗口中的坐标", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕左上角", + "value": "screen" + }, + { + "display": "激活窗口左上角", + "value": "currentactivatedwindow" + } + ] + } + } + ], + "outputs": [ + { + "id": "point_x", + "label": "保存横坐标至", + "variableLabel": "鼠标的横坐标", + "tips": "输入一个名称来保存鼠标横坐标,其类型是整数", + "type": "int", + "name": "point_x" + }, + { + "id": "point_y", + "label": "保存纵坐标至", + "variableLabel": "鼠标的纵坐标", + "tips": "输入一个名称来保存鼠标纵坐标,其类型是整数", + "type": "int", + "name": "point_y" + } + ] + }, + { + "name": "win32.get_selected_text", + "title": "获取选中文本", + "icon": "BlockIcons/20-1.png", + "comment": "获取选中的文本,将文本保存到%selected_text%", + "description": "获取选中的文本", + "function": "xbot_visual.win32.get_selected_text", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/数据提取/获取选中文本.html", + "inputs": [ + { + "name": "wait_time", + "label": "等待时间(毫秒)", + "required": true, + "default": "10:0", + "tips": "当选中内容过多或系统反应慢时,需要调大此参数,避免获取不到选中内容", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "selected_text", + "label": "保存选中文本至", + "variableLabel": "选中文本", + "tips": "指定一个变量名称,该变量用于保存获取到的选中文本", + "name": "selected_text", + "type": "str" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/win32.element.blocks.json b/src/assert/block_settings/win32.element.blocks.json new file mode 100644 index 0000000..0219bc4 --- /dev/null +++ b/src/assert/block_settings/win32.element.blocks.json @@ -0,0 +1,2571 @@ +{ + "types": [], + "blocks": [ + { + "name": "win32.element.get_element", + "title": "获取元素对象(win)", + "description": "获取窗口中元素的具体数据项,可对该项进行内容提取、值设置等自动化操作", + "comment": "获取窗口%window%中%selector%的对象,将对象保存到%element%", + "icon": "BlockIcons/3-3.png", + "function": "xbot_visual.win32.element.get_element", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.GetElementControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/元素操作/获取元素对象(win).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.GetElementHandler" + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "selector", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "is_related_parent", + "label": "", + "required": true, + "default": "13:False", + "tips": "是否关联父元素", + "type": "bool", + "editor": { + "label": "关联父元素", + "kind": "checkbox" + } + }, + { + "name": "parent", + "label": "父元素", + "required": false, + "tips": "在指定的父元素内查找目标元素", + "autoFill": false, + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "element", + "label": "保存元素对象至", + "variableLabel": "元素对象", + "tips": "指定一个变量名称,该变量用于保存获取到的元素对象", + "name": "win_element", + "type": "xbot.win32.element.Win32Element" + } + ] + }, + { + "name": "win32.element.get_all_elements", + "title": "获取相似元素列表(win)", + "statement": "workflow.getall", + "description": "获取窗口中的相似元素列表,对该列表中的项进行自动化操作", + "comment": "在窗口%window%中获取一组与元素%selector%相似的元素,将结果保存到%element_list%", + "icon": "BlockIcons/3-3.png", + "function": "xbot_visual.win32.element.get_all_elements", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/元素操作/获取相似元素列表(win).html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.GetAllElementsControl,ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.GetAllElementsHandler", + "settings": { + "inputName": "output_with_element_count", + "outputName": "element_count" + } + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "selector", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "operation", + "label": "元素操作", + "required": true, + "default": "10:element", + "defaultDisplay": "元素操作", + "tips": "获取的元素信息", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "获取元素对象", + "value": "element" + }, + { + "display": "获取元素文本内容", + "value": "text" + }, + { + "display": "获取元素值", + "value": "value" + }, + { + "display": "获取元素属性", + "value": "attr" + } + ] + } + }, + { + "name": "attribute_name", + "label": "属性名称", + "tips": "填写要获取的元素的属性名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "output_with_element_count", + "label": "", + "required": true, + "default": "13:False", + "tips": "是否输出相似元素个数", + "type": "bool", + "editor": { + "label": "输出相似元素个数", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "element_list", + "label": "保存相似元素列表至", + "variableLabel": "相似元素对象列表", + "tips": "指定一个变量名称,该变量用于保存获取到的相似元素列表", + "name": "win_element_list", + "type": "list" + }, + { + "id": "element_count", + "label": "保存相似元素个数至", + "variableLabel": "相似元素对象个数", + "tips": "指定一个变量名称,该变量用于保存获取到的相似元素个数", + "name": "win_element_count", + "type": "int" + } + ] + }, + { + "name": "win32.element.click", + "title": "点击元素(win)", + "description": "点击窗口中的元素,如按钮、链接或其他任何元素", + "comment": "在窗口%window%中,模拟人工%button%%clicks%元素%element%,点击%anchor_type%位置", + "icon": "BlockIcons/2-1.png", + "function": "xbot_visual.win32.element.click", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.ClickElementControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/点击元素(win).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.ClickElementHandler" + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "clicks", + "label": "点击方式", + "required": true, + "default": "10:click", + "category": "advanced", + "defaultDisplay": "单击", + "tips": "选择点击的方式是单击还是双击", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "单击", + "value": "click" + }, + { + "display": "双击", + "value": "dbclick" + } + ] + } + }, + { + "name": "button", + "label": "鼠标按钮", + "required": true, + "default": "10:left", + "category": "advanced", + "defaultDisplay": "鼠标左键", + "tips": "选择用于触发点击的鼠标按键", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "鼠标左键", + "value": "left" + }, + { + "display": "鼠标右键", + "value": "right" + } + ] + } + }, + { + "name": "keys", + "label": "辅助按键", + "required": true, + "default": "10:null", + "defaultDisplay": "无", + "category": "advanced", + "tips": "在点击时需要按下的键盘功能键", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "无", + "value": "null" + }, + { + "display": "Alt", + "value": "alt" + }, + { + "display": "Ctrl", + "value": "ctrl" + }, + { + "display": "Shift", + "value": "shift" + }, + { + "display": "Win", + "value": "win" + } + ] + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": true, + "tips": "支持点击元素中心位置(元素矩形区域的中心点)、随机位置(自动随机指定元素矩形范围内的点)、自定义位置(手动指定目标点)", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "label": "目标元素的部位", + "default": "10:middleCenter", + "category": "advanced", + "tips": "默认点击目标元素的中心位置,请根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "move_mouse", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "是否显示鼠标移动轨迹", + "type": "bool", + "editor": { + "label": "显示鼠标移动轨迹", + "kind": "checkbox" + } + }, + { + "name": "simulate", + "label": "", + "required": true, + "category": "advanced", + "default": "13:True", + "tips": "如果使用模拟人工点击则通过模拟人工的方式触发点击事件,否则将根据目标元素的自动化接口触发点击", + "type": "bool", + "editor": { + "label": "模拟人工点击", + "kind": "checkbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.element.input", + "title": "填写输入框(win)", + "description": "在窗口的输入框中输入内容", + "comment": "在窗口%window%的%element%中,%input_type%%text%", + "icon": "BlockIcons/2-3.png", + "function": "xbot_visual.win32.element.input", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.InputControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/填写输入框(win).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.InputHandler" + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "text", + "label": "输入内容", + "tips": "填写要输入的内容", + "type": "str", + "editor": { + "kind": "memoedit" + } + }, + { + "name": "append", + "label": "", + "required": true, + "default": "13:False", + "tips": "如果勾选追加输入则在现有内容后继续追加输入,否则清空现有内容后再进行输入", + "type": "bool", + "editor": { + "label": "追加输入", + "kind": "checkbox" + } + }, + { + "name": "simulate", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "如果使用模拟人工输入则通过模拟人工的方式触发输入事件,否则将根据目标元素的自动化接口触发输入", + "type": "bool", + "editor": { + "label": "模拟人工输入", + "kind": "checkbox" + } + }, + { + "name": "save_to_clipboard", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "将输入内容添加到剪切板通过Ctrl+V指令将内容填写到输入框避免输入法问题", + "type": "bool", + "editor": { + "label": "剪切板输入", + "kind": "checkbox" + } + }, + { + "name": "input_type", + "label": "输入方式", + "required": true, + "tips": "模拟人工输入: 通过模拟人工的方式触发输入事件(会自动切换当前输入法为英文输入状态, 以避免输入法造成的输入错误问题)\r\n剪切板输入: 将输入内容添加到剪切板通过Ctrl+V指令将内容填写到输入框避免输入法问题\r\n自动化接口输入: 调用元素自身实现的自动化接口输入", + "type": "str", + "default": "10:simulate", + "defaultDisplay": "模拟人工输入", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "模拟人工输入", + "value": "simulate" + }, + { + "display": "剪切板输入", + "value": "clipboard" + }, + { + "display": "自动化接口输入", + "value": "automatic" + } + ] + } + }, + { + "name": "contains_hotkey", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "可以在输入内容中加入快捷键,如{enter}代表输入回车键", + "type": "bool", + "editor": { + "label": "输入内容包含快捷键", + "kind": "checkbox" + } + }, + { + "name": "force_ime_ENG", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "存在不常见的输入法切换英文输入状态不成功的情况\r\n需要指定强制加载美式键盘(ENG), 确保模拟输入不受中文输入法影响", + "type": "bool", + "editor": { + "label": "强制加载美式键盘(ENG)", + "kind": "checkbox" + } + }, + { + "name": "send_key_delay", + "label": "按键输入间隔(ms)", + "required": true, + "category": "advanced", + "default": "10:50", + "tips": "两次按键输入的间隔时间, 单位是毫秒, 为避免输入错误, 请将该值调大", + "type": "int", + "editor": { + "kind": "spin", + "minValue": 5 + } + }, + { + "name": "focus_timeout", + "label": "焦点超时时间(ms)", + "category": "advanced", + "default": "10:1000", + "tips": "设置焦点超时时间(ms), 元素获取焦点后暂停指定时间后进行输入操作", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "click_before_input", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "在执行输入动作前,先点击元素,以便获取焦点", + "type": "bool", + "editor": { + "label": "输入前点击元素", + "kind": "checkbox" + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": false, + "tips": "支持点击元素中心位置(元素矩形区域的中心点)、随机位置(自动随机指定元素矩形范围内的点)、自定义位置(手动指定目标点)", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "label": "鼠标点击位置", + "default": "10:middleCenter", + "category": "advanced", + "tips": "该输入指令是通过(先点击输入框,后模拟键盘输入)实现的,默认点击输入框的中心位置,请根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标输入框存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.element.hover", + "title": "鼠标悬停在元素上(win)", + "keywords": "悬浮;停留", + "description": "将鼠标悬停在窗口中的元素上", + "comment": "在窗口%window%中,将鼠标移动到元素%element%上,到达位置为元素%anchor_type%", + "icon": "BlockIcons/2-2.png", + "function": "xbot_visual.win32.element.hover", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.HoverElementControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/鼠标悬停在元素上(win).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.HoverElementHandler" + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": true, + "tips": "支持悬停在元素中心位置、随机位置(在元素矩形范围内)、自定义位置", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "default": "10:middleCenter", + "category": "advanced", + "label": "目标元素的部位", + "tips": "默认悬停在目标元素的中心位置,请根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.element.check", + "title": "设置复选框(win)", + "keywords": "勾选", + "description": "将窗口中的复选框设置成勾选或不勾选", + "comment": "在窗口%window%中%mode%复选框%element%", + "icon": "BlockIcons/2-4.png", + "function": "xbot_visual.win32.element.check", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/元素操作/设置复选框(win).html", + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "mode", + "label": "操作", + "required": true, + "default": "10:check", + "defaultDisplay": "勾选", + "tips": "选择要对复选框进行的操作", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "勾选", + "value": "check" + }, + { + "display": "取消勾选", + "value": "uncheck" + }, + { + "display": "反选", + "value": "toggle" + } + ] + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标复选框存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.element.select", + "title": "设置下拉框(win)", + "description": "设置窗口中下拉框的选中项", + "comment": "在窗口%window%中%mode%下拉框%element%中等于%value%的项", + "icon": "BlockIcons/2-5.png", + "function": "xbot_visual.win32.element.select", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/元素操作/设置下拉框(win).html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.SetSelectOptionControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Element.SetSelectOptionHandler" + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "mode", + "label": "选择方式", + "required": true, + "default": "10:text", + "defaultDisplay": "按选项内容选择", + "tips": "选择设置选中项的依据", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "按选项内容选择", + "value": "text" + }, + { + "display": "按选项位置选择", + "value": "index" + } + ] + } + }, + { + "name": "value", + "label": "选择值", + "required": true, + "tips": "输入选项内容或者选项位置", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "match_mode", + "label": "匹配模式", + "required": false, + "default": "10:fuzzy", + "defaultDisplay": "匹配模式", + "tips": "选项内容的匹配模式, 默认是模糊匹配", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "模糊匹配", + "value": "fuzzy" + }, + { + "display": "精准匹配", + "value": "exact" + }, + { + "display": "正则匹配", + "value": "regex" + } + ] + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标下拉框存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.element.input_password", + "title": "填写密码框(win)", + "description": "在窗口中的密码框中输入密码", + "comment": "在窗口%window%的%element%中%input_type%密码", + "icon": "BlockIcons/2-6.png", + "function": "xbot_visual.win32.element.input_password", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.InputPasswordControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/元素操作/填写密码框(win).html", + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "text", + "label": "输入密码", + "required": true, + "tips": "填写要输入的密码", + "type": "str", + "editor": { + "kind": "password" + } + }, + { + "name": "simulate", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "如果使用模拟人工输入则通过模拟人工的方式触发输入事件,否则将根据目标元素的自动化接口触发输入", + "type": "bool", + "editor": { + "label": "模拟人工输入", + "kind": "checkbox" + } + }, + { + "name": "save_to_clipboard", + "label": "", + "required": true, + "default": "13:False", + "category": "advanced", + "tips": "将输入内容添加到剪切板通过Ctrl+V指令将内容填写到输入框避免输入法问题", + "type": "bool", + "editor": { + "label": "剪切板输入", + "kind": "checkbox" + } + }, + { + "name": "input_type", + "label": "输入方式", + "required": true, + "tips": "模拟人工输入: 通过模拟人工的方式触发输入事件(会自动切换当前输入法为英文输入状态, 以避免输入法造成的输入错误问题)\r\n剪切板输入: 将输入内容添加到剪切板通过Ctrl+V指令将内容填写到输入框避免输入法问题\r\n自动化接口输入: 调用元素自身实现的自动化接口输入", + "type": "str", + "default": "10:simulate", + "defaultDisplay": "模拟人工输入", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "模拟人工输入", + "value": "simulate" + }, + { + "display": "剪切板输入", + "value": "clipboard" + }, + { + "display": "自动化接口输入", + "value": "automatic" + } + ] + } + }, + { + "name": "send_key_delay", + "label": "按键输入间隔(ms)", + "required": true, + "category": "advanced", + "default": "10:50", + "tips": "两次按键输入的间隔时间, 单位是毫秒, 为避免输入错误, 请将该值调大,最大值为1000ms", + "type": "int", + "editor": { + "kind": "spin", + "minValue": 5 + } + }, + { + "name": "focus_timeout", + "label": "焦点超时时间(ms)", + "category": "advanced", + "default": "10:1000", + "tips": "设置焦点超时时间(ms), 元素获取焦点后暂停指定时间后进行输入操作", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "click_before_input", + "label": "", + "required": true, + "default": "13:True", + "category": "advanced", + "tips": "在执行输入动作前,先点击元素,以便获取焦点", + "type": "bool", + "editor": { + "label": "输入前点击元素", + "kind": "checkbox" + } + }, + { + "name": "anchor_type", + "label": "锚点", + "required": false, + "tips": "支持点击元素中心位置(元素矩形区域的中心点)、随机位置(自动随机指定元素矩形范围内的点)、自定义位置(手动指定目标点)", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "category": "advanced", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "label": "鼠标点击位置", + "default": "10:middleCenter", + "category": "advanced", + "tips": "该输入指令是通过(先点击输入框,后模拟键盘输入)实现的,默认点击输入框的中心位置,请根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "category": "advanced", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标密码框存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.element.set_value", + "title": "设置元素值(win)", + "description": "设置窗口元素的值,一般用于输入框和下拉框的操作", + "comment": "在窗口%window%中设置%element%的值为%value%", + "icon": "BlockIcons/2-7.png", + "function": "xbot_visual.win32.element.set_value", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/元素操作/设置元素值(win).html", + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "value", + "label": "元素值", + "required": true, + "tips": "填写要设置的元素值", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.element.get_details", + "title": "获取元素信息(win)", + "keywords": "元素值;元素属性;元素位置", + "description": "获取窗口中的指定元素的文本内容、值、属性、元素位置等信息", + "comment": "%operation%,目标元素为%element%,将结果保存到%element_attribute%", + "icon": "BlockIcons/3-2.png", + "function": "xbot_visual.win32.element.get_details", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/数据提取/获取元素信息(win).html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.GetElementDetailsControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.GetElementDetailsHandler" + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "operation", + "label": "操作", + "required": true, + "default": "10:text", + "defaultDisplay": "获取元素文本内容", + "tips": "选择要获取的窗口元素信息", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "获取元素文本内容", + "value": "text" + }, + { + "display": "获取元素值", + "value": "value" + }, + { + "display": "获取元素属性", + "value": "other" + }, + { + "display": "获取元素位置", + "value": "bound" + } + ] + } + }, + { + "name": "attribute_name", + "label": "属性名称", + "tips": "填写要获取的窗口元素的属性名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "relative_to", + "label": "相对于", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕左上角", + "tips": "在整个屏幕中的位置还是在元素所在窗口中的位置", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕左上角", + "value": "screen" + }, + { + "display": "元素所在窗口左上角", + "value": "window" + } + ] + } + }, + { + "name": "to96dpi", + "label": "", + "required": true, + "category": "advanced", + "default": "13:True", + "tips": "是否需要将边框属性转换成与设备无关的单位 (每个单位1/96英寸)", + "type": "bool", + "editor": { + "label": "转为dpi为96对应值", + "kind": "checkbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "element_attribute", + "label": "保存元素信息至", + "variableLabel": "元素信息", + "tips": "指定一个变量名称,该变量用于保存获取到的窗口元素信息", + "name": "win_element_attribute", + "type": "str" + } + ] + }, + { + "name": "win32.element.get_bounding", + "title": "获取元素位置(win)", + "description": "获取元素相对于屏幕或所在窗口的位置信息", + "comment": "获取窗口%window%中%element%相对于%relative_to%的位置信息,将结果保存到%bound%", + "icon": "BlockIcons/3-13.png", + "function": "xbot_visual.win32.element.get_bounding", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/数据提取/获取元素位置(win).html", + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "to96dpi", + "label": "", + "required": true, + "category": "advanced", + "default": "13:True", + "tips": "是否需要将位置信息值转换成与设备无关的单位 (每个单位1/96英寸)", + "type": "bool", + "editor": { + "label": "转为dpi为96对应值", + "kind": "checkbox" + } + }, + { + "name": "relative_to", + "label": "相对于", + "required": true, + "default": "10:screen", + "defaultDisplay": "屏幕左上角", + "tips": "在整个屏幕中的位置还是在元素所在窗口中的位置", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "屏幕左上角", + "value": "screen" + }, + { + "display": "元素所在窗口左上角", + "value": "window" + } + ] + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "bound", + "label": "保存位置信息至", + "variableLabel": "元素位置信息", + "tips": "输入一个名称来保存元素位置信息", + "type": "xbot_visual._core.Rectangle", + "name": "bound" + } + ] + }, + { + "name": "win32.element.wait", + "title": "等待元素(win)", + "keywords": "出现;消失", + "description": "等待窗口中元素出现或消失,再执行接下来的流程", + "comment": "等待窗口%window%中元素%element%出现,最多等待%timeout%秒", + "icon": "BlockIcons/2-9.png", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.WaitElementControl, ShadowBot.Shell.Development", + "function": "xbot_visual.win32.element.wait", + "helpUrl": "yddoc/language/zh-cn/指令文档/等待/等待元素(win).html", + "video": { + "time": "06:39" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.WaitWindowElementHandler" + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "state", + "label": "等待状态", + "required": true, + "default": "10:appear", + "defaultDisplay": "等待元素出现", + "tips": "选择等待状态", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "等待元素出现", + "value": "appear" + }, + { + "display": "等待元素消失", + "value": "disappear" + } + ] + } + }, + { + "name": "iswait", + "label": "", + "required": true, + "default": "13:True", + "tips": "设置等待超时时间,超时后流程将自动往下继续执行", + "type": "bool", + "editor": { + "label": "设置超时时间", + "kind": "checkbox" + } + }, + { + "name": "timeout", + "label": "超时时间(s)", + "required": true, + "default": "10:20", + "tips": "设置最大等待时间", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "wait_result", + "label": "等待结果", + "tips": "如果为True则等待成功,否则等待超时", + "name": "win_wait_result", + "type": "bool" + } + ] + }, + { + "name": "win32.element.foreach_element", + "statement": "workflow.forin", + "function": "xbot_visual.win32.element.iter_all_elements", + "title": "循环相似元素(win)", + "description": "依次循环窗口中相似元素列表的每一项进行自动化操作", + "comment": "从窗口%window%中获取相似元素%selector%,将结果依次循环保存到%loop_item%", + "indent": "1", + "scope": "1", + "isLoop": true, + "icon": "BlockIcons/3-8.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/循环相似元素(win).html", + "video": { + "time": "04:47" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.ForInControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Element.ForeachElementHandler", + "settings": { + "inputName": "output_with_index", + "outputName": "loop_index" + } + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个通过\"获取窗口对象\"获取的窗口对象", + "autoFill": false, + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "selector", + "label": "操作目标", + "required": true, + "tips": "选择一组相似元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "onlySelector": true, + "selectorType": "simple" + } + }, + { + "name": "operation", + "label": "元素操作", + "required": true, + "default": "10:element", + "defaultDisplay": "元素操作", + "tips": "设置循环的相似元素内容:元素对象or元素的信息,比如文本内容等", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "获取元素对象", + "value": "element" + }, + { + "display": "获取元素文本内容", + "value": "text" + }, + { + "display": "获取元素值", + "value": "value" + }, + { + "display": "获取元素属性", + "value": "attr" + } + ] + } + }, + { + "name": "attribute_name", + "label": "属性名称", + "tips": "填写要获取的元素的属性名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "loop_start_index", + "label": "循环开始位置", + "category": "advanced", + "required": false, + "default": "10:0", + "tips": "循环开始位置,0表示第一项", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "loop_end_index", + "label": "循环结束位置", + "category": "advanced", + "required": false, + "default": "10:-1", + "tips": "循环结束位置,-1表示倒数第一项,结果包含结束位置的项", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "超时时间(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素出现的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "output_with_index", + "label": "", + "required": true, + "default": "13:False", + "tips": "是否输出循环项的位置", + "type": "bool", + "editor": { + "label": "输出循环项的位置", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "loop_item", + "label": "保存当前循环项至", + "variableLabel": "当前循环项", + "tips": "指定一个变量名称,用于存储一组相似元素中的当前循环项", + "name": "win_loop_element", + "type": "xbot.win32.element.Win32Element" + }, + { + "id": "loop_index", + "label": "保存当前循环位置至", + "variableLabel": "当前循环项的位置", + "tips": "指定一个变量名称,用于存储一组相似元素中的当前循环项位置", + "name": "win_loop_element_index", + "type": "int" + } + ] + }, + { + "name": "win32.element.drag_to", + "title": "拖拽元素(win)", + "keywords": "拖动", + "description": "在指定的窗口中将元素拖拽至指定的位置", + "comment": "将元素拖拽到指定位置", + "icon": "BlockIcons/2-10.png", + "function": "xbot_visual.win32.element.drag_to", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.DragElementControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/元素操作/元素拖拽(win).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.DragElementToHandler" + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "drag_way", + "label": "拖拽方式", + "required": true, + "default": "10:default", + "defaultDisplay": "拖拽至目标点", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "拖拽至目标点", + "value": "default" + }, + { + "display": "拖拽至目标元素上", + "value": "targetElement" + } + ] + } + }, + { + "name": "target_element", + "label": "操作目标", + "tips": "要操作的元素,可以从元素列表中选择一个录制好的桌面软件元素,也可以使用动态元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "left", + "label": "X", + "default": "10:0", + "tips": "鼠标移动到的目标位置的横坐标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "top", + "label": "Y", + "default": "10:0", + "tips": "鼠标移动到的目标位置的纵坐标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "delay_after", + "label": "执行后延迟(s)", + "required": true, + "category": "advanced", + "default": "10:1", + "tips": "指令执行完成后的等待时间", + "type": "float", + "editor": { + "kind": "spin", + "minValue": 0 + } + }, + { + "name": "anchor_type", + "label": "鼠标按下位置锚点", + "required": true, + "tips": "支持鼠标在拖拽元素中心位置、随机位置(在元素矩形范围内)、自定义位置处按下", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "sudoku_part", + "default": "10:middleCenter", + "label": "鼠标按下元素部位", + "tips": "默认鼠标在拖拽元素的中心位置按下,根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "move_speed", + "label": "移动速度", + "required": false, + "category": "advanced", + "default": "10:middle", + "defaultDisplay": "中速", + "tips": "选择移动鼠标的速度", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "瞬间", + "value": "instant" + }, + { + "display": "快速", + "value": "fast" + }, + { + "display": "中速", + "value": "middle" + }, + { + "display": "慢速", + "value": "slow" + } + ] + } + }, + { + "name": "release_anchor_type", + "label": "鼠标释放位置锚点", + "required": true, + "tips": "支持鼠标在拖拽至元素的中心位置、随机位置(在元素矩形范围内)、自定义位置释放", + "type": "str", + "default": "10:center", + "defaultDisplay": "中心点", + "autoFill": true, + "editor": { + "kind": "select", + "options": [ + { + "display": "中心点", + "value": "center" + }, + { + "display": "随机位置", + "value": "random" + }, + { + "display": "自定义", + "value": "custom" + } + ] + } + }, + { + "name": "release_sudoku_part", + "default": "10:middleCenter", + "label": "鼠标释放元素部位", + "tips": "默认鼠标在拖拽至元素的中心位置释放,请根据实际情况调整", + "type": "str", + "editor": { + "kind": "sudoku" + } + }, + { + "name": "release_offset_x", + "label": "横向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向右移动 5px,输入负数代表向左移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "release_offset_y", + "label": "纵向偏移", + "required": true, + "default": "10:0", + "tips": "输入 5 表示将鼠标向下移动 5px,输入负数代表向上移动鼠标", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ] + }, + { + "name": "win32.element.screenshot", + "title": "元素截图(win)", + "description": "对桌面软件中的元素进行截图,将结果保存至指定文件", + "comment": "在窗口%window%中对元素%element%进行截图,将截图保存到文件夹%folder_path%中,将存图路径保存到%screenshot_save_file_name%", + "icon": "BlockIcons/3-6.png", + "function": "xbot_visual.win32.element.screenshot", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/数据提取/元素截图(win).html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.ScreenShotControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.ScreenShotHandler" + }, + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.ScreenShotOutputPathHandler", + "settings": { + "inputName": "save_to_clipboard", + "outputName": "screenshot_save_file_name" + } + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "folder_path", + "label": "保存文件夹", + "tips": "截图保存的文件夹", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "random_filename", + "label": "", + "required": true, + "default": "13:True", + "tips": "自动生成不重复的文件名", + "type": "bool", + "editor": { + "label": "使用自动随机文件名", + "kind": "checkbox" + } + }, + { + "name": "filename", + "label": "自定义文件名", + "tips": "自定义文件名 如: screenshot.png", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "overwrite_file", + "label": "", + "default": "13:True", + "tips": "", + "type": "bool", + "editor": { + "label": "如果文件存在则覆盖", + "kind": "checkbox" + } + }, + { + "name": "save_to_clipboard", + "label": "", + "required": true, + "default": "13:False", + "tips": "保存图片至剪切板", + "type": "bool", + "editor": { + "label": "保存图片至剪切板", + "kind": "checkbox" + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "设置元素截图的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "screenshot_save_file_name", + "label": "截图保存位置", + "variableLabel": "元素截图位置", + "tips": "截图文件所在的位置:文件路径+名称", + "name": "screenshot_save_file_name", + "type": "str" + } + ] + }, + { + "name": "win32.element.get_select_item", + "title": "获取下拉框选项(win)", + "description": "获取窗口中下拉框的选项", + "comment": "获取窗口%window%中%element%的%get_way%,将结果保存到%select_items%", + "icon": "BlockIcons/2-10.png", + "function": "xbot_visual.win32.element.get_select_item", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Element.GetSelectItemHandler" + } + ], + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/数据提取/获取下拉框选项(win).html", + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "get_way", + "label": "获取内容", + "required": true, + "default": "10:selected", + "defaultDisplay": "当前选中项", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "当前选中项", + "value": "selected" + }, + { + "display": "全部下拉项", + "value": "select_all" + } + ] + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待目标元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "select_items", + "label": "保存获取到的内容至", + "tips": "指定一个变量名称,用于存储获取到的下拉选项内容", + "name": "select_items", + "type": "list" + } + ] + }, + { + "name": "win32.element.get_associated_elements", + "title": "获取关联元素(win)", + "keywords": "父元素;子元素;相邻元素", + "description": "在窗口%window%中获取元素的关联元素(父元素、子元素、相邻元素)", + "comment": "获取窗口元素%element%的%associated_kind%,将对象保存到%win_element_result%", + "icon": "BlockIcons/2-11.png", + "function": "xbot_visual.win32.element.get_associated_elements", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Element.GetAssociatedElementsControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/元素操作/获取关联元素(win).html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.GetAssociatedElementsHandler" + } + ], + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "default": "10:0", + "tips": "输入一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "associated_kind", + "label": "关联方式", + "required": true, + "default": "10:parent", + "defaultDisplay": "父元素", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "父元素", + "value": "parent" + }, + { + "display": "子元素", + "value": "child" + }, + { + "display": "相邻元素", + "value": "sibling" + } + ] + } + }, + { + "name": "child_access_kind", + "label": "子元素获取方式", + "default": "10:all", + "defaultDisplay": "所有子元素", + "tips": "指定子元素的获取方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "所有子元素", + "value": "all" + }, + { + "display": "指定位置的子元素", + "value": "index" + } + ] + } + }, + { + "name": "child_index", + "label": "子元素位置", + "default": "10:0", + "type": "int", + "tips": "在父元素中的索引位置,从0开始计数", + "editor": { + "kind": "textbox", + "minValue": 0 + } + }, + { + "name": "sibling_direction", + "label": "相邻方向", + "default": "10:next", + "defaultDisplay": "下一个相邻元素", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "上一个相邻元素", + "value": "previous" + }, + { + "display": "下一个相邻元素", + "value": "next" + } + ] + } + }, + { + "name": "timeout", + "label": "等待元素存在(s)", + "required": true, + "category": "advanced", + "default": "10:20", + "tips": "等待关联元素存在的超时时间", + "type": "int", + "editor": { + "kind": "textbox", + "minValue": 0 + } + } + ], + "outputs": [ + { + "id": "win_element_result", + "label": "保存软件元素至", + "variableLabel": "软件元素", + "tips": "指定一个变量名称,该变量用于保存获取到的软件元素", + "name": "win_element_result", + "type": "xbot.win32.element.Win32Element" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/win32.window.blocks.json b/src/assert/block_settings/win32.window.blocks.json new file mode 100644 index 0000000..5c8dd0d --- /dev/null +++ b/src/assert/block_settings/win32.window.blocks.json @@ -0,0 +1,1564 @@ +{ + "types": [ + { + "name": "xbot.win32.element.Win32Element", + "localName": "win元素", + "methods": [ + { + "display": "该元素的文本内容", + "function": "$0.get_text()", + "type": "str" + } + ] + } + ], + "blocks": [ + { + "name": "win32.window.get_window", + "title": "获取窗口对象", + "icon": "BlockIcons/1-14.png", + "comment": " ", + "description": "在对指定窗口进行自动化操作,先需要获取软件运行窗口对象", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.GetWindowControl,ShadowBot.Shell.Development", + "function": "xbot_visual.win32.window.get", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/获取窗口对象.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.GetWindowHandler" + } + ], + "inputs": [ + { + "name": "window_type", + "label": "获取窗口方式", + "required": true, + "default": "10:win_title_or_class", + "defaultDisplay": "窗口对象", + "tips": "选择获取窗口方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "窗口标题或类型名", + "value": "win_title_or_class" + }, + { + "display": "捕获窗口元素", + "value": "window_selector" + }, + { + "display": "当前激活窗口", + "value": "active" + }, + { + "display": "窗口句柄", + "value": "win_handle" + }, + { + "display": "桌面", + "value": "desktop" + } + ] + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "从元素列表中选择一个录制好的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "handle", + "label": "窗口句柄", + "tips": "输入一个窗口句柄", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox" + } + }, + { + "name": "title", + "label": "窗口标题", + "tips": "输入窗口标题", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "handle_checked", + "label": "", + "required": true, + "default": "13:False", + "tips": "添加窗口类型", + "type": "bool", + "editor": { + "label": "添加窗口类型", + "kind": "checkbox" + } + }, + { + "name": "class_name", + "label": "窗口类型", + "tips": "输入窗口类型", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + } + + ], + "outputs": [ + { + "id": "result_window_instance", + "label": "保存窗口对象至", + "variableLabel": "窗口实例", + "tips": "该变量保存的是窗口对象,使用此窗口对象可以对窗口进行自动化操作", + "name": "software_window", + "type": "xbot.win32.window.Win32Window" + } + ] + }, + { + "name": "win32.window.get_window_list", + "title": "获取窗口对象列表", + "icon": "BlockIcons/1-14.png", + "comment": "", + "description": "获取所有满足条件的窗口对象", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.GetWindowListControl,ShadowBot.Shell.Development", + "function": "xbot_visual.win32.window.get_list", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/获取窗口对象列表.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.GetWindowListHandler" + } + ], + "inputs": [ + { + "name": "title", + "label": "窗口标题包含", + "tips": "窗口包含的标题,标题为空时表示获取全部窗口对象", + "required": false, + "type": "str", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "result_window_list", + "label": "保存窗口列表对象至", + "variableLabel": "窗口列表实列", + "tips": "该变量保存的是窗口对象列表,遍历窗口列表可通过窗口对象对窗口进行自动化操作", + "name": "software_window_list", + "type": "list" + } + ] + }, + { + "name": "win32.window.get_details", + "title": "获取窗口信息", + "icon": "BlockIcons/1-13.png", + "comment": "%operation%,目标窗口为%window%,将结果保存到%window_property%", + "description": "获取指定窗口的标题、内容、进程名等信息", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.GetWindowDetail,ShadowBot.Shell.Development", + "function": "xbot_visual.win32.window.get_details", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/窗口操作/获取窗口信息.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.GetWindowDetailHandler" + } + ], + "inputs": [ + { + "name": "window_type", + "label": "获取窗口方式", + "required": true, + "default": "10:window_instance", + "defaultDisplay": "窗口对象", + "tips": "选择获取窗口方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "窗口对象", + "value": "window_instance" + }, + { + "display": "捕获窗口元素", + "value": "window_selector" + }, + { + "display": "窗口标题或类型名", + "value": "win_title_or_class" + }, + { + "display": "窗口句柄", + "value": "win_handle" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "输入一个通过\"获取窗口对象\"获取的窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "从元素列表中选择一个录制好的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "handle", + "label": "窗口句柄", + "tips": "输入一个窗口句柄", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox" + } + }, + { + "name": "title", + "label": "窗口标题", + "tips": "输入窗口标题", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "handle_checked", + "label": "", + "required": true, + "default": "13:False", + "tips": "添加窗口类型", + "type": "bool", + "editor": { + "label": "添加窗口类型", + "kind": "checkbox" + } + }, + { + "name": "class_name", + "label": "窗口类型", + "tips": "输入窗口类型", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + }, + { + "name": "operation", + "label": "操作", + "required": true, + "default": "10:title", + "defaultDisplay": "获取窗口标题", + "tips": "选择一种对窗口的操作方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "获取窗口标题", + "value": "title" + }, + { + "display": "获取窗口内容", + "value": "text" + }, + { + "display": "获取窗口进程名", + "value": "process_name" + } + ] + } + } + ], + "outputs": [ + { + "id": "window_property", + "label": "保存窗口属性至", + "variableLabel": "属性对象", + "tips": "该对象保存的是窗口的属性对象", + "name": "win_property", + "type": "str" + } + ] + }, + { + "name": "win32.window.set_state", + "title": "设置窗口状态", + "keywords": "最大化;最小化", + "icon": "BlockIcons/1-11.png", + "comment": "设置窗口%window%状态为%flag%", + "description": "对窗口还原、最大化或最小化的操作", + "function": "xbot_visual.win32.window.set_state", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.SetWindowStateControl,ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/窗口操作/设置窗口状态.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.SetWindowStateHandler" + } + ], + "inputs": [ + { + "name": "window_type", + "label": "获取窗口方式", + "required": true, + "default": "10:window_instance", + "defaultDisplay": "窗口对象", + "tips": "选择获取窗口方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "窗口对象", + "value": "window_instance" + }, + { + "display": "捕获窗口元素", + "value": "window_selector" + }, + { + "display": "窗口标题或类型名", + "value": "win_title_or_class" + }, + { + "display": "窗口句柄", + "value": "win_handle" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "输入一个通过\"获取窗口对象\"获取的窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "从元素列表中选择一个录制好的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "handle", + "label": "窗口句柄", + "tips": "输入一个窗口句柄", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox" + } + }, + { + "name": "title", + "label": "窗口标题", + "tips": "输入窗口标题", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "handle_checked", + "label": "", + "required": true, + "default": "13:False", + "tips": "添加窗口类型", + "type": "bool", + "editor": { + "label": "添加窗口类型", + "kind": "checkbox" + } + }, + { + "name": "class_name", + "label": "窗口类型", + "tips": "输入窗口类型", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + }, + { + "name": "flag", + "label": "要设置窗口的状态", + "required": true, + "tips": "选择想要设置的窗口状态", + "type": "str", + "defaultDisplay": "还原", + "default": "10:restore", + "editor": { + "kind": "select", + "options": [ + { + "display": "还原", + "value": "restore" + }, + { + "display": "最大化窗口", + "value": "maximize" + }, + { + "display": "最小化窗口", + "value": "minimize" + } + ] + } + } + ] + }, + { + "name": "win32.window.set_visibility", + "title": "设置窗口是否显示", + "keywords": "隐藏", + "icon": "BlockIcons/1-10.png", + "comment": "%flag%%window%", + "description": "设置窗口显示、隐藏状态", + "function": "xbot_visual.win32.window.set_visibility", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.SetWindowVisibilityControl,ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/窗口操作/设置窗口是否显示.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.SetWindowVisibilityHandler" + } + ], + "inputs": [ + { + "name": "window_type", + "label": "获取窗口方式", + "required": true, + "default": "10:window_instance", + "defaultDisplay": "窗口对象", + "tips": "选择获取窗口方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "窗口对象", + "value": "window_instance" + }, + { + "display": "捕获窗口元素", + "value": "window_selector" + }, + { + "display": "窗口标题或类型名", + "value": "win_title_or_class" + }, + { + "display": "窗口句柄", + "value": "win_handle" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "输入一个通过\"获取窗口对象\"获取的窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "从元素列表中选择一个录制好的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "handle", + "label": "窗口句柄", + "tips": "输入一个窗口句柄", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox" + } + }, + { + "name": "title", + "label": "窗口标题", + "tips": "输入窗口标题", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "handle_checked", + "label": "", + "required": true, + "default": "13:False", + "tips": "添加窗口类型", + "type": "bool", + "editor": { + "label": "添加窗口类型", + "kind": "checkbox" + } + }, + { + "name": "class_name", + "label": "窗口类型", + "tips": "输入窗口类型", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + }, + { + "name": "flag", + "label": "窗体可见性", + "required": true, + "tips": "选择想要设置的窗口可见性", + "default": "10:hide", + "defaultDisplay": "隐藏窗口", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "显示窗口", + "value": "show" + }, + { + "display": "隐藏窗口", + "value": "hide" + } + ] + } + } + ] + }, + { + "name": "win32.window.activate", + "title": "激活软件窗口", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.FocusWindowControl,ShadowBot.Shell.Development", + "icon": "BlockIcons/1-12.png", + "comment": " ", + "description": "激活指定窗口使其在前台运行", + "function": "xbot_visual.win32.window.activate", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/窗口操作/激活软件窗口.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.FocusWindowHandler" + } + ], + "inputs": [ + { + "name": "window_type", + "label": "获取窗口方式", + "required": true, + "default": "10:window_instance", + "defaultDisplay": "窗口对象", + "tips": "选择获取窗口方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "窗口对象", + "value": "window_instance" + }, + { + "display": "捕获窗口元素", + "value": "window_selector" + }, + { + "display": "窗口标题或类型名", + "value": "win_title_or_class" + }, + { + "display": "窗口句柄", + "value": "win_handle" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "输入一个通过\"获取窗口对象\"获取的窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "从元素列表中选择一个录制好的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "handle", + "label": "窗口句柄", + "tips": "输入一个窗口句柄", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox" + } + }, + { + "name": "title", + "label": "窗口标题", + "tips": "输入窗口标题", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "handle_checked", + "label": "", + "required": true, + "default": "13:False", + "tips": "添加窗口类型", + "type": "bool", + "editor": { + "label": "添加窗口类型", + "kind": "checkbox" + } + }, + { + "name": "class_name", + "label": "窗口类型", + "tips": "输入窗口类型", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + } + ] + }, + { + "name": "win32.window.close", + "title": "关闭软件窗口", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.CloseWindowControl,ShadowBot.Shell.Development", + "icon": "BlockIcons/1-7.png", + "comment": " ", + "description": "此操作将关闭指定窗口", + "function": "xbot_visual.win32.window.close", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/窗口操作/关闭软件窗口.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.CloseWindowHandler" + } + ], + "inputs": [ + { + "name": "window_type", + "label": "获取窗口方式", + "required": true, + "default": "10:window_instance", + "defaultDisplay": "窗口对象", + "tips": "选择获取窗口方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "窗口对象", + "value": "window_instance" + }, + { + "display": "捕获窗口元素", + "value": "window_selector" + }, + { + "display": "窗口标题或类型名", + "value": "win_title_or_class" + }, + { + "display": "窗口句柄", + "value": "win_handle" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "输入一个通过\"获取窗口对象\"获取的窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "从元素列表中选择一个录制好的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "handle", + "label": "窗口句柄", + "tips": "输入一个窗口句柄", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox" + } + }, + { + "name": "title", + "label": "窗口标题", + "tips": "输入窗口标题", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "handle_checked", + "label": "", + "required": true, + "default": "13:False", + "tips": "添加窗口类型", + "type": "bool", + "editor": { + "label": "添加窗口类型", + "kind": "checkbox" + } + }, + { + "name": "class_name", + "label": "窗口类型", + "tips": "输入窗口类型", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + } + ] + }, + { + "name": "win32.window.move", + "title": "移动窗口位置", + "icon": "BlockIcons/1-9.png", + "comment": " ", + "description": "移动窗口至指定位置", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.MoveWindowControl,ShadowBot.Shell.Development", + "function": "xbot_visual.win32.window.move", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/窗口操作/移动窗口位置.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.MoveWindowHandler" + } + ], + "inputs": [ + { + "name": "window_type", + "label": "获取窗口方式", + "required": true, + "default": "10:window_instance", + "defaultDisplay": "窗口对象", + "tips": "选择获取窗口方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "窗口对象", + "value": "window_instance" + }, + { + "display": "捕获窗口元素", + "value": "window_selector" + }, + { + "display": "窗口标题或类型名", + "value": "win_title_or_class" + }, + { + "display": "窗口句柄", + "value": "win_handle" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "输入一个通过\"获取窗口对象\"获取的窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "从元素列表中选择一个录制好的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "handle", + "label": "窗口句柄", + "tips": "输入一个窗口句柄", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox" + } + }, + { + "name": "title", + "label": "窗口标题", + "tips": "输入窗口标题", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "handle_checked", + "label": "", + "required": true, + "default": "13:False", + "tips": "添加窗口类型", + "type": "bool", + "editor": { + "label": "添加窗口类型", + "kind": "checkbox" + } + }, + { + "name": "class_name", + "label": "窗口类型", + "tips": "输入窗口类型", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + }, + { + "name": "x", + "label": "X", + "required": true, + "tips": "输入窗口移动的目标横坐标x", + "default": "10:400", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "y", + "label": "Y", + "required": true, + "tips": "输入窗口移动的目标纵坐标y", + "default": "10:400", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "win32.window.resize", + "title": "调整窗口大小", + "keywords": "缩放", + "icon": "BlockIcons/1-8.png", + "comment": " ", + "description": "对窗口大小进行调整", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.ResizeWindowControl,ShadowBot.Shell.Development", + "function": "xbot_visual.win32.window.resize", + "helpUrl": "yddoc/language/zh-cn/指令文档/桌面软件自动化/窗口操作/调整窗口大小.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.ResizeWindowHandler" + } + ], + "inputs": [ + { + "name": "window_type", + "label": "获取窗口方式", + "required": true, + "default": "10:window_instance", + "defaultDisplay": "窗口对象", + "tips": "选择获取窗口方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "窗口对象", + "value": "window_instance" + }, + { + "display": "捕获窗口元素", + "value": "window_selector" + }, + { + "display": "窗口标题或类型名", + "value": "win_title_or_class" + }, + { + "display": "窗口句柄", + "value": "win_handle" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "输入一个通过\"获取窗口对象\"获取的窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "从元素列表中选择一个录制好的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "handle", + "label": "窗口句柄", + "tips": "输入一个窗口句柄", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox" + } + }, + { + "name": "title", + "label": "窗口标题", + "tips": "输入窗口标题", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "handle_checked", + "label": "", + "required": true, + "default": "13:False", + "tips": "添加窗口类型", + "type": "bool", + "editor": { + "label": "添加窗口类型", + "kind": "checkbox" + } + }, + { + "name": "class_name", + "label": "窗口类型", + "tips": "输入窗口类型", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + }, + { + "name": "width", + "label": "宽度", + "required": true, + "tips": "设置窗口宽度", + "default": "10:400", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "height", + "label": "高度", + "required": true, + "tips": "设置窗口高度", + "default": "10:400", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "win32.window.contains_element", + "statement": "workflow.if", + "title": "IF 窗口包含", + "description": "检测指定的元素是否包含在指定窗口中", + "comment": "检查窗口%window%中是否%content_type%%element%", + "indent": "1", + "scope": "1", + "isCondition": true, + "icon": "BlockIcons/6-4.png", + "function": "xbot_visual.win32.window.contains_element", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/if窗口包含.html", + "video": { + "time": "01:03" + }, + "inputs": [ + { + "name": "window", + "label": "窗口对象", + "required": true, + "tips": "选择一个窗口对象", + "type": "xbot.win32.window.Win32Window", + "autoFill": false, + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [ + { + "display": "根据操作目标自动匹配", + "value": "0" + } + ] + } + }, + { + "name": "content_type", + "label": "检测指定窗口是否", + "required": true, + "default": "10:contains_element", + "defaultDisplay": "包含元素", + "tips": "检测窗口是否存在某个元素", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "包含元素", + "value": "contains_element" + }, + { + "display": "不包含元素", + "value": "not_contains_element" + } + ] + } + }, + { + "name": "element", + "label": "操作目标", + "required": true, + "tips": "选择要操作的桌面软件元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + } + ] + }, + { + "name": "win32.window.exists", + "statement": "workflow.if", + "title": "IF 窗口存在", + "description": "检测指定窗口是否存在", + "comment": "检查窗口%window%是否是%window_status%", + "indent": "1", + "scope": "1", + "isCondition": true, + "icon": "BlockIcons/6-4.png", + "function": "xbot_visual.win32.window.exists", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.WindowExistedControl,ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.WindowExistedHandler" + } + ], + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/if窗口存在.html", + "video": { + "time": "01:50" + }, + "inputs": [ + { + "name": "window_type", + "label": "获取窗口方式", + "required": true, + "default": "10:window_instance", + "defaultDisplay": "窗口对象", + "tips": "选择获取窗口方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "窗口对象", + "value": "window_instance" + }, + { + "display": "捕获窗口元素", + "value": "window_selector" + }, + { + "display": "窗口标题或类型名", + "value": "win_title_or_class" + }, + { + "display": "窗口句柄", + "value": "win_handle" + } + ] + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "输入一个通过\"获取窗口对象\"获取的窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "从元素列表中选择一个录制好的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "handle", + "label": "窗口句柄", + "tips": "输入一个窗口句柄", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox" + } + }, + { + "name": "title", + "label": "窗口标题", + "tips": "选择或输入窗口标题", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "handle_checked", + "label": "", + "required": true, + "default": "13:False", + "tips": "添加窗口类型", + "type": "bool", + "editor": { + "label": "添加窗口类型", + "kind": "checkbox" + } + }, + { + "name": "class_name", + "label": "窗口类型", + "tips": "选择或输入窗口类型。一般用于标题相同的窗口有多个,无法只根据标题来区分窗口的情况", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "use_wildcard", + "label": "", + "required": true, + "default": "13:False", + "tips": "根据通配符匹配,比如‘*记事本’表示以’记事本‘结尾的任意文本", + "type": "bool", + "editor": { + "label": "根据通配符匹配", + "kind": "checkbox" + } + }, + { + "name": "window_status", + "label": "窗口是否", + "required": true, + "default": "10:existed", + "defaultDisplay": "存在", + "tips": "选择需要判断的窗口存在或不存在", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "存在", + "value": "existed" + }, + { + "display": "不存在", + "value": "not_existed" + } + ] + } + } + ] + }, + { + "name": "win32.window.wait_window", + "title": "等待窗口", + "description": "等待窗口发生状态变化", + "comment": "等待窗口%window%%wait_way%,最多等待%timeout%秒", + "icon": "BlockIcons/6-4.png", + "function": "xbot_visual.win32.window.wait_window", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Win32.WindowWaitControl,ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/等待/等待窗口.html", + "video": { + "time": "02:35" + }, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Win32.WindowWaitHandler" + } + ], + "inputs": [ + { + "name": "window_type", + "label": "获取窗口方式", + "required": true, + "tips": "选择获取窗口方式", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "window", + "label": "窗口对象", + "tips": "输入一个通过\"获取窗口对象\"获取的窗口对象", + "type": "xbot.win32.window.Win32Window", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "selector", + "label": "操作目标", + "tips": "从元素列表中选择一个录制好的窗口元素", + "type": "xbot.win32.element.Win32Element", + "editor": { + "kind": "uitarget", + "selectorType": "simple" + } + }, + { + "name": "handle", + "label": "窗口句柄", + "tips": "输入一个窗口句柄", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox" + } + }, + { + "name": "title", + "label": "窗口标题", + "tips": "输入窗口标题", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "handle_checked", + "label": "", + "required": true, + "default": "13:False", + "tips": "添加窗口类型", + "type": "bool", + "editor": { + "label": "添加窗口类型", + "kind": "checkbox" + } + }, + { + "name": "class_name", + "label": "窗口类型", + "tips": "输入窗口类型", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "wait_way", + "label": "等待状态", + "required": true, + "default": "10:appear", + "defaultDisplay": "存在", + "tips": "选择需要等待的窗口状态", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "存在", + "value": "appear" + }, + { + "display": "不存在", + "value": "disappear" + }, + { + "display": "激活", + "value": "be_focus" + }, + { + "display": "未激活", + "value": "lost_focus" + } + ] + } + }, + { + "name": "use_timeout", + "label": "", + "required": true, + "default": "13:True", + "tips": "设置超时时间, 如果不设置则一直等待", + "type": "bool", + "editor": { + "label": "设置超时时间", + "kind": "checkbox" + } + }, + { + "name": "timeout", + "label": "超时时间(s)", + "required": false, + "default": "10:20", + "tips": "请输入超时时间(单位:秒)", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "window_wait_result", + "label": "等待结果", + "tips": "窗口是否出现或消失的结果", + "name": "win_wait_result", + "type": "bool" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/word.blocks.json b/src/assert/block_settings/word.blocks.json new file mode 100644 index 0000000..9216156 --- /dev/null +++ b/src/assert/block_settings/word.blocks.json @@ -0,0 +1,1211 @@ +{ + "types": [ + { + "name": "Word.Document", + "localName": "Word对象", + "props": [] + } + ], + "blocks": [ + { + "name": "word.launch", + "title": "打开/新建Word", + "keywords": "新建word;打开word;启动word", + "icon": "BlockIcons/35-1.png", + "comment": "%launch_way%:%open_filename%,将Word对象保存到%word_instance%", + "description": "打开已有Word文件,或新建Word,以实现Word程序的自动化", + "function": "xbot_visual.word.launch", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Word.LaunchWordControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/启动word.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Word.LaunchWordHandler" + } + ], + "inputs": [ + { + "name": "launch_way", + "label": "启动方式", + "required": true, + "default": "10:open", + "defaultDisplay": "打开已有的Word", + "tips": "选择要新建一个Word文件还是打开一个Word文件", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "新建Word", + "value": "create" + }, + { + "display": "打开已有的Word", + "value": "open" + } + ] + } + }, + { + "name": "driver_way", + "label": "驱动方式", + "required": true, + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "自动检测", + "value": "auto_check" + }, + { + "display": "office", + "value": "office" + }, + { + "display": "wps", + "value": "wps" + } + ] + } + }, + { + "name": "open_filename", + "label": "Word文件路径", + "required": false, + "tips": "填写或选择要打开的Word文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "Word 工作簿|*.docx;*.doc" + } + } + }, + { + "name": "save_filename", + "label": "Word文件路径", + "required": false, + "tips": "填写打开的Word路径或保存Word的路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "defaultFileName": "Document", + "filter": "Word 工作簿|*.docx;*.doc" + } + } + }, + { + "name": "isvisible", + "label": "", + "default": "13:True", + "tips": "此选项并不会限制Word自动化的能力,只是用于控制可视化操作是否用户可见,如果是非可视化下操作Word,保存之后必须要关闭Word", + "type": "bool", + "editor": { + "label": "是否可视化", + "kind": "checkbox" + } + }, + { + "name": "open_password", + "label": "打开密码", + "category": "advanced", + "tips": "用于打开加密Word文件的打开密码", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "edit_password", + "label": "编辑密码", + "category": "advanced", + "tips": "用于打开加密Word文件编辑权限的编辑密码", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "word_instance", + "label": "保存Word对象至", + "variableLabel": "打开的Word对象", + "tips": "该变量保存的是Word对象,使用此Word对象可以对Word进行自动化操作", + "name": "word_instance", + "type": "Word.Document" + } + ] + }, + { + "name": "word.save", + "title": "保存Word", + "keywords": "另存为Word;导出Word", + "comment": "将Word对象%word_instance%%save_way%Word文件%filename%", + "description": "保存Word", + "icon": "BlockIcons/35-2.png", + "function": "xbot_visual.word.save", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Word.SaveWordControl,ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/保存word.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Word.SaveWordHandler" + } + ], + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "save_way", + "label": "保存方式", + "required": true, + "default": "10:save", + "defaultDisplay": "保存", + "tips": "保存对Word的更改或另存为到新的路径", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "保存", + "value": "save" + }, + { + "display": "另存为", + "value": "saveas" + } + ] + } + }, + { + "name": "filename", + "label": "Word文件路径", + "tips": "填写或选择要打开的Word文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "defaultFileName": "Document", + "filter": "Word 工作簿 (.docx)|*.docx" + } + } + }, + { + "name": "overwrite_file", + "label": "", + "default": "13:True", + "tips": "若文件已存在,又选择不覆盖,会报错提示文件已存在", + "type": "bool", + "editor": { + "label": "如果文件存在则覆盖", + "kind": "checkbox" + } + }, + { + "name": "is_close_after_save", + "label": "", + "default": "13:False", + "tips": "", + "type": "bool", + "editor": { + "label": "保存后关闭", + "kind": "checkbox" + } + } + ] + }, + { + "name": "word.close", + "title": "关闭Word", + "comment": "关闭Word", + "description": "关闭Word", + "icon": "BlockIcons/35-3.png", + "function": "xbot_visual.word.close", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Word.CloseWordControl,ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/关闭word.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Word.CloseWordHandler" + } + ], + "inputs": [ + { + "name": "operation", + "label": "操作", + "required": true, + "default": "10:close_specified", + "defaultDisplay": "关闭指定Word文件", + "tips": "选择要关闭一个指定的Word文件还是关闭所有Word文件", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "关闭指定Word文件", + "value": "close_specified" + }, + { + "display": "关闭所有Word文件", + "value": "close_all" + } + ] + } + }, + { + "name": "word_instance", + "label": "Word对象", + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "close_way", + "label": "关闭方式", + "required": true, + "default": "10:save", + "defaultDisplay": "保存", + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "不保存", + "value": "notsave" + }, + { + "display": "保存", + "value": "save" + }, + { + "display": "另存为", + "value": "saveas" + } + ] + } + }, + { + "name": "filename", + "label": "文件路径", + "tips": "填写或选择要打开的Word文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "defaultFileName": "Document", + "filter": "Word 工作簿 (.docx)|*.docx" + } + } + }, + { + "name": "overwrite_file", + "label": "", + "default": "13:True", + "tips": "若文件已存在,又选择不覆盖,会报错提示文件已存在", + "type": "bool", + "editor": { + "label": "如果文件存在则覆盖", + "kind": "checkbox" + } + }, + { + "name": "close_process", + "label": "关闭进程", + "required": true, + "default": "10:office", + "defaultDisplay": "office", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "office", + "value": "office" + }, + { + "display": "wps", + "value": "wps" + } + ] + } + }, + { + "name": "task_kill", + "label": "", + "required": true, + "default": "13:False", + "tips": "如果勾选,将强制结束属于当前用户的指定Word进程和由它启动的所有子进程", + "type": "bool", + "editor": { + "label": "终止Word进程", + "kind": "checkbox" + } + } + ] + }, + { + "name": "word.read_text_from_document", + "title": "读取Word文本", + "icon": "BlockIcons/35-5.png", + "comment": "从Word对象%document%中读取%read_range%中的文本,将结果保存到%word_text%", + "description": "从Word文件中读取文本", + "function": "xbot_visual.word.read_text_from_document", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/读取word文本.html", + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "read_range", + "label": "读取范围", + "required": true, + "default": "10:entire_document", + "defaultDisplay": "整个文档", + "tips": "提供Word内容读取范围", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "整个文档", + "value": "entire_document" + }, + { + "display": "选中区域", + "value": "select_area" + } + ] + } + } + ], + "outputs": [ + { + "id": "word_text", + "label": "保存Word内容为", + "variableLabel": "Word数据对象", + "tips": "指定一个变量名称,该变量用于保存域数据内容", + "name": "word_text", + "type": "any" + } + ] + }, + { + "name": "word.write_text_to_document", + "title": "写入文本至Word中", + "keywords": "写入word", + "icon": "BlockIcons/35-6.png", + "comment": "在Word对象%word_instance%文档当前选择区域中写入文本%content%", + "description": "在Word文档当前选择区域中写入或覆盖文本", + "function": "xbot_visual.word.write_text_to_document", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Word.WriteTextToDocumentControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/写入文本至word中.html", + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "content", + "label": "文本内容", + "required": true, + "tips": "写入到当前选择区域的文本", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "text_format", + "label": "文本格式", + "required": true, + "tips": "可直接在此设置简单的格式,复杂的格式可事先在Word中设置好,再点击编辑格式内的‘在Word中指出’提取", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "newline", + "label": "", + "default": "13:False", + "tips": "若勾选,则在写入前换行", + "type": "bool", + "editor": { + "label": "写入文本前换行", + "kind": "checkbox" + } + } + ] + }, + { + "name": "word.export_to_pdf", + "title": "Word导出PDF", + "icon": "BlockIcons/35-4.png", + "description": "将Word文档导出为PDF", + "comment": "将Word对象%word_instance%导出为PDF文件,将文件保存到%pdf_name%", + "function": "xbot_visual.word.export_to_pdf", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Word.WordExportToPDFControl,ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/word导出pdf.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Word.WordExportToPDFHandler" + } + ], + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "export_range", + "label": "导出范围", + "required": true, + "default": "10:0", + "defaultDisplay": "所有页面", + "tips": "提供多种Word导出范围", + "type": "int", + "editor": { + "kind": "select", + "options": [ + { + "display": "所有页面", + "value": 0 + }, + { + "display": "当前页面", + "value": 2 + }, + { + "display": "指定页面", + "value": 3 + }, + { + "display": "当前选区", + "value": 1 + } + ] + } + }, + { + "name": "page_from", + "label": "起始页数", + "tips": "要导出为PDF内容的起始页数", + "type": "int", + "default": "10:1", + "editor": { + "placeholder": "输入页数,从1开始", + "kind": "textbox" + } + }, + { + "name": "page_to", + "label": "结束页数", + "tips": "要导出为PDF内容的结束页数", + "type": "int", + "default": "10:1", + "editor": { + "placeholder": "输入页数,从1开始", + "kind": "textbox" + } + }, + { + "name": "pdf_name", + "label": "PDF保存到", + "tips": "填写要导出的PDF保存的文件名", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SaveFile", + "filter": "PDF|*.pdf" + } + } + }, + { + "name": "overwrite", + "label": "", + "default": "13:True", + "tips": "如果PDF文件存在则覆盖,PDF保存路径若不存在会自动创建", + "type": "bool", + "editor": { + "label": "如果文件存在则覆盖", + "kind": "checkbox" + } + } + ] + }, + { + "name": "word.locate_cursor", + "title": "定位Word光标", + "icon": "BlockIcons/35-7.png", + "description": "将Word文档中定位到指定位置的光标", + "comment": "在Word对象%word_instance%中定位光标,定位到文本%text_content%后", + "function": "xbot_visual.word.locate_cursor", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Word.LocateCursorControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/定位word光标.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Word.LocateCursorHandler" + } + ], + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "locate_type", + "label": "相对于", + "required": true, + "default": "10:text", + "defaultDisplay": "文本", + "tips": "选择定位类型", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "文本", + "value": "text" + }, + { + "display": "文档", + "value": "document" + }, + { + "display": "书签", + "value": "bookmark" + } + ] + } + }, + { + "name": "text_content", + "label": "文本内容", + "tips": "要定位的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "text_index", + "label": "文本出现的位置", + "tips": "文本出现的位置", + "type": "int", + "default": "10:1", + "editor": { + "placeholder": "1表示第一个,2表示第二个,以此类推,-2表示倒数第二个,-1表示最后一个", + "kind": "textbox" + } + }, + { + "name": "text_cursor_position", + "label": "光标定位到", + "required": true, + "default": "10:after_text", + "defaultDisplay": "文本后", + "tips": "选择光标定位在文本前面还是后面", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "文本前", + "value": "before_text" + }, + { + "display": "文本后", + "value": "after_text" + } + ] + } + }, + { + "name": "text_from_start", + "label": "", + "default": "13:True", + "tips": "若勾选,则从头开始查找,否则从当前位置开始", + "type": "bool", + "editor": { + "label": "从头开始查找文本", + "kind": "checkbox" + } + }, + { + "name": "document_cursor_position", + "label": "光标定位到", + "required": true, + "default": "10:end_document", + "defaultDisplay": "文档结尾", + "tips": "选择光标定位在文档开头还是结尾", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "文档开头", + "value": "begin_document" + }, + { + "display": "文档结尾", + "value": "end_document" + } + ] + } + }, + { + "name": "bookmark_name", + "label": "书签名称", + "tips": "要定位书签的名称", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "bookmark_cursor_position", + "label": "光标定位到", + "required": true, + "default": "10:after_bookmark", + "defaultDisplay": "书签后", + "tips": "选择光标定位在书签前面还是后面", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "书签前", + "value": "before_bookmark" + }, + { + "display": "书签后", + "value": "after_bookmark" + } + ] + } + } + ] + }, + { + "name": "word.move_cursor", + "title": "移动Word光标", + "icon": "BlockIcons/35-8.png", + "description": "移动Word文档中光标", + "comment": "在Word对象%word_instance%中%move_direction%%move_count%个字符单位长度光标", + "function": "xbot_visual.word.move_cursor", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/移动word光标.html", + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "move_direction", + "label": "移动方向", + "required": true, + "default": "10:move_right", + "defaultDisplay": "向右移动", + "tips": "选择光标移动方向", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "向左移动", + "value": "move_left" + }, + { + "display": "向上移动", + "value": "move_up" + }, + { + "display": "向右移动", + "value": "move_right" + }, + { + "display": "向下移动", + "value": "move_down" + } + ] + } + }, + { + "name": "move_count", + "label": "移动长度", + "tips": "输入需要移动的单位长度", + "type": "int", + "default": "10:1", + "editor": { + "placeholder": "需要移动的单位长度", + "kind": "textbox" + } + }, + { + "name": "press_shift", + "label": "", + "default": "13:False", + "tips": "若勾选,则在移动时按下shift键,移动区域的文本被选中", + "type": "bool", + "editor": { + "label": "是否按下Shift键", + "kind": "checkbox" + } + } + ] + }, + { + "name": "word.replace_text", + "title": "替换Word文本", + "icon": "BlockIcons/35-9.png", + "description": "替换Word文档中文本内容", + "comment": "将Word对象%word_instance%中文本%search_text%替换为%replace_text%,将替换个数保存到%replace_count%", + "function": "xbot_visual.word.replace_text", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/替换word文本.html", + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "search_text", + "label": "查找文本", + "required": true, + "tips": "要查找的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "replace_text", + "label": "替换为", + "tips": "要替换的文本", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "replace_all", + "label": "", + "default": "13:True", + "tips": "若勾选,则替换全部查找到的文本", + "type": "bool", + "editor": { + "label": "全部替换", + "kind": "checkbox" + } + }, + { + "name": "case_sensitive", + "label": "", + "default": "13:False", + "tips": "若勾选,则区分大小写", + "type": "bool", + "editor": { + "label": "区分大小写", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "replace_count", + "label": "保存文本替换个数至", + "variableLabel": "文本替换个数", + "tips": "指定一个变量名称,该变量用于保存文本替换个数", + "type": "int", + "name": "word_replace_count" + } + ] + }, + { + "name": "word.read_table_from_document", + "title": "读取Word表格", + "icon": "BlockIcons/35-10.png", + "description": "读取Word文档中表格内容", + "comment": "在%word_instance%中读取第%table_index%个表格内容,将数据存储到%table_data%", + "function": "xbot_visual.word.read_table_from_document", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Word.ReadTableFromDocumentControl, ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/读取word表格.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Word.ReadTableFromDocumentHandler" + } + ], + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "find_way", + "label": "表格查找方式", + "required": true, + "default": "10:index", + "defaultDisplay": "根据表格位置", + "tips": "选择一个表格查找方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "根据表格位置", + "value": "index" + }, + { + "display": "根据表格内容", + "value": "content" + } + ] + } + }, + { + "name": "table_index", + "label": "表格出现位置", + "tips": "输入表格出现位置", + "type": "int", + "default": "10:1", + "editor": { + "kind": "textbox" + } + }, + { + "name": "table_content", + "label": "表格查找内容", + "tips": "输入查找表格所需的内容", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "table_data", + "label": "表格内容保存至", + "variableLabel": "Word表格数据对象", + "tips": "指定一个变量名称,该变量用于保存区域数据内容", + "type": "any", + "name": "word_table_data" + } + ] + }, + { + "name": "word.insert_table", + "title": "插入Word表格", + "icon": "BlockIcons/35-11.png", + "description": "在Word文档中插入表格", + "comment": "在Word对象%word_instance%插入表格,表格数据为%table_data%", + "function": "xbot_visual.word.insert_table", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Word.InsertTableControl,ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/插入word表格.html", + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "table_data", + "label": "表格数据", + "required": true, + "tips": "内容的数据格式需要跟写入范围对应,写入行、列、区域的内容需要是列表类型", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "table_data_format", + "label": "表格数据格式", + "required": true, + "tips": "可直接在此设置简单的格式,复杂的格式可事先在Word中设置好,再点击编辑格式内的‘在Word中指出’提取", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "grid", + "label": "", + "default": "13:True", + "tips": "若勾选,则表格含有边框", + "type": "bool", + "editor": { + "label": "表格是否有边框", + "kind": "checkbox" + } + }, + { + "name": "newline", + "label": "", + "default": "13:False", + "tips": "若勾选,则在插入表格前换行", + "type": "bool", + "editor": { + "label": "插入表格前换行", + "kind": "checkbox" + } + } + ] + }, + { + "name": "word.insert_picture", + "title": "Word插入图片", + "icon": "BlockIcons/35-12.png", + "description": "在Word文档中插入图片", + "comment": "在Word对象%word_instance%中插入图片%image_path%,缩放比例为%image_scale%%", + "function": "xbot_visual.word.insert_picture", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Word.InsertPictureControl,ShadowBot.Shell.Development", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/插入图片.html", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.Word.InsertPictureHandler" + } + ], + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "image_source", + "label": "图片来源", + "required": true, + "default": "10:file", + "defaultDisplay": "本地图片", + "tips": "选择一个图片来源", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "本地图片", + "value": "file" + }, + { + "display": "剪贴板", + "value": "clipboard" + } + ] + } + }, + { + "name": "image_path", + "label": "图片路径", + "tips": "请选择硬盘上的图片路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "图片(*.jpg;*.bmp;*.png;*.pdf)|*.jpg;*.bmp;*.png;*.pdf" + } + } + }, + { + "name": "image_scale", + "label": "图像缩放百分比", + "tips": "插入图像的缩放比例", + "default": "10:100", + "type": "int", + "editor": { + "placeholder": "输入缩放比例", + "kind": "textbox" + } + }, + { + "name": "newline", + "label": "", + "default": "13:False", + "tips": "若勾选,则在插入图片前换行", + "type": "bool", + "editor": { + "label": "插入图片前换行", + "kind": "checkbox" + } + } + ] + }, + { + "name": "word.insert_hyperlink", + "title": "Word插入超链接", + "icon": "BlockIcons/35-13.png", + "description": "在Word文档中插入超链接", + "comment": "在Word对象%word_instance%中插入超链接%hyperlink_url%,显示文字为%text%", + "function": "xbot_visual.word.insert_hyperlink", + "helpUrl": "yddoc/language/zh-cn/指令文档/word/插入超链接.html", + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + }, + { + "name": "text", + "label": "要显示的文字", + "tips": "写在超链前的文字", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "若不输入,则显示超链接地址" + } + }, + { + "name": "hyperlink_url", + "label": "超链接地址", + "required": true, + "tips": "用于访问的超链接地址", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "newline", + "label": "", + "default": "13:False", + "tips": "若勾选,则在插入超链前换行", + "type": "bool", + "editor": { + "label": "插入超链前换行", + "kind": "checkbox" + } + } + ] + }, + { + "name": "word.copy", + "title": "拷贝Word内容", + "keywords": "复制word", + "icon": "BlockIcons/35-14.png", + "comment": "从Word对象%word_instance%中拷贝选择区域的内容", + "description": "从Word文件中拷贝内容", + "function": "xbot_visual.word.copy", + "helpUrl": "doc/指令文档/17Word/拷贝Word内容.html", + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + } + ] + }, + { + "name": "word.paste", + "title": "粘贴Word内容", + "icon": "BlockIcons/35-15.png", + "comment": "在Word对象%word_instance%当前选择区域中粘贴内容", + "description": "从Word文件中拷贝内容", + "function": "xbot_visual.word.paste", + "helpUrl": "doc/指令文档/17Word/粘贴Word内容.html", + "inputs": [ + { + "name": "word_instance", + "label": "Word对象", + "required": true, + "tips": "输入一个通过\"新建Word\"或\"打开Word\"创建的Word对象", + "type": "Word.Document", + "editor": { + "kind": "select", + "useVariableOptions": true + } + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/workflow.blocks.json b/src/assert/block_settings/workflow.blocks.json new file mode 100644 index 0000000..a2793b0 --- /dev/null +++ b/src/assert/block_settings/workflow.blocks.json @@ -0,0 +1,795 @@ +{ + "types": [], + "blocks": [ + { + "name": "workflow.if", + "statement": "workflow.if", + "function": "xbot_visual.workflow.test", + "title": "IF 条件", + "description": "条件判断开始标记", + "comment": "如果%operand1%%operator%%operand2%,则执行以下操作", + "indent": "1", + "scope": "1", + "isCondition": true, + "icon": "BlockIcons/6-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/if条件.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Workflow.ConditonalControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WorkFlow.ConditonalHandler" + } + ], + "inputs": [ + { + "name": "operand1", + "label": "对象1", + "required": true, + "tips": "输入前面指令创建的变量、Python表达式、文本或数字,与对象2进行比较", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "operator", + "label": "关系", + "required": true, + "default": "10:==", + "defaultDisplay": "等于", + "tips": "选择对象1和对象2的比较方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "等于", + "value": "==" + }, + { + "display": "不等于", + "value": "!=" + }, + { + "display": "大于", + "value": ">" + }, + { + "display": "大于等于", + "value": ">=" + }, + { + "display": "小于", + "value": "<" + }, + { + "display": "小于等于", + "value": "<=" + }, + { + "display": "包含", + "value": "in" + }, + { + "display": "不包含", + "value": "not in" + }, + { + "display": "等于True", + "value": "is true" + }, + { + "display": "等于False", + "value": "is false" + }, + { + "display": "是空值", + "value": "empty value" + }, + { + "display": "不是空值", + "value": "not empty value" + }, + { + "display": "以对象2开头", + "value": "starts with" + }, + { + "display": "不以对象2开头", + "value": "not starts with" + }, + { + "display": "以对象2结束", + "value": "ends with" + }, + { + "display": "不以对象2结束", + "value": "not ends with" + } + ] + } + }, + { + "name": "operand2", + "label": "对象2", + "tips": "输入前面指令创建的变量、Python表达式、文本或数字,与对象1进行比较", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "operator_options", + "label": "操作符参数", + "tips": "操作符参数不展示", + "default": "10:{}", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "workflow.elseif", + "statement": "workflow.elseif", + "function": "xbot_visual.workflow.test", + "title": "Else IF", + "description": "条件分支判断", + "comment": "如果%operand1%%operator%%operand2%,则执行以下操作", + "indent": "3", + "scope": "3", + "isCondition": true, + "icon": "BlockIcons/6-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/elseif.html", + "video": { + "time": "03:23" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Workflow.ConditonalControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WorkFlow.ConditonalHandler" + } + ], + "inputs": [ + { + "name": "operand1", + "label": "对象1", + "required": true, + "tips": "输入前面指令创建的变量、Python表达式、文本或数字,与对象2进行比较", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "operator", + "label": "关系", + "required": true, + "default": "10:==", + "defaultDisplay": "等于", + "tips": "选择对象1和对象2的比较方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "等于", + "value": "==" + }, + { + "display": "不等于", + "value": "!=" + }, + { + "display": "大于", + "value": ">" + }, + { + "display": "大于等于", + "value": ">=" + }, + { + "display": "小于", + "value": "<" + }, + { + "display": "小于等于", + "value": "<=" + }, + { + "display": "包含", + "value": "in" + }, + { + "display": "不包含", + "value": "not in" + }, + { + "display": "等于True", + "value": "is true" + }, + { + "display": "等于False", + "value": "is false" + }, + { + "display": "是空值", + "value": "empty value" + }, + { + "display": "不是空值", + "value": "not empty value" + }, + { + "display": "以对象2开头", + "value": "starts with" + }, + { + "display": "不以对象2开头", + "value": "not starts with" + }, + { + "display": "以对象2结束", + "value": "ends with" + }, + { + "display": "不以对象2结束", + "value": "not ends with" + } + ] + } + }, + { + "name": "operand2", + "label": "对象2", + "tips": "输入前面指令创建的变量、Python表达式、文本或数字,与对象1进行比较", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "operator_options", + "label": "操作符参数", + "tips": "操作符参数不展示", + "default": "10:{}", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "workflow.multiple_conditions_if", + "statement": "workflow.multiple_conditions_if", + "function": "xbot_visual.workflow.multiconditional_judgment", + "title": "IF 多条件", + "description": "条件判断开始标记", + "comment": "判断条件列表中的条件是否全部满足", + "indent": "1", + "scope": "1", + "isCondition": true, + "icon": "BlockIcons/6-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/if多条件.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Workflow.MultipleConditionalControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WorkFlow.MultipleConditonalHandler" + } + ], + "inputs": [ + { + "name": "relation", + "label": "条件关系", + "tips": "下面使用的条件将会以此关系进行合并得到最终的结果", + "default": "10:and", + "defaultDisplay": "符合以下全部条件", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "符合以下全部条件", + "value": "and" + }, + { + "display": "符合以下任意条件", + "value": "or" + } + ] + } + }, + { + "name": "conditionals", + "type": "str", + "lable": "条件列表", + "tips": "要使用的条件列表,可通过'添加条件'和条件后方的'x'按钮经行添加的添加或删除,至少保证使用一个条件", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "workflow.else", + "statement": "workflow.else", + "icon": "BlockIcons/6-2.png", + "indent": "3", + "scope": "3", + "canDebug": false, + "comment": "否则执行以下操作", + "description": "如果不满足前面IF指令中指定的条件,则执行以下操作", + "title": "Else", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/else.html", + "video": { + "time": "02:53" + } + }, + { + "name": "workflow.multiple_conditions_elseif", + "statement": "workflow.multiple_conditions_elseif", + "function": "xbot_visual.workflow.multiconditional_judgment", + "title": "Else IF 多条件", + "description": "条件分支判断", + "comment": "判断条件列表中的条件是否全部满足", + "indent": "3", + "scope": "3", + "isCondition": true, + "icon": "BlockIcons/6-5.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/elseif多条件.html", + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Workflow.MultipleConditionalControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WorkFlow.MultipleConditonalHandler" + } + ], + "inputs": [ + { + "name": "relation", + "label": "条件关系", + "tips": "下面使用得的条件将会以次关系进行合并等到最终的结果", + "default": "10:and", + "defaultDisplay": "符合以下全部条件", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "符合以下全部条件", + "value": "and" + }, + { + "display": "符合以下任意条件", + "value": "or" + } + ] + } + }, + { + "name": "conditionals", + "type": "str", + "lable": "条件列表", + "tips": "要使用的条件列表,可通过'添加条件'和条件后方的'x'按钮经行添加的添加或删除,至少保证使用一个条件", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "workflow.endif", + "statement": "workflow.endif", + "icon": "BlockIcons/6-3.png", + "indent": "2", + "scope": "2", + "isCondition": true, + "isPseudo": true, + "canDebug": false, + "description": "条件判断结束标记", + "comment": "结束判断", + "title": "End IF", + "helpUrl": "yddoc/language/zh-cn/指令文档/条件判断/endif.html", + "video": { + "time": "00:31" + } + }, + { + "name": "workflow.for", + "statement": "workflow.for", + "function": "xbot_visual.workflow.range_iterator", + "title": "For次数循环", + "description": "对一组指令进行指定次数的循环操作", + "comment": "从%start%开始到%stop%结束,递增值为%step%,将当前循环值保存到%loop_index%", + "indent": "1", + "scope": "1", + "isLoop": true, + "icon": "BlockIcons/7-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/for次数循环.html", + "video": { + "time": "02:40" + }, + "inputs": [ + { + "name": "start", + "label": "起始数", + "required": true, + "tips": "设置循环计数器的起点数值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "stop", + "label": "结束数", + "required": true, + "tips": "设置循环计数器的终点数值", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "step", + "label": "递增值", + "required": true, + "tips": "设置每次循环后递增的数值", + "type": "int", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "loop_index", + "label": "保存当前循环项至", + "variableLabel": "当前循环项", + "type": "int", + "tips": "输入一个名称作为保存当前循环数值的变量,从起始值开始,此变量的值将随每次循环的增量而变化", + "name": "loop_index" + } + ] + }, + { + "name": "workflow.while", + "statement": "workflow.while", + "function": "xbot_visual.workflow.test", + "title": "While条件循环", + "description": "当条件为真时,对一组指令进行循环操作", + "comment": "如果%operand1%%operator%%operand2%,则执行以下操作", + "indent": "1", + "scope": "1", + "isLoop": true, + "icon": "BlockIcons/7-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/while条件循环.html", + "video": { + "time": "02:55" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Workflow.ConditonalControl, ShadowBot.Shell.Development", + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WorkFlow.ConditonalHandler" + } + ], + "inputs": [ + { + "name": "operand1", + "label": "对象1", + "required": true, + "tips": "输入前面指令创建的变量、Python表达式、文本或数字,与对象2进行比较", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "operator", + "label": "关系", + "required": true, + "default": "10:==", + "defaultDisplay": "等于", + "tips": "选择对象1和对象2的比较方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "等于", + "value": "==" + }, + { + "display": "不等于", + "value": "!=" + }, + { + "display": "大于", + "value": ">" + }, + { + "display": "大于等于", + "value": ">=" + }, + { + "display": "小于", + "value": "<" + }, + { + "display": "小于等于", + "value": "<=" + }, + { + "display": "包含", + "value": "in" + }, + { + "display": "不包含", + "value": "not in" + }, + { + "display": "等于True", + "value": "is true" + }, + { + "display": "等于False", + "value": "is false" + }, + { + "display": "是空值", + "value": "empty value" + }, + { + "display": "不是空值", + "value": "not empty value" + }, + { + "display": "以对象2开头", + "value": "starts with" + }, + { + "display": "不以对象2开头", + "value": "not starts with" + }, + { + "display": "以对象2结束", + "value": "ends with" + }, + { + "display": "不以对象2结束", + "value": "not ends with" + } + ] + } + }, + { + "name": "operand2", + "label": "对象2", + "tips": "输入前面指令创建的变量、Python表达式、文本或数字,与对象1进行比较", + "type": "any", + "editor": { + "kind": "textbox" + } + }, + { + "name": "operator_options", + "label": "操作符参数", + "tips": "操作符参数不展示", + "default": "10:{}", + "type": "any", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "workflow.forin", + "statement": "workflow.forin", + "function": "xbot_visual.workflow.list_iterator", + "title": "ForEach列表循环", + "description": "依次循环列表中的每一项进行自动化操作", + "comment": "对列表%list%中的每一项进行循环操作,将当前循环项保存到%loop_item%", + "indent": "1", + "scope": "1", + "isLoop": true, + "handlers": [ + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.List.UseOutputTypeByInputListItemTypeHandler", + "settings": { + "inputName": "list", + "outputName": "loop_item" + } + }, + { + "name": "ShadowBot.Runtime.Development.Blockly.Handlers.WorkFlow.OutputForeachItemIndexHandler", + "settings": { + "inputName": "output_with_index", + "outputName": "loop_index" + } + } + ], + "icon": "BlockIcons/7-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/foreach列表循环.html", + "video": { + "time": "02:34" + }, + "settingsControl": "ShadowBot.Shell.Development.BlockSettings.Controls.Workflow.ForInControl, ShadowBot.Shell.Development", + "inputs": [ + { + "name": "list", + "label": "列表", + "required": true, + "tips": "输入列表项或者选择前面指令创建的列表。(列表:表示多个数据项的一组,如列表:[\"中国\",\"美国\",\"法国\"])", + "type": "list", + "editor": { + "kind": "textbox" + } + }, + { + "name": "loop_start_index", + "label": "循环开始位置", + "category": "advanced", + "required": false, + "default": "10:0", + "tips": "循环开始位置,0表示第一项", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "loop_end_index", + "label": "循环结束位置", + "category": "advanced", + "required": false, + "default": "10:-1", + "tips": "循环结束位置,-1表示倒数第一项,结果包含结束位置的项", + "type": "int", + "editor": { + "kind": "textbox" + } + }, + { + "name": "output_with_index", + "label": "", + "required": true, + "default": "13:False", + "tips": "是否输出循环项的位置", + "type": "bool", + "editor": { + "label": "输出循环项的位置", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "loop_item", + "label": "存储循环项至", + "variableLabel": "当前循环项", + "tips": "指定一个变量名称,保存当前的循环项(循环项可以为具体列表的一项、行或单元格)", + "type": "any", + "name": "loop_item" + }, + { + "id": "loop_index", + "label": "存储当前循环位置至", + "variableLabel": "当前循环项的位置", + "tips": "指定一个变量名称,用于存储一组相似元素中的当前循环项的位置", + "type": "int", + "name": "loop_item_index" + } + ] + }, + { + "name": "workflow.continue", + "statement": "workflow.continue", + "canDebug": false, + "icon": "BlockIcons/7-4.png", + "description": "忽略本次循环,继续下一次循环", + "comment": "忽略本次循环,继续下一次循环", + "title": "继续下一次循环", + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/继续下一次循环.html", + "video": { + "time": "03:37" + } + }, + { + "name": "workflow.break", + "statement": "workflow.break", + "canDebug": false, + "icon": "BlockIcons/7-5.png", + "description": "退出当前循环", + "comment": "退出当前循环", + "title": "退出循环", + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/循环退出.html", + "video": { + "time": "02:40" + } + }, + { + "name": "workflow.endloop", + "statement": "workflow.endloop", + "icon": "BlockIcons/7-6.png", + "indent": "2", + "scope": "2", + "isPseudo": true, + "description": "表示一个循环区域的结尾", + "comment": "表示一个循环区域的结尾", + "title": "循环结束标记", + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/循环结束.html", + "video": { + "time": "00:35" + } + }, + { + "name": "workflow.infinite_loop", + "statement": "workflow.infinite_loop", + "icon": "BlockIcons/7-2.png", + "title": "无限循环", + "comment": "无限循环", + "description": "无限循环", + "indent": "1", + "scope": "1", + "isLoop": true, + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/无限循环.html", + "video": { + "time": "04:01" + }, + "outputs": [ + { + "id": "loop_index", + "label": "存储当前循环位置至", + "variableLabel": "当前循环的位置", + "tips": "", + "type": "int", + "name": "loop_index" + } + ] + }, + { + "name": "workflow.loop_dict", + "statement": "excel.forin", + "function": "xbot_visual.workflow.dict_iterator", + "title": "ForEach字典循环", + "description": "依次循环字典中的每一项进行自动化操作", + "comment": "对字典%dict%中的每一项进行循环操作,当前循环项键名保存至变量%loop_key%中,键值保存至变量%loop_value%中", + "indent": "1", + "scope": "1", + "isLoop": true, + "icon": "BlockIcons/7-3.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/循环/foreach字典循环.html", + "inputs": [ + { + "name": "dict", + "label": "字典", + "required": true, + "tips": "输入字典或者选择前面指令创建的字典对象", + "type": "dict", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [ + { + "id": "loop_key", + "label": "存储循环项键名至", + "variableLabel": "当前循环项的键名", + "tips": "指定一个变量名称,保存当前的循环项的键名", + "type": "any", + "name": "loop_key" + }, + { + "id": "loop_value", + "label": "存储循环项键值至", + "variableLabel": "当前循环项的键值", + "tips": "指定一个变量名称,保存当前的循环项的键值", + "type": "any", + "name": "loop_value" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/workqueue.blocks.json b/src/assert/block_settings/workqueue.blocks.json new file mode 100644 index 0000000..49dd445 --- /dev/null +++ b/src/assert/block_settings/workqueue.blocks.json @@ -0,0 +1,279 @@ +{ + "types": [ + { + "name": "xbot_visual.workqueue.WorkQueueItem", + "localName": "工作队列项", + "props": [ + { + "name": "uuid", + "type": "str", + "label": "ID" + }, + { + "name": "name", + "type": "str", + "label": "名称" + }, + { + "name": "bizInfo", + "type": "str", + "label": "业务信息" + }, + { + "name": "description", + "type": "str", + "label": "结果注释" + }, + { + "name": "expireTime", + "type": "str", + "label": "过期时间" + }, + { + "name": "status", + "type": "str", + "label": "状态" + } + ] + } + ], + "blocks": [ + { + "name": "workqueue.enqueue", + "title": "新增队列项", + "icon": "BlockIcons/37-1.png", + "comment": "向%workqueue_id%中新增一个队列项%item_name%", + "description": "向选定的工作队列新增一个队列项", + "function": "xbot_visual.workqueue.enqueue", + "settingsControl": "ShadowBot.Shell.Console.BlockSettings.Controls.WorkQueue.AddQueueItemControl, ShadowBot.Shell.Console", + "helpUrl": "yddoc/command-doc/2fbe8545284581520bd51976a48a05b2.html", + "handlers": [ + + ], + "inputs": [ + { + "name": "workqueue_id", + "label": "队列名称", + "required": true, + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [] + } + }, + { + "name": "item_name", + "label": "队列项名称", + "required": true, + "tips": "名称将显示在队列管理列表中,作为不同队列项的区分", + "type": "str", + "editor": { + "kind": "textbox" + } + }, + { + "name": "item_priority", + "label": "队列项优先级", + "required": true, + "tips": "系统将优先执行优先级为“高”的队列项", + "default": "10:100", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "低", + "value": "200" + }, + { + "display": "中", + "value": "100" + }, + { + "display": "高", + "value": "0" + } + ] + } + }, + { + "name": "item_expiration", + "label": "过期时间", + "required": false, + "tips": "队列项在过期时间前都可以被执行,如果过期则不能被执行。若日期是文本,只支持常用格式,如:2020-02-02、2020/02/02 02:02:02、2020年2月2日 2时2分2秒等。", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "日期时间对象或文本" + } + }, + { + "name": "item_userdata", + "label": "业务信息", + "required": true, + "tips": "可以将队列处理过程中的业务信息放到这里", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [] + }, + { + "name": "workqueue.loop_queue", + "statement":"workqueue.loop_queue", + "title": "循环获取队列项", + "indent": "1", + "scope": "1", + "isLoop": true, + "icon": "BlockIcons/37-3.png", + "comment": "循环%workqueue_id%获取队列项,将当前循环项保存到%workqueue_item%中", + "description": "循环获取指定队列的队列项", + "function": "xbot_visual.workqueue.loop_queue", + "settingsControl": "ShadowBot.Shell.Console.BlockSettings.Controls.WorkQueue.LoopQueueControl, ShadowBot.Shell.Console", + "helpUrl": "yddoc/command-doc/59d825460617877868946ad09e34b35a.html", + "handlers": [ + + ], + "inputs": [ + { + "name": "workqueue_id", + "label": "队列名称", + "required": true, + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [] + } + } + ], + "outputs": [ + { + "id": "workqueue_item", + "label": "保存结果至", + "variableLabel": "当前执行的工作队列项", + "tips": "", + "type": "xbot_visual.workqueue.WorkQueueItem", + "name": "workqueue_item" + } + ] + }, + { + "name": "workqueue.update_item", + "title": "更新队列项", + "icon": "BlockIcons/37-2.png", + "comment": "更新队列项%workqueue_item%的处理结果", + "description": "更新当前队列项的处理结果", + "function": "xbot_visual.workqueue.update_item", + "settingsControl": "ShadowBot.Shell.Console.BlockSettings.Controls.WorkQueue.UpdateQueueItemControl, ShadowBot.Shell.Console", + "helpUrl": "yddoc/command-doc/c556682638137bb7a229ecf902a97de7.html", + "handlers": [ + + ], + "inputs": [ + { + "name": "workqueue_item", + "label": "队列项", + "required": true, + "tips": "", + "type": "xbot_visual.workqueue.WorkQueueItem", + "editor": { + "kind": "textbox" + } + }, + { + "name": "item_status", + "label": "处理结果", + "required": true, + "tips": "", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "已处理", + "value": "processed" + }, + { + "display": "异常", + "value": "exception" + } + ] + } + }, + { + "name": "item_description", + "required": false, + "label": "结果注释", + "tips": "执行过程中的额外的信息可以存储到这里,支持在队列管理后台查看和下载", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [] + }, + { + "name": "workqueue.reenqueue", + "title": "队列项重新排队", + "icon": "BlockIcons/37-4.png", + "comment": "将队列项%workqueue_item%重新入队", + "description": "将选定得队列项重新入列并设置新的过期时间", + "function": "xbot_visual.workqueue.reenqueue", + "settingsControl": "ShadowBot.Shell.Console.BlockSettings.Controls.WorkQueue.ReenqueueItemControl, ShadowBot.Shell.Console", + "helpUrl": "yddoc/command-doc/895a01cbbff19aa12773d5531f742436.html", + "handlers": [ + + ], + "inputs": [ + { + "name": "workqueue_item", + "label": "队列项", + "required": true, + "tips": "", + "type": "xbot_visual.workqueue.WorkQueueItem", + "editor": { + "kind": "textbox" + } + }, + { + "name": "item_effective_time", + "label": "生效时间", + "required": true, + "tips": "在设定的时间前,队列项将不会生效和分发。若日期是文本,只支持常用格式,如:2020-02-02、2020/02/02 02:02:02、2020年2月2日 2时2分2秒等。", + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "日期时间对象或文本" + } + }, + { + "name": "item_expire_time", + "label": "过期时间", + "tips": "可以设置一个新的过期时间,这个过期时间必须大于生效时间。若日期是文本,只支持常用格式,如:2020-02-02、2020/02/02 02:02:02、2020年2月2日 2时2分2秒等。", + "required": false, + "type": "str", + "editor": { + "kind": "textbox", + "placeholder": "日期时间对象或文本" + } + }, + { + "name": "item_description", + "label": "结果注释", + "required": false, + "tips": "执行过程中的额外的信息可以存储到这里,支持在队列管理后台查看和下载", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ], + "outputs": [] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/xbot_extensions.activity_temu_shop.blocks.json b/src/assert/block_settings/xbot_extensions.activity_temu_shop.blocks.json new file mode 100644 index 0000000..756e696 --- /dev/null +++ b/src/assert/block_settings/xbot_extensions.activity_temu_shop.blocks.json @@ -0,0 +1,2560 @@ +{ + "types": [], + "blocks": [ + { + "name": "xbot_extensions.activity_temu_shop.main", + "statement": "process.invoke_activity", + "title": "temu 商家后台扩展", + "keywords": "", + "description": "该指令集实现了商家后台登录, 数据采集等操作", + "comment": "", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/3e/bd/3ebd9158b49959177dbc223895f83830.png", + "function": "xbot_extensions.activity_temu_shop.main", + "helpUrl": null, + "extension": "temu 商家后台扩展", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.utils", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.activity_temu_shop.utils", + "helpUrl": null, + "extension": "temu 商家后台扩展", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.login", + "statement": "process.invoke_activity", + "title": "Temu-账号登录", + "keywords": "", + "description": "该指令实现了打开Temu账号,并进行自动登录的功能", + "comment": "在网页对象%web_page%中, 登录%username%账号进入Temu 商家后台", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/ad/c5/adc5107f9e1e9ad8db907ca86ec3eda2.png", + "function": "xbot_extensions.activity_temu_shop.login", + "helpUrl": "yddoc/rpa/771262214638489600", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "username", + "label": "账号", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入Temu商家后台账号" + }, + "category": "general" + }, + { + "name": "password", + "label": "密码", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "password" + }, + "category": "general" + }, + { + "name": "target_store", + "label": "选择店铺", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "选择登录一个指定的店铺,可为空,空则默认" + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.switch_store", + "statement": "process.invoke_activity", + "title": "Temu-切换店铺", + "keywords": "", + "description": "该指令实现了在Temu商家后台中,对店铺进行切换的功能", + "comment": "在网页对象 %web_page% 中,切换当前店铺为%store_name%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/31/47/31477b644e08ec7f8d1f218ee20eea7f.png", + "function": "xbot_extensions.activity_temu_shop.switch_store", + "helpUrl": "yddoc/rpa/771276199978946560", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "store_name", + "label": "店铺名称", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入完整的店铺名称" + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.reconciliation", + "statement": "process.invoke_activity", + "title": "Temu-卖家中心-对账中心-财务明细下载", + "keywords": "", + "description": "该指令实现了在Temu卖家中心中,对Temu卖家中心-对账中心-财务明细下载的功能", + "comment": "在网页对象 %web_page% 中,下载日期为%start_time%到%end_time%的报表,并保存于%file_path%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/c4/17/c4174b6a988d8f4e66ccb6bb8b10bb28.png", + "function": "xbot_extensions.activity_temu_shop.reconciliation", + "helpUrl": "yddoc/rpa/771278088904974336", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "start_time", + "label": "开始日期", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "选择报表开始日期,格式为YYYY-MM-DD" + }, + "category": "general" + }, + { + "name": "end_time", + "label": "结束日期", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "选择报表结束日期,格式为YYYY-MM-DD" + }, + "category": "general" + }, + { + "name": "file_folder", + "label": "保存文件夹", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写文件保存地址" + }, + "category": "general" + }, + { + "name": "file_name", + "label": "保存文件名", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写文件保存名称" + }, + "category": "general" + }, + { + "name": "confirm_download", + "label": "", + "required": false, + "tips": "", + "type": "bool", + "default": "13:True", + "editor": { + "kind": "checkbox", + "label": "是否完成下载报表" + }, + "category": "general" + }, + { + "name": "capital_flow", + "label": "资金流向", + "required": false, + "tips": "", + "type": "any", + "default": "13:", + "editor": { + "kind": "textbox", + "placeholder": "填写一个资金流向,若有多个则以列表的方式。如['xx', 'xx']" + }, + "category": "advanced" + }, + { + "name": "financial_type", + "label": "财务类型", + "required": false, + "tips": "", + "type": "any", + "default": "13:", + "editor": { + "kind": "textbox", + "placeholder": "填写一个财务,若有多个则以列表的方式。如['xx', 'xx']" + }, + "category": "advanced" + }, + { + "name": "fund_mix", + "label": "收支金额最小值", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "fund_max", + "label": "收支金额最大值", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "export_type", + "label": "导出内容", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + } + ], + "outputs": [ + { + "id": "file_path", + "label": "文件路径", + "name": "file_path", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.download_finance_report", + "statement": "process.invoke_activity", + "title": "Temu-下载财务明细报表", + "keywords": "", + "description": "该指令实现了对Temu的财务报表进行批量下载的功能", + "comment": "在网页对象 %web_page% 中,下载日期大于%date%的财务明细报表,并存于%file_folder%中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/43/df/43df879fde866d53a07d0e08874d3faf.png", + "function": "xbot_extensions.activity_temu_shop.download_finance_report", + "helpUrl": "yddoc/rpa/772992697877483520", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "date", + "label": "日期", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写日期,格式为YYYY-MM-DD/YYYY-MM-DD HH:mm:ss" + }, + "category": "general" + }, + { + "name": "file_folder", + "label": "保存文件夹", + "required": false, + "tips": "", + "type": "directory", + "default": "13:", + "editor": { + "kind": "textbox", + "placeholder": "填写一个报表文件的保存地址", + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.create_coupon", + "statement": "process.invoke_activity", + "title": "Temu-创建优惠券", + "keywords": "", + "description": "该指令实现了自动批量创建优惠券的功能", + "comment": "在网页对象%web_page%,创一个优惠券名称为%coupon_name%,时间为%start_time%到%end_time%的优惠券", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/59/dc/59dcff3891ed3be7c07da01e0492f777.png", + "function": "xbot_extensions.activity_temu_shop.create_coupon", + "helpUrl": "yddoc/rpa/793668557410856960", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "coupon_name", + "label": "优惠券名称", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "请输入自定义优惠券名称" + }, + "category": "general" + }, + { + "name": "start_time", + "label": "开始时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "请输入优惠券开始时间,格式为YYYY-MM-DD" + }, + "category": "general" + }, + { + "name": "end_time", + "label": "结束时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "请输入优惠券结束时间,格式为YYYY-MM-DD" + }, + "category": "general" + }, + { + "name": "coupon_file_path", + "label": "优惠券路径", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "请输入优惠券模板文件路径", + "dialog": { + "type": "OpenFile", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.balance_screenshot", + "statement": "process.invoke_activity", + "title": "Temu-资金中心-余额截图", + "keywords": "", + "description": "该指令实现了自动截取店铺内资金中心的余额", + "comment": "在网页对象 %web_page% 中,截图店铺余额的图片并报错于%folder_path%中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/12/63/1263a25df405d5cb85098f7c32e3b43b.png", + "function": "xbot_extensions.activity_temu_shop.balance_screenshot", + "helpUrl": "yddoc/rpa/775200191869087744", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "folder_path", + "label": "保存文件夹", + "required": false, + "tips": "截图保存文件夹路径", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "请选择存放截图的文件夹", + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "station", + "label": "站点名称", + "required": false, + "tips": "站点名称", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "截图命名时拼接站点名称" + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "img_path", + "label": "图片路径", + "name": "img_path", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.finish_data_export", + "statement": "process.invoke_activity", + "title": "Temu-结算数据-已到账数据导出", + "keywords": "", + "description": "该指令实现了对Temu的结算数据进行导出", + "comment": "在网页对象 %web_page% 中,选择%start_time%到%end_time%的报表进行导出,并保存于%file_path%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/93/8d/938d2d4c11018f8e48a5e32dc71c6946.png", + "function": "xbot_extensions.activity_temu_shop.finish_data_export", + "helpUrl": "yddoc/rpa/775258660518854656", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "start_time", + "label": "开始日期", + "required": false, + "tips": "输入报表开始日期", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写一个开始日期,格式为YYYY-MM-dd" + }, + "category": "general" + }, + { + "name": "end_time", + "label": "结束日期", + "required": false, + "tips": "输入报表结束日期", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写一个结束日期,格式为YYYY-MM-dd" + }, + "category": "general" + }, + { + "name": "area", + "label": "区域", + "required": false, + "tips": "区域", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "选择区域,如:全球,欧区" + }, + "category": "general" + }, + { + "name": "folder_path", + "label": "保存文件夹", + "required": false, + "tips": "保存文件夹的地址", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入一个存储保存文件的地址", + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "file_name", + "label": "保存文件名", + "required": false, + "tips": "自定义文件名称", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "自定义一个文件名称" + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "file_path", + "label": "文件路径", + "tips": "报表文件路径", + "name": "file_path", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.adjust_prices", + "statement": "process.invoke_activity", + "title": "Temu-调价管理-拒绝调价(全托)", + "keywords": "", + "description": "该指令实现了对全托平台进行拒绝调价的功能", + "comment": "在网页对象 %web_page% 中,对商品管理-调价管理-待买家确认里进行拒绝调价的行为,拒绝理由为%reason%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/2c/b8/2cb87e522d30aea6f31d266463a6e977.png", + "function": "xbot_extensions.activity_temu_shop.adjust_prices", + "helpUrl": "yddoc/rpa/777450086620012544", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "reason", + "label": "拒绝理由", + "required": false, + "tips": "拒绝理由,拒绝理由统一", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "请输入拒绝的理由,例:商品没有利润空间,已申报营销活动" + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.deliver_goods_opration", + "statement": "process.invoke_activity", + "title": "Temu-抢备货台", + "keywords": "", + "description": "该指令实现了将今日可发货的单批量加入发货台的功能", + "comment": "在网页对象 %web_page% 中,对今日可发货的单批量加入发货台", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/2f/09/2f09157e1acc6be08a35b6f445492223.png", + "function": "xbot_extensions.activity_temu_shop.deliver_goods_opration", + "helpUrl": "yddoc/rpa/777451922611036160", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "orders_num", + "label": "备货单号", + "required": false, + "tips": "", + "type": "any", + "default": "13:None", + "editor": { + "kind": "textbox", + "placeholder": "格式为:\"全部\",\"单号\",单号列表,例[”aaa“,\"bbb\"]" + }, + "category": "general" + }, + { + "name": "ready_type", + "label": "备货建议", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "可填紧急备货建议,普通备货建议等,默认为普通备货建议" + }, + "category": "general" + }, + { + "name": "retry_time", + "label": "重试次数", + "required": false, + "tips": "", + "type": "int", + "default": "13:3", + "editor": { + "kind": "spin" + }, + "category": "advanced" + } + ], + "outputs": [ + { + "id": "result", + "label": "添加结果", + "name": "result", + "type": "any" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.finishing_data_export", + "statement": "process.invoke_activity", + "title": "Temu-结算数据-结算中数据导出", + "keywords": "", + "description": "该指令实现了对Temu的结算中数据进行导出", + "comment": "在网页对象 %web_page% 中, 将结算数据-结算中款项的数据下载到%folder_path%\\%file_name%中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/2e/76/2e76e24a489bc896bfd5e2fc336466f4.png", + "function": "xbot_extensions.activity_temu_shop.finishing_data_export", + "helpUrl": "yddoc/rpa/779169399710244864", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "folder_path", + "label": "保存文件夹", + "required": false, + "tips": "保存文件夹的地址", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null, + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "file_name", + "label": "保存文件名", + "required": false, + "tips": "自定义文件名称", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "file_path", + "label": "保存路径", + "tips": "报表文件路径", + "name": "file_path", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.pending_data_export", + "statement": "process.invoke_activity", + "title": "Temu-结算数据-待处理数据导出", + "keywords": "", + "description": "该指令实现了对Temu的待处理数据进行导出", + "comment": "在网页对象 %web_page% 中, 将结算数据-结算中款项的数据下载到%folder_path% \\ %file_name%中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/2e/e5/2ee51e3991f95e96685260352768f3e9.png", + "function": "xbot_extensions.activity_temu_shop.pending_data_export", + "helpUrl": "yddoc/rpa/779170544240910336", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "folder_path", + "label": "保存文件夹", + "required": false, + "tips": "保存文件夹的地址", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null, + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "file_name", + "label": "保存文件名", + "required": false, + "tips": "自定义文件名称", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "file_path", + "label": "保存路径", + "tips": "报表文件路径", + "name": "file_path", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.active_record", + "statement": "process.invoke_activity", + "title": "Temu-营销活动-获取报名记录信息", + "keywords": "", + "description": "该指令实现了对全托平台进行获取报名记录信息的功能", + "comment": "在网页对象 %web_page% 中,选择%active_category%,%start_time%到%end_time%范围的报名记录存入到数据表格中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/5b/00/5b00ae2db01335b221009130c316cd2a.png", + "function": "xbot_extensions.activity_temu_shop.active_record", + "helpUrl": "yddoc/rpa/786141403486613504", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "active_category", + "label": "活动分类", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "start_time", + "label": "开始时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "end_time", + "label": "结束时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "active_type", + "label": "活动类型", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "SPU", + "label": "SPU", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "goods_num", + "label": "货号", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "active_status", + "label": "活动状态", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "end_status", + "label": "到期状态", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.sale_manage_info", + "statement": "process.invoke_activity", + "title": "Temu-销售管理-销售管理数据获取", + "keywords": "", + "description": "该指令实现了在Temu平台对销售管理数据进行获取的功能", + "comment": "在Temu销售管理网页%web_page%上,进行数据爬取", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/f8/cb/f8cb7d50c743efc4f2c63d9000c5862e.png", + "function": "xbot_extensions.activity_temu_shop.sale_manage_info", + "helpUrl": "yddoc/rpa/788326694266372096", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "data", + "label": "data", + "name": "data", + "type": "list" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.return_goods_info", + "statement": "process.invoke_activity", + "title": "Temu-库存管理-退货单数据获取", + "keywords": "", + "description": "该指令实现了对Temu进行退货单数据抓取的功能", + "comment": "在网页对象%web_page%上,抓取%start_time%到%end_time%的退货单并存入数据表格中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/51/a2/51a29bfb113dcd080083ee477f9b0122.png", + "function": "xbot_extensions.activity_temu_shop.return_goods_info", + "helpUrl": "yddoc/rpa/788382259556765696", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "start_time", + "label": "开始日期", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "end_time", + "label": "结束日期", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "odds_number", + "label": "退货单号", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "status", + "label": "弃货状态", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "discard_type", + "label": "退货类型", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "reason", + "label": "退货原因", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.sold_out_info", + "statement": "process.invoke_activity", + "title": "Temu-销售管理-售罄看板信息获取", + "keywords": "", + "description": "该指令实现了在Temu平台对售罄看板数据进行获取的功能", + "comment": "在网页对象%web_page%中,抓取可售天数为%available_start_day%到%available_end_day%的售罄看板信息,并存入到数据表格中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/62/90/629076d7dd480d2b61657b78cf0bc821.png", + "function": "xbot_extensions.activity_temu_shop.sold_out_info", + "helpUrl": "yddoc/rpa/788737790537986048", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "available_start_day", + "label": "起始库存可售天数", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "available_end_day", + "label": "结束库存可售天数", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.return_apply_data", + "statement": "process.invoke_activity", + "title": "Temu-库存管理-退货申请数据获取", + "keywords": "", + "description": "该指令实现了在Temu平台对退货申请数据进行获取的功能", + "comment": "在网页对象%web_page%中,将%start_time%到%end_time%的退货申请数据保存于数据表格中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/7d/1c/7d1c8f40404adc9df407c8f5c9d0ccdd.png", + "function": "xbot_extensions.activity_temu_shop.return_apply_data", + "helpUrl": "yddoc/rpa/790844049976418304", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "start_time", + "label": "开始时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入开始时间,格式为YYYY-MM-dd,例:2025-01-01" + }, + "category": "general" + }, + { + "name": "end_time", + "label": "结束时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入结束时间,格式为YYYY-MM-dd,例:2025-01-01" + }, + "category": "general" + }, + { + "name": "odds_number", + "label": "申请单号", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入指定的申请单号" + }, + "category": "advanced" + }, + { + "name": "SKC", + "label": "SKC", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入指定的SKC" + }, + "category": "advanced" + }, + { + "name": "stock", + "label": "备货单号", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入指定的备货单号" + }, + "category": "advanced" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.return_detail_data", + "statement": "process.invoke_activity", + "title": "Temu-库存管理-退货明细数据获取", + "keywords": "", + "description": "该指令实现了在Temu平台对退货明细数据进行获取的功能", + "comment": "在网页对%web_page%中,将%start_time%到%end_time%的退货明细数据存于数据表格中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/d5/c0/d5c01eb41550cfae5c94ace8de894108.png", + "function": "xbot_extensions.activity_temu_shop.return_detail_data", + "helpUrl": "/yddoc/rpa/790845108907802624", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "start_time", + "label": "开始时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入开始时间,格式为YYYY-MM-dd,例:2025-01-01" + }, + "category": "general" + }, + { + "name": "end_time", + "label": "结束时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入结束时间,格式为YYYY-MM-dd,例:2025-01-01" + }, + "category": "general" + }, + { + "name": "package_num", + "label": "退货包裹号", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入指定的快递包裹号" + }, + "category": "advanced" + }, + { + "name": "SKU", + "label": "SKU", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入指定的SKU" + }, + "category": "advanced" + }, + { + "name": "stock", + "label": "备货单号", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "输入指定的备货单号" + }, + "category": "advanced" + } + ], + "outputs": [ + { + "id": "data", + "label": "data", + "name": "data", + "type": "list" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.order_management", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.activity_temu_shop.order_management", + "helpUrl": null, + "extension": "temu 商家后台扩展", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.switch_area", + "statement": "process.invoke_activity", + "title": "Temu-卖家中心-切换区域", + "keywords": "", + "description": "该指令实现了在Temu-卖家中心切换区域的功能", + "comment": "在网页对象%web_page%中,将当前的区域切换成%area%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/55/e5/55e5a45b9fe4da8e6a56eeef3be2e262.png", + "function": "xbot_extensions.activity_temu_shop.switch_area", + "helpUrl": "yddoc/rpa/795933888705499136", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "area", + "label": "区域", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.comment_data", + "statement": "process.invoke_activity", + "title": "Temu-商品管理-评价管理数据获取", + "keywords": "", + "description": "该指令实现了对半托平台进行获取商品评价的功能", + "comment": "在网页对象%web_page%中,将%start_time%到%end_time%星级为%level%的评论数据保存到数据表格中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/87/c5/87c5005f3c6602274824602637337a0a.png", + "function": "xbot_extensions.activity_temu_shop.comment_data", + "helpUrl": "yddoc/rpa/798517129808707584", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "start_time", + "label": "开始时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写日期,格式为YYYY-MM-DD/YYYY-MM-DD" + }, + "category": "general" + }, + { + "name": "end_time", + "label": "结束时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写日期,格式为YYYY-MM-DD/YYYY-MM-DD" + }, + "category": "general" + }, + { + "name": "level", + "label": "星级", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写评论星级,例:'1星', 多个星级则[\"1星\",'2星']" + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.product_quality_dashboard", + "statement": "process.invoke_activity", + "title": "Temu-店铺品质指标获取", + "keywords": "", + "description": "该指令实现了对Temu的店铺品质指标获取", + "comment": "在网页对象%web_page%中,获取店铺品质指标并返回给%data_dict%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/47/8b/478b5f20924db75fdf043d84802ba79b.png", + "function": "xbot_extensions.activity_temu_shop.product_quality_dashboard", + "helpUrl": "yddoc/rpa/798530482961530880", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "data_dict", + "label": "店铺品质指标", + "name": "data_dict", + "type": "any" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.batch_participate_active", + "statement": "process.invoke_activity", + "title": "Temu-营销活动-批量报名活动", + "keywords": "", + "description": "该指令实现了对半托平台进行获取报名记录信息的功能", + "comment": "在网页对象%web_page%中,根据模板%file_path%批量报名活动", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/52/a0/52a0cd100d6694278faceb269044a9b8.png", + "function": "xbot_extensions.activity_temu_shop.batch_participate_active", + "helpUrl": "yddoc/rpa/798896040988516352", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "file_path", + "label": "文件地址", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.get_batch_active_module", + "statement": "process.invoke_activity", + "title": "Temu-营销活动-生成批量报名活动模板", + "keywords": "", + "description": "该指令实现了对半托平台进行生成批量报名活动的模板", + "comment": "在网页对象%web_page%中,生成活动类型为%active_type%,选择报名活动的站点为%active_site%,商品SPU为%SPU%的批量活动模板,并保存于%file_folder%\\%file_name%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/85/7b/857b9375e63711a64969fe6ad8b3f528.png", + "function": "xbot_extensions.activity_temu_shop.get_batch_active_module", + "helpUrl": "yddoc/rpa/798896080112013312", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "active_type", + "label": "报名活动类型", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "例:清仓甩卖,多个例:['清仓甩卖', '限时秒杀']" + }, + "category": "general" + }, + { + "name": "active_site", + "label": "选择活动站点", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "例:美国站,多个例:['美国站', '加拿大站']" + }, + "category": "general" + }, + { + "name": "SPU", + "label": "SPU", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "例:19999,多个例:['10099', '12333']" + }, + "category": "general" + }, + { + "name": "file_folder", + "label": "保存文件夹", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写保存文件夹地址", + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "file_name", + "label": "保存文件名", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写保存文件名" + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "file_path", + "label": "模板文件路径", + "name": "file_path", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.labor_bill", + "statement": "process.invoke_activity", + "title": "账户资金-财务明细-导出列表+账务详情", + "keywords": "", + "description": "该指令实现在temu下载财务明细导出列表 + 账务详情的账单数据", + "comment": "在网页对象 %web_page% 中, 下载日期为%start_time%到%end_time%的导出列表 + 账务详情报表并保存至%save_path_list%", + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.activity_temu_shop.labor_bill", + "helpUrl": "/yddoc/rpa/zh-CN/861217250444316672", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "start_time", + "label": "开始日期", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "选择报表开始日期,格式为YYYY-MM-DD" + }, + "category": "general" + }, + { + "name": "end_time", + "label": "结束日期", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "选择报表结束日期,格式为YYYY-MM-DD" + }, + "category": "general" + }, + { + "name": "file_folder", + "label": "保存文件夹", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "填写文件保存地址", + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "capital_flow", + "label": "资金流向", + "required": false, + "tips": "", + "type": "any", + "default": "13:", + "editor": { + "kind": "textbox", + "placeholder": "填写一个资金流向,若有多个则以列表的方式。如['xx', 'xx']" + }, + "category": "advanced" + }, + { + "name": "financial_type", + "label": "财务类型", + "required": false, + "tips": "", + "type": "any", + "default": "13:", + "editor": { + "kind": "textbox", + "placeholder": "填写一个财务,若有多个则以列表的方式。如['xx', 'xx']" + }, + "category": "advanced" + }, + { + "name": "fund_mix", + "label": "收支金额最小值", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "fund_max", + "label": "收支金额最大值", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "advanced" + }, + { + "name": "report_type", + "label": "下载清单", + "required": false, + "tips": "为空, 表示下载全部, \"全球,美国\"表示下载全球,美国", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "为空, 表示下载全部, \"全球,美国\"" + }, + "category": "advanced" + } + ], + "outputs": [ + { + "id": "save_path_list", + "label": "文件保存列表", + "name": "save_path_list", + "type": "list" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.test", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.activity_temu_shop.test", + "helpUrl": null, + "extension": "temu 商家后台扩展", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.account_balance_collection", + "statement": "process.invoke_activity", + "title": "Temu-资金中心-账户余额数据采集", + "keywords": "", + "description": "该指令实现了Temu店铺资金中心中的账户余额数据采集功能", + "comment": "在网页%web_page%中进行账户余额数据采集,结果保存至%输出结果%中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/54/37/54375af85fe3834d8a7f083059ed6d5f.png", + "function": "xbot_extensions.activity_temu_shop.account_balance_collection", + "helpUrl": "/yddoc/rpa/zh-CN/859620240341803008", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "web_page", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [] + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "输出结果", + "label": "输出结果", + "name": "输出结果", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.pending_data_screenshot", + "statement": "process.invoke_activity", + "title": "Temu-结算数据-待结算数据截图", + "keywords": "", + "description": "该指令实现了Temu结算数据模块的待结算数据自动截图的功能", + "comment": "在网页%web_page%中,进行待结算账户的截图,截图存放在%file_folder%文件夹下,截图完整路径保存至%file_path%中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/99/58/9958eb2f023321f23053ff0d4b609172.png", + "function": "xbot_extensions.activity_temu_shop.pending_data_screenshot", + "helpUrl": "/yddoc/rpa/zh-CN/859707965554581504", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "file_folder", + "label": "文件夹", + "required": false, + "tips": "文件夹路径", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "截图保存的文件夹位置", + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "station", + "label": "站点", + "required": false, + "tips": "站点", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "站点名称,只用于截图文件的命名拼接,不进行站点转换" + }, + "category": "general" + }, + { + "name": "web_page", + "label": "web_page", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "file_path", + "label": "文件路径", + "tips": "截图完整路径", + "name": "file_path", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.return_refund_collection", + "statement": "process.invoke_activity", + "title": "Temu-退货退款-数据采集", + "keywords": "", + "description": "该指令实现了Temu店铺的退货退款的数据自动采集功能", + "comment": "", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/c8/29/c8297dd00fcfff1877b273493029f2f8.png", + "function": "xbot_extensions.activity_temu_shop.return_refund_collection", + "helpUrl": null, + "extension": "temu 商家后台扩展", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.注入js代码", + "statement": "process.invoke_activity", + "title": "子流程1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.activity_temu_shop.process1", + "helpUrl": null, + "extension": "temu 商家后台扩展", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.test1", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.activity_temu_shop.test1", + "helpUrl": null, + "extension": "temu 商家后台扩展", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.goods_list_download", + "statement": "process.invoke_activity", + "title": "Temu-商品管理-商品列表下载", + "keywords": "", + "description": "该指令实现了Temu店铺商品管理模块的商品列表的自动下载", + "comment": "在网页%web_page%中,选择商品列表类型%goods_type%进行下载,下载保存在%file_folder%文件夹下,报表名称为%file_name%,报表完整路径保存至%file_path%中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/81/50/81509cf28d8fe8b1ed914c5535045ccf.png", + "function": "xbot_extensions.activity_temu_shop.goods_list_download", + "helpUrl": "/yddoc/rpa/zh-CN/862222205631148032", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [] + }, + "category": "general" + }, + { + "name": "goods_type", + "label": "goods_type", + "required": false, + "tips": "商品列表类型", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "商品列表类型 参数有 全部/在售中/未发布到站点/已下架" + }, + "category": "general" + }, + { + "name": "file_folder", + "label": "文件夹路径", + "required": false, + "tips": "报表保存的文件夹", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "报表下载保存的文件夹", + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "file_name", + "label": "文件名称", + "required": false, + "tips": "报表名称", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "报表名称", + "dialog": { + "type": "SaveFile", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "file_path", + "label": "输出结果", + "tips": "报表完整路径", + "name": "file_path", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.fix_web_download", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.activity_temu_shop.fix_web_download", + "helpUrl": null, + "extension": "temu 商家后台扩展", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.activity_temu_shop.traffic_analysis_collection", + "statement": "process.invoke_activity", + "title": "Temu-数据中心-流量分析数据采集", + "keywords": "", + "description": "该指令实现了Temu店铺数据中心模块的流量分析数据采集的功能", + "comment": "在网页%web_page%中选择%date_time%日期,进行数据采集,采集结果保存至%data%中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/11/1c/111c8c7e7b25a50c3395a39a58b72010.png", + "function": "xbot_extensions.activity_temu_shop.traffic_analysis_collection", + "helpUrl": "/yddoc/rpa/zh-CN/862230926765510656", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "date_time", + "label": "日期选择", + "required": false, + "tips": "日期选择", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "日期选择 参数有 昨日/今日/本周/本月/近7日/近30日" + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "data", + "label": "输出结果", + "tips": "输出结果", + "name": "data", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.active_data_export", + "statement": "process.invoke_activity", + "title": "Temu-数据中心-活动数据导出(全托)", + "keywords": "", + "description": "该指令实现了Temu全托店铺的活动数据导出", + "comment": "在网页%web_page%中,选择时间范围%time_range%,文件保存至%file_path%中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/25/17/2517754322b7338d6a09ff7a2a65c86a.png", + "function": "xbot_extensions.activity_temu_shop.active_data_export", + "helpUrl": "/yddoc/rpa/zh-CN/864316233210437632", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "网页对象", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "time_range", + "label": "时间范围", + "required": false, + "tips": "时间范围", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "时间范围,格式为 yyyy-mm-dd~yyyy-mm-dd" + }, + "category": "general" + }, + { + "name": "file_folder", + "label": "文件夹路径", + "required": false, + "tips": "文件夹路径", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "报表导出的文件夹位置", + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "file_name", + "label": "文件名称", + "required": false, + "tips": "文件名称", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "报表导出的名称", + "dialog": { + "type": "SaveFile", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "file_path", + "label": "输出路径", + "tips": "文件完整路径", + "name": "file_path", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.active_data_export_half", + "statement": "process.invoke_activity", + "title": "Temu-数据中心-活动数据导出(半托)", + "keywords": "", + "description": "该指令实现了temu半托店铺的数据导出", + "comment": "在网页%web_page%中,选择时间%time_range%,结果文件保存至%file_path%中", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/81/5e/815ee50a0c19345a5bb043400faf81ac.png", + "function": "xbot_extensions.activity_temu_shop.active_data_export_half", + "helpUrl": "/yddoc/rpa/zh-CN/864314324638539776", + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "web_page", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "time_range", + "label": "时间范围", + "required": false, + "tips": "时间范围", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "时间范围, 格式为yyyy-dd-mm~yyyy-dd-mm" + }, + "category": "general" + }, + { + "name": "file_folder", + "label": "文件夹路径", + "required": false, + "tips": "文件夹路径", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "导出的数据存储的文件夹位置", + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "file_name", + "label": "报表名称", + "required": false, + "tips": "文件名称", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "导出文件的名称", + "dialog": { + "type": "SaveFile", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "file_path", + "label": "输出路径", + "tips": "文件夹完整路径", + "name": "file_path", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.activity_temu_shop.declared_value", + "statement": "process.invoke_activity", + "title": "Temu-商品管理-申报价格", + "keywords": "", + "description": "该指令实现了temu店铺的价格自动申报", + "comment": "", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/39/41/39414c86f5f33f8e198ef56d4f605322.png", + "function": "xbot_extensions.activity_temu_shop.declared_value", + "helpUrl": null, + "extension": "temu 商家后台扩展", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "web_page", + "label": "web_page", + "required": false, + "tips": "网页对象", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true + }, + "category": "general" + }, + { + "name": "two_list", + "label": "two_list", + "required": false, + "tips": "用户传输的数据", + "type": "list", + "default": "13:[]", + "editor": { + "kind": "textbox", + "placeholder": "请传入一个二维列表,内容包含对应的原申报价格以及参考申报价格" + }, + "category": "general" + } + ], + "outputs": [] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/xbot_extensions.popup_detector.blocks.json b/src/assert/block_settings/xbot_extensions.popup_detector.blocks.json new file mode 100644 index 0000000..68c1423 --- /dev/null +++ b/src/assert/block_settings/xbot_extensions.popup_detector.blocks.json @@ -0,0 +1,348 @@ +{ + "types": [], + "blocks": [ + { + "name": "xbot_extensions.popup_detector.main", + "statement": "process.invoke_activity", + "title": "弹窗智能侦测器", + "keywords": "", + "description": "该指令集实现了自动侦测弹窗,并执行屏蔽弹窗,或者自定义操作", + "comment": "", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/92/80/92800ec38d8d165be91732ddee75bb2d.png", + "function": "xbot_extensions.popup_detector.main", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.js_script", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.js_script", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.popup_detector_core_old", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.popup_detector_core_old", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.A1 智能屏蔽弹窗(web)", + "statement": "process.invoke_activity", + "title": "智能屏蔽弹窗(web)", + "keywords": "", + "description": "该指令实现了全程智能侦测并屏蔽弹窗的操作", + "comment": "开始全程智能侦测并屏蔽弹窗~~~", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/92/80/92800ec38d8d165be91732ddee75bb2d.png", + "function": "xbot_extensions.popup_detector.process1", + "helpUrl": "https://ydrpa.yuque.com/org-wiki-ydrpa-xtutvv/ga4dm6/popup_detector", + "extension": "弹窗智能侦测器", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.utils", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.utils", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.A2 智能侦测弹窗(web)", + "statement": "process.invoke_activity", + "title": "智能侦测弹窗(web) 测试", + "keywords": "", + "description": "该指令实现了全程智能侦测并执行指定流程的操作", + "comment": "开始全程智能侦测弹窗,侦测到弹窗后执行流程%执行流程%,执行完后%执行流程后的操作%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/92/80/92800ec38d8d165be91732ddee75bb2d.png", + "function": "xbot_extensions.popup_detector.process2", + "helpUrl": "https://ydrpa.yuque.com/org-wiki-ydrpa-xtutvv/ga4dm6/popup_detector2", + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "执行流程", + "label": "执行流程", + "required": true, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "侦测到弹窗后,要执行的流程名" + }, + "category": "general" + }, + { + "name": "执行流程后的操作", + "label": "执行流程后的操作", + "required": true, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "select", + "useVariableOptions": false, + "options": [ + { + "display": "执行上个步骤", + "value": "执行上个步骤", + "Unicode": null + }, + { + "display": "执行下个步骤", + "value": "执行下个步骤", + "Unicode": null + } + ] + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.A3 移除智能侦测弹窗(web)", + "statement": "process.invoke_activity", + "title": "移除智能侦测弹窗(web)", + "keywords": "", + "description": "该指令实现了移除智能侦测弹窗的操作", + "comment": "移除智能侦测弹窗~~~", + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.process3", + "helpUrl": "https://ydrpa.yuque.com/org-wiki-ydrpa-xtutvv/ga4dm6/oy8nesf3b0eknzkr", + "extension": "弹窗智能侦测器", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.运行", + "statement": "process.invoke_activity", + "title": "子流程1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.process4", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.验证码", + "statement": "process.invoke_activity", + "title": "子流程1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.process5", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.popup_detector_core", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.popup_detector_core", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.聚水潭", + "statement": "process.invoke_activity", + "title": "子流程1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.process6", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.popup_xpath", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.popup_xpath", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.test", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.test", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.京东", + "statement": "process.invoke_activity", + "title": "子流程1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.process7", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.拼多多", + "statement": "process.invoke_activity", + "title": "子流程1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.process8", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.popup_detector.测试网页激活", + "statement": "process.invoke_activity", + "title": "子流程1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.popup_detector.process9", + "helpUrl": null, + "extension": "弹窗智能侦测器", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/xbot_extensions.super_browser.blocks.json b/src/assert/block_settings/xbot_extensions.super_browser.blocks.json new file mode 100644 index 0000000..4ced2d4 --- /dev/null +++ b/src/assert/block_settings/xbot_extensions.super_browser.blocks.json @@ -0,0 +1,1104 @@ +{ + "types": [], + "blocks": [ + { + "name": "xbot_extensions.super_browser.main", + "statement": "process.invoke_activity", + "title": "紫鸟控制台操作", + "keywords": "", + "description": "该指令集实现了紫鸟控制台的一些高频操作,如进入账号管理页面、打开店铺等待", + "comment": "", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/b1/37/b137094f228d10368c7f0a9d3c2e13b6.png", + "function": "xbot_extensions.super_browser.main", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.A1 进入账号管理页面", + "statement": "process.invoke_activity", + "title": "进入账号管理页面", + "keywords": "", + "description": "从紫鸟浏览器控制台进入账号管理页面", + "comment": "从紫鸟浏览器控制台进入账号管理页面", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/icons/activity-icons/01%E9%80%9A%E7%94%A8/contacts.png", + "function": "xbot_extensions.super_browser.to_account_page", + "helpUrl": "https://ydrpa.yuque.com/org-wiki-ydrpa-xtutvv/ga4dm6/to_account_page", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.A2 打开店铺", + "statement": "process.invoke_activity", + "title": "打开店铺", + "keywords": "", + "description": "该指令实现了根据店铺名称打开店铺的功能,调用这个指令会关闭正在打开的所有店铺", + "comment": "从紫鸟浏览器控制台打开店铺:%店铺名称%,%打开账号%打开账号,保存完整店铺名称至%完整店铺名称%,保存网页对象至%web_page%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/c0/44/c044ac003bfe6ff01f7876413092de94.png", + "function": "xbot_extensions.super_browser.open_store", + "helpUrl": "https://ydrpa.yuque.com/org-wiki-ydrpa-xtutvv/ga4dm6/open_store", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "店铺名称", + "label": "店铺名称", + "required": true, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "店铺名称" + }, + "category": "general" + }, + { + "name": "匹配类型", + "label": "匹配类型", + "required": true, + "tips": "", + "type": "str", + "default": "10:相等", + "editor": { + "kind": "select", + "useVariableOptions": false, + "options": [ + { + "display": "相等", + "value": "相等", + "Unicode": null + }, + { + "display": "模糊", + "value": "模糊", + "Unicode": null + } + ] + }, + "category": "general" + }, + { + "name": "打开账号", + "label": "打开账号", + "required": true, + "tips": "点击,打开店铺后,点击打开账号按钮\r\n不点击,打开店铺后,直接返回,需要注意这个时候网页对象为空", + "type": "str", + "default": "10:点击", + "editor": { + "kind": "select", + "useVariableOptions": false, + "options": [ + { + "display": "点击", + "value": "点击", + "Unicode": null + }, + { + "display": "不点击", + "value": "不点击", + "Unicode": null + } + ] + }, + "category": "general" + }, + { + "name": "隐私模式", + "label": "", + "required": false, + "tips": "使用隐私模式打开店铺", + "type": "bool", + "default": "13:False", + "editor": { + "kind": "checkbox", + "label": "隐私模式" + }, + "category": "general" + }, + { + "name": "超时时间", + "label": "超时时间", + "required": false, + "tips": "", + "type": "int", + "default": "13:50", + "editor": { + "kind": "spin" + }, + "category": "advanced" + } + ], + "outputs": [ + { + "id": "完整店铺名称", + "label": "完整店铺名称", + "name": "完整店铺名称", + "type": "str" + }, + { + "id": "web_page", + "label": "返回网页对象至", + "name": "web_page", + "type": "xbot._web.browser.WebBrowser" + } + ] + }, + { + "name": "xbot_extensions.super_browser.api", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.api", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.A3 获取下载文件保存位置", + "statement": "process.invoke_activity", + "title": "获取下载文件保存位置", + "keywords": "", + "description": "获取紫鸟浏览器默认下载文件保存位置", + "comment": "获取紫鸟浏览器默认下载文件保存位置,保存路径至:%download_path%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/icons/activity-icons/01%E9%80%9A%E7%94%A8/installing_updates.png", + "function": "xbot_extensions.super_browser.get_download_path", + "helpUrl": "https://ydrpa.yuque.com/org-wiki-ydrpa-xtutvv/ga4dm6/get_download_path", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [ + { + "id": "download_path", + "label": "保存位置", + "name": "download_path", + "type": "str" + }, + { + "id": "is_check", + "label": "是否询问保存位置", + "name": "is_check", + "type": "bool" + } + ] + }, + { + "name": "xbot_extensions.super_browser.A4 紫鸟登录", + "statement": "process.invoke_activity", + "title": "紫鸟登录", + "keywords": "", + "description": "该指令实现了自动打开紫鸟控制台,并登录企业号的操作", + "comment": "使用企业%企业名称%的账号%企业用户名%登录紫鸟控制台", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/86/5f/865f2062562ad9786b5a5feecf7173a2.png", + "function": "xbot_extensions.super_browser.process1", + "helpUrl": "https://ydrpa.yuque.com/org-wiki-ydrpa-xtutvv/ga4dm6/login", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "紫鸟版本", + "label": "紫鸟版本", + "required": false, + "tips": "", + "type": "str", + "default": "10:V5", + "editor": { + "kind": "select", + "useVariableOptions": false, + "options": [ + { + "display": "V5", + "value": "V5", + "Unicode": null + }, + { + "display": "V6", + "value": "V6", + "Unicode": null + } + ] + }, + "category": "general" + }, + { + "name": "企业名称", + "label": "企业名称", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "企业用户名", + "label": "企业用户名", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "密码", + "label": "密码", + "required": false, + "tips": "如果不填,则不会填写密码框", + "type": "str", + "default": "10:", + "editor": { + "kind": "password" + }, + "category": "general" + }, + { + "name": "是否填写账号密码", + "label": "", + "required": false, + "tips": "", + "type": "bool", + "default": "13:False", + "editor": { + "kind": "checkbox", + "label": "是否填写账号密码" + }, + "category": "general" + }, + { + "name": "是否退出登录", + "label": "", + "required": false, + "tips": "", + "type": "bool", + "default": "13:False", + "editor": { + "kind": "checkbox", + "label": "是否退出登录" + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.A5 紫鸟文件下载", + "statement": "process.invoke_activity", + "title": "紫鸟文件下载", + "keywords": "", + "description": "该指令实现了紫鸟浏览器网页端的文件下载操作", + "comment": "在网页%网页对象%中,通过下载按钮%下载按钮%下载文件,保存至文件夹%保存文件夹%,文件命名为%保存文件名%,输出下载文件路径至%download_file_name%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/images/be/3f/be3fdad2be1e3bbac93eeb86a4d94202.png", + "function": "xbot_extensions.super_browser.process2", + "helpUrl": "https://ydrpa.yuque.com/org-wiki-ydrpa-xtutvv/ga4dm6/superbrowser_download", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "网页对象", + "label": "网页对象", + "required": true, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [] + }, + "category": "general" + }, + { + "name": "下载按钮", + "label": "下载按钮", + "required": true, + "tips": "", + "type": "xbot._web.element.WebElement", + "default": "13:None", + "editor": { + "kind": "uitarget", + "selectorType": "simple", + "onlySelector": false + }, + "category": "general" + }, + { + "name": "保存文件夹", + "label": "保存文件夹", + "required": true, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null, + "dialog": { + "type": "SelectFolder", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "保存文件名", + "label": "保存文件名", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "非必填, 如果不填使用下载资源默认文件名, 若无默认文件名则自动为下载资源生成不重复的文件名" + }, + "category": "general" + }, + { + "name": "超时时间", + "label": "超时时间", + "required": true, + "tips": "等待文件下载超时时间,单位秒", + "type": "str", + "default": "10:100", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "等待对话框出现", + "label": "等待对话框出现", + "required": false, + "tips": "", + "type": "str", + "default": "10:20", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "download_file_name", + "label": "download_file_name", + "name": "download_file_name", + "type": "str" + } + ] + }, + { + "name": "xbot_extensions.super_browser.A6 获取店铺列表", + "statement": "process.invoke_activity", + "title": "获取店铺列表", + "keywords": "", + "description": "该指令实现了在紫鸟浏览器上获取指定平台的所有店铺名称操作", + "comment": "在紫鸟浏览器控制台上获取%所属平台%平台的所有店铺名称,输出至%store_name_list%", + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.process6", + "helpUrl": "https://ydrpa.yuque.com/org-wiki-ydrpa-xtutvv/ga4dm6/zsdzf6rxhhbcw369", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "所属平台", + "label": "所属平台", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": "选填,不填获取所有平台店铺。填写示例:亚马逊" + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "store_name_list", + "label": "店铺名称列表", + "name": "store_name_list", + "type": "list" + } + ] + }, + { + "name": "xbot_extensions.super_browser.utils", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.utils", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.download_api", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.download_api", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser._core_beta", + "statement": "process.invoke_activity", + "title": "module2", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser._core_beta", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.tool", + "statement": "process.invoke_activity", + "title": "module2", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.tool", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.A7 上传文件到紫鸟", + "statement": "process.invoke_activity", + "title": "上传文件到紫鸟", + "keywords": "", + "description": "该指令实现了从本地上传文件到紫鸟网页端的操作", + "comment": "在网页%网页对象%中点击%上传按钮%,在弹出的文件选择对话框中输入文件%上传文件路径%", + "icon": "https://winrobot-pub-a.oss-cn-hangzhou.aliyuncs.com/icons/activity-icons/01%E9%80%9A%E7%94%A8/upload_to_the_cloud.png", + "function": "xbot_extensions.super_browser.process7", + "helpUrl": "https://ydrpa.yuque.com/org-wiki-ydrpa-xtutvv/ga4dm6/super_browser-upload", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "网页对象", + "label": "网页对象", + "required": true, + "tips": "", + "type": "xbot._web.browser.WebBrowser", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [] + }, + "category": "general" + }, + { + "name": "上传按钮", + "label": "上传按钮", + "required": true, + "tips": "选择要点击上传按钮对应的网页元素", + "type": "xbot._web.element.WebElement", + "default": "13:None", + "editor": { + "kind": "uitarget", + "selectorType": "simple", + "onlySelector": false + }, + "category": "general" + }, + { + "name": "上传文件路径", + "label": "上传文件路径", + "required": false, + "tips": "待上传文件完整路径, 若要选择多个文件,切换到Python模式下,输入文件列表,比如:[\"文件1路径\", \"文件2路径\"]", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null, + "dialog": { + "type": "OpenFile", + "filter": "所有文件|*.*", + "defaultFileName": null, + "maxSize": null + } + }, + "category": "general" + }, + { + "name": "等待对话框超时时间", + "label": "等待对话框超时时间", + "required": false, + "tips": "", + "type": "str", + "default": "10:20", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.ziniao_v6", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.ziniao_v6", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.utils_v6", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.utils_v6", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.测试-打开店铺", + "statement": "process.invoke_activity", + "title": "子流程1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.process8", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.ziniao_v5", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.ziniao_v5", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.create_instance_api", + "statement": "process.invoke_activity", + "title": "连接紫鸟开放平台(API)🆕", + "keywords": "", + "description": "该指令通过紫鸟开放平台创建实例用于接口调用", + "comment": "通%app_id%连接紫鸟开放平台, 并返回实例保存至%ziniao_instance%", + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.create_instance_api", + "helpUrl": "yddoc/rpa/811841706059862016", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "app_id", + "label": "应用 ID", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "private_key", + "label": "应用 Key", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "password" + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "ziniao_instance", + "label": "紫鸟对象", + "name": "ziniao_instance", + "type": "any" + } + ] + }, + { + "name": "xbot_extensions.super_browser.get_user_list_api", + "statement": "process.invoke_activity", + "title": "获取用户列表(API)🆕", + "keywords": "", + "description": "通过紫鸟开放平台获取公司全部的账号信息", + "comment": "获取%ziniao_instance%对象的全部紫鸟账号保存至%user_list%", + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.get_user_list_api", + "helpUrl": "yddoc/rpa/811841790265470976", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "ziniao_instance", + "label": "紫鸟对象", + "required": false, + "tips": "", + "type": "any", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [] + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "user_list", + "label": "用户列表", + "name": "user_list", + "type": "list" + } + ] + }, + { + "name": "xbot_extensions.super_browser.get_store_list_api", + "statement": "process.invoke_activity", + "title": "获取店铺列表(API)🆕", + "keywords": "", + "description": "通过接口获取指定账号下的全部店铺ID", + "comment": "通过%ziniao_instance%获取%user_id%账号下的全部店铺保存至%store_list%", + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.get_store_list_api", + "helpUrl": "yddoc/rpa/811841836088242176", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "ziniao_instance", + "label": "紫鸟对象", + "required": false, + "tips": "", + "type": "any", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [] + }, + "category": "general" + }, + { + "name": "user_id", + "label": "用户ID", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "store_list", + "label": "店铺列表", + "name": "store_list", + "type": "list" + } + ] + }, + { + "name": "xbot_extensions.super_browser.open_store_api", + "statement": "process.invoke_activity", + "title": "打开店铺(API)🆕", + "keywords": "", + "description": "该指令通过开放接口打开紫鸟店铺", + "comment": "通过%ziniao_instance%打开ID为%strore_id%的店铺", + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.open_store_api", + "helpUrl": "yddoc/rpa/811841875958067200", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "ziniao_instance", + "label": "紫鸟对象", + "required": false, + "tips": "", + "type": "any", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [] + }, + "category": "general" + }, + { + "name": "user_id", + "label": "用户ID", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "strore_id", + "label": "店铺ID", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "timeout", + "label": "超时时间", + "required": false, + "tips": "单位, 为秒", + "type": "int", + "default": "13:30", + "editor": { + "kind": "spin" + }, + "category": "advanced" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.close_store_api", + "statement": "process.invoke_activity", + "title": "关闭店铺(API)🆕", + "keywords": "", + "description": "该指令通过接口关闭指点的店铺", + "comment": "通过%ziniao_instance%关闭ID为%store_id%的店铺", + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.close_store_api", + "helpUrl": "yddoc/rpa/811841916295155712", + "extension": "紫鸟控制台操作", + "hidden": false, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "ziniao_instance", + "label": "紫鸟对象", + "required": false, + "tips": "", + "type": "any", + "default": "13:None", + "editor": { + "kind": "select", + "useVariableOptions": true, + "options": [] + }, + "category": "general" + }, + { + "name": "store_id", + "label": "店铺 ID", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + } + ], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.ziniaoapi", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.ziniaoapi", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.ziniaogui", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.ziniaogui", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.close_app_api", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.close_app_api", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + }, + { + "name": "xbot_extensions.super_browser.open_store_beta", + "statement": "process.invoke_activity", + "title": "打开店铺(V6_Beta)", + "keywords": "", + "description": "测试紫鸟V6使用情况,并不是最终结果,试用!!", + "comment": "", + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.open_store_beta", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [ + { + "name": "store_name", + "label": "店铺名称", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + }, + { + "name": "locate_type", + "label": "匹配类型", + "required": false, + "tips": "", + "type": "str", + "default": "10:", + "editor": { + "kind": "textbox", + "placeholder": null + }, + "category": "general" + } + ], + "outputs": [ + { + "id": "web_page", + "label": "网页", + "name": "web_page", + "type": "xbot._web.browser.WebBrowser" + } + ] + }, + { + "name": "xbot_extensions.super_browser.test_tmp", + "statement": "process.invoke_activity", + "title": "module1", + "keywords": "", + "description": null, + "comment": null, + "icon": "BlockIcons/21-2.png", + "function": "xbot_extensions.super_browser.test_tmp", + "helpUrl": null, + "extension": "紫鸟控制台操作", + "hidden": true, + "canDebug": true, + "isCondition": false, + "isLoop": false, + "isPseudo": false, + "inputs": [], + "outputs": [] + } + ] +} \ No newline at end of file diff --git a/src/assert/block_settings/zip.blocks.json b/src/assert/block_settings/zip.blocks.json new file mode 100644 index 0000000..2fb3956 --- /dev/null +++ b/src/assert/block_settings/zip.blocks.json @@ -0,0 +1,146 @@ +{ + "types": [], + "blocks": [ + { + "name": "xzip.zip", + "function": "xbot_visual.xzip.zip", + "title": "压缩文件/文件夹", + "description": "这个指令用于压缩文件/文件夹", + "comment": "将%file_folder_path%压缩到%zip_file_path%", + "icon": "BlockIcons/30-1.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/压缩、解压/压缩文件(文件夹).html", + "inputs": [ + { + "name": "file_folder_path", + "label": "要压缩的文件(夹)", + "required": true, + "tips": "输入或选择要压缩的文件或文件夹路径", + "type": "str", + "editor": { + "placeholder": "待压缩的文件/文件夹", + "kind": "textbox", + "dialog": { + "type": "OpenFiles" + } + } + }, + { + "name": "password", + "label": "密码", + "required": false, + "tips": "输入密码;若不设置密码,请留空", + "type": "str", + "editor": { + "placeholder": "输入压缩文件路径", + "kind": "password" + } + }, + { + "name": "compress_level", + "label": "压缩方式", + "required": true, + "default": "10:5", + "defaultDisplay": "通用", + "tips": "请选择压缩方式", + "type": "str", + "editor": { + "kind": "select", + "options": [ + { + "display": "通用", + "value": "5" + }, + { + "display": "压缩最快", + "value": "1" + }, + { + "display": "压缩最多", + "value": "9" + } + ] + } + }, + { + "name": "zip_file_path", + "label": "压缩文件保存至", + "required": true, + "tips": "请输入压缩文件保存路径,只支持压缩成zip文件", + "type": "str", + "editor": { + "kind": "textbox" + } + } + ] + }, + { + "name": "xzip.unzip", + "function": "xbot_visual.xzip.unzip", + "title": "解压文件/文件夹", + "description": "这个指令用于解压文件/文件夹", + "comment": "将%zip_file_path%解压到%unzip_dir_path%,将解压文件夹路径保存到%folder%", + "icon": "BlockIcons/30-2.png", + "helpUrl": "yddoc/language/zh-cn/指令文档/操作系统/压缩、解压/解压文件(文件夹).html", + "inputs": [ + { + "name": "zip_file_path", + "label": "压缩文件路径", + "required": true, + "tips": "请输入压缩文件路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "OpenFile", + "filter": "zip文件 (.zip)|*.zip" + } + } + }, + { + "name": "password", + "label": "解压密码", + "required": false, + "tips": "输入解压密码,若没有则留空", + "type": "str", + "editor": { + "kind": "password" + } + }, + { + "name": "unzip_dir_path", + "label": "解压文件夹路径", + "required": true, + "tips": "请输入解压文件夹路径", + "type": "str", + "editor": { + "kind": "textbox", + "dialog": { + "type": "SelectFolder" + } + } + }, + { + "name": "create_dedicated_folder", + "label": "", + "default": "13:True", + "tips": "解压至与压缩文件同名的文件夹中", + "type": "bool", + "editor": { + "label": "创建同名文件夹", + "kind": "checkbox" + } + } + ], + "outputs": [ + { + "id": "folder", + "label": "保存文件夹路径至", + "variableLabel": "解压后的文件夹路径", + "tips": "指定一个变量名称,该变量用于保存文件夹路径", + "name": "folder", + "type": "str" + } + ] + } + ] +} \ No newline at end of file diff --git a/src/assert/icon-big.ico b/src/assert/icon-big.ico new file mode 100644 index 0000000..b4a88b7 Binary files /dev/null and b/src/assert/icon-big.ico differ diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..54bf61e --- /dev/null +++ b/src/main.py @@ -0,0 +1,19 @@ +from datetime import datetime +import os +import sys +import uuid + +# 添加项目根目录到Python路径 +project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if project_root not in sys.path: + sys.path.append(project_root) + +from Xbot.XbotAppCreator import create_and_import_app, create_and_import_app_for_convert + + +if __name__ == "__main__": + # 使用当前时间生成应用名称,格式:YYYYMMDD_HHMMSS + app_name = datetime.now().strftime("%Y%m%d_%H%M") + temp_path = r'D:\env_text\xbot_build\data\dialog_result.json' + print(f"使用时间戳作为应用名称: {app_name}") + create_and_import_app(app_name, temp_path) diff --git a/src/main_test.py b/src/main_test.py new file mode 100644 index 0000000..d9536f1 --- /dev/null +++ b/src/main_test.py @@ -0,0 +1,19 @@ +from datetime import datetime +import os +import sys +import uuid + +# 添加项目根目录到Python路径 +project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if project_root not in sys.path: + sys.path.append(project_root) + +from Xbot.XbotAppCreator import create_and_import_app, create_and_import_app_for_convert, create_and_import_app_test + + +if __name__ == "__main__": + # 使用当前时间生成应用名称,格式:YYYYMMDD_HHMMSS + app_name = datetime.now().strftime("%Y%m%d_%H%M") + temp_path = r'D:\env_text\xbot_build\data\test.json' + print(f"使用时间戳作为应用名称: {app_name}") + create_and_import_app_test(app_name, temp_path) diff --git a/tests/create_xbot_app.py b/tests/create_xbot_app.py new file mode 100644 index 0000000..c1c43b1 --- /dev/null +++ b/tests/create_xbot_app.py @@ -0,0 +1,20 @@ +from datetime import datetime +import os +import sys +import uuid + +# 添加项目根目录到Python路径 +project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +if project_root not in sys.path: + sys.path.append(project_root) + +from Xbot.XbotAppCreator import create_and_import_app, create_and_import_app_for_convert + + +if __name__ == "__main__": + # 使用当前时间生成应用名称,格式:YYYYMMDD_HHMMSS + app_name = datetime.now().strftime("%Y%m%d_%H%M") + + print(f"使用时间戳作为应用名称: {app_name}") + create_and_import_app(app_name) + \ No newline at end of file