mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-10-09 23:13:22 +08:00
automation实现inspect元素
This commit is contained in:
@@ -85,7 +85,9 @@ export default {
|
||||
},
|
||||
// 判断是否是转为表格的结果,表格结果不需要换行,第二行一般包含分隔符---
|
||||
isTable() {
|
||||
return this.runResult?.[0]?.split("\n")?.[1]?.includes("---");
|
||||
const result = this.runResult?.[0];
|
||||
if (typeof result !== "string") return false;
|
||||
return result.split("\n")?.[1]?.includes("---");
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
@@ -37,13 +37,7 @@ export default defineComponent({
|
||||
},
|
||||
// 通用参数配置
|
||||
commonConfig() {
|
||||
return (
|
||||
// 过滤掉特定函数排除的参数, excludeConfig格式为[要排除的参数索引]
|
||||
this.modelValue.config?.filter(
|
||||
(_, index) =>
|
||||
!this.getSelectSubCommand()?.excludeConfig?.includes(index)
|
||||
) || []
|
||||
);
|
||||
return this.modelValue.config || [];
|
||||
},
|
||||
// 特定函数独有参数配置,config格式和通用的config一致
|
||||
subCommandConfig() {
|
||||
|
@@ -53,14 +53,7 @@ export const networkCommands = {
|
||||
label: "URL操作",
|
||||
desc: "URL解析、格式化和参数处理",
|
||||
icon: "link",
|
||||
config: [
|
||||
{
|
||||
label: "URL",
|
||||
component: "VariableInput",
|
||||
icon: "link",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
config: [],
|
||||
subCommands: [
|
||||
{
|
||||
value: "quickcomposer.network.url.parse",
|
||||
@@ -71,7 +64,6 @@ export const networkCommands = {
|
||||
value: "quickcomposer.network.url.format",
|
||||
label: "格式化URL",
|
||||
icon: "link",
|
||||
excludeConfig: [0],
|
||||
config: [
|
||||
{
|
||||
label: "协议",
|
||||
@@ -120,7 +112,6 @@ export const networkCommands = {
|
||||
value: "quickcomposer.network.url.parseQuery",
|
||||
label: "解析查询字符串",
|
||||
icon: "search",
|
||||
excludeConfig: [0],
|
||||
config: [
|
||||
{
|
||||
label: "查询字符串",
|
||||
@@ -133,7 +124,6 @@ export const networkCommands = {
|
||||
value: "quickcomposer.network.url.formatQuery",
|
||||
label: "格式化查询字符串",
|
||||
icon: "edit",
|
||||
excludeConfig: [0],
|
||||
config: [
|
||||
{
|
||||
label: "参数",
|
||||
@@ -146,7 +136,6 @@ export const networkCommands = {
|
||||
value: "quickcomposer.network.url.parsePath",
|
||||
label: "解析路径",
|
||||
icon: "folder_open",
|
||||
excludeConfig: [0],
|
||||
config: [
|
||||
{
|
||||
label: "路径",
|
||||
@@ -159,7 +148,6 @@ export const networkCommands = {
|
||||
value: "quickcomposer.network.url.parseHost",
|
||||
label: "解析主机名",
|
||||
icon: "dns",
|
||||
excludeConfig: [0],
|
||||
config: [
|
||||
{
|
||||
label: "主机名",
|
||||
@@ -173,6 +161,12 @@ export const networkCommands = {
|
||||
label: "获取参数",
|
||||
icon: "find_in_page",
|
||||
config: [
|
||||
{
|
||||
label: "URL",
|
||||
component: "VariableInput",
|
||||
icon: "link",
|
||||
width: "auto",
|
||||
},
|
||||
{
|
||||
label: "参数名",
|
||||
component: "VariableInput",
|
||||
@@ -186,6 +180,12 @@ export const networkCommands = {
|
||||
label: "添加参数",
|
||||
icon: "add_circle",
|
||||
config: [
|
||||
{
|
||||
label: "URL",
|
||||
component: "VariableInput",
|
||||
icon: "link",
|
||||
width: "auto",
|
||||
},
|
||||
{
|
||||
label: "参数名",
|
||||
component: "VariableInput",
|
||||
@@ -205,6 +205,12 @@ export const networkCommands = {
|
||||
label: "移除参数",
|
||||
icon: "remove_circle",
|
||||
config: [
|
||||
{
|
||||
label: "URL",
|
||||
component: "VariableInput",
|
||||
icon: "link",
|
||||
width: "auto",
|
||||
},
|
||||
{
|
||||
label: "参数名",
|
||||
component: "VariableInput",
|
||||
@@ -217,11 +223,27 @@ export const networkCommands = {
|
||||
value: "quickcomposer.network.url.isAbsolute",
|
||||
label: "检查绝对URL",
|
||||
icon: "check_circle",
|
||||
config: [
|
||||
{
|
||||
label: "URL",
|
||||
component: "VariableInput",
|
||||
icon: "link",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.parseComponents",
|
||||
label: "解析组成部分",
|
||||
icon: "category",
|
||||
config: [
|
||||
{
|
||||
label: "URL",
|
||||
component: "VariableInput",
|
||||
icon: "link",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -231,20 +253,19 @@ export const networkCommands = {
|
||||
desc: "DNS解析和查询",
|
||||
icon: "dns",
|
||||
isAsync: true,
|
||||
config: [
|
||||
{
|
||||
label: "要查询的域名",
|
||||
icon: "dns",
|
||||
component: "VariableInput",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
config: [],
|
||||
subCommands: [
|
||||
{
|
||||
label: "DNS查询",
|
||||
value: "quickcomposer.network.dns.lookupHost",
|
||||
icon: "search",
|
||||
config: [
|
||||
{
|
||||
label: "要查询的域名",
|
||||
icon: "dns",
|
||||
component: "VariableInput",
|
||||
width: "auto",
|
||||
},
|
||||
{
|
||||
label: "IP版本",
|
||||
icon: "settings_ethernet",
|
||||
@@ -269,42 +290,97 @@ export const networkCommands = {
|
||||
value: "quickcomposer.network.dns.resolveAll",
|
||||
label: "解析所有记录",
|
||||
icon: "all_inclusive",
|
||||
config: [
|
||||
{
|
||||
label: "要查询的域名",
|
||||
icon: "dns",
|
||||
component: "VariableInput",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveIpv4",
|
||||
label: "解析IPv4",
|
||||
icon: "filter_4",
|
||||
config: [
|
||||
{
|
||||
label: "要查询的域名",
|
||||
icon: "dns",
|
||||
component: "VariableInput",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveIpv6",
|
||||
label: "解析IPv6",
|
||||
icon: "filter_6",
|
||||
config: [
|
||||
{
|
||||
label: "要查询的域名",
|
||||
icon: "dns",
|
||||
component: "VariableInput",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveMxRecords",
|
||||
label: "解析MX记录",
|
||||
icon: "mail",
|
||||
config: [
|
||||
{
|
||||
label: "要查询的域名",
|
||||
icon: "dns",
|
||||
component: "VariableInput",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveTxtRecords",
|
||||
label: "解析TXT记录",
|
||||
icon: "text_fields",
|
||||
config: [
|
||||
{
|
||||
label: "要查询的域名",
|
||||
icon: "dns",
|
||||
component: "VariableInput",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveNsRecords",
|
||||
label: "解析NS记录",
|
||||
icon: "dns",
|
||||
config: [
|
||||
{
|
||||
label: "要查询的域名",
|
||||
icon: "dns",
|
||||
component: "VariableInput",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveCnameRecords",
|
||||
label: "解析CNAME记录",
|
||||
icon: "link",
|
||||
config: [
|
||||
{
|
||||
label: "要查询的域名",
|
||||
icon: "dns",
|
||||
component: "VariableInput",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.reverseResolve",
|
||||
label: "反向解析",
|
||||
icon: "swap_horiz",
|
||||
excludeConfig: [0],
|
||||
config: [
|
||||
{
|
||||
label: "IP地址",
|
||||
|
@@ -308,35 +308,58 @@ export const systemCommands = {
|
||||
label: "路径操作",
|
||||
desc: "路径解析和处理",
|
||||
icon: "folder",
|
||||
config: [
|
||||
{
|
||||
label: "路径",
|
||||
component: "VariableInput",
|
||||
icon: "folder",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
config: [],
|
||||
subCommands: [
|
||||
{
|
||||
value: "quickcomposer.system.path.normalize",
|
||||
label: "规范化路径",
|
||||
icon: "straighten",
|
||||
config: [
|
||||
{
|
||||
label: "路径",
|
||||
component: "VariableInput",
|
||||
icon: "folder",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.system.path.parse",
|
||||
label: "解析路径",
|
||||
icon: "account_tree",
|
||||
config: [
|
||||
{
|
||||
label: "路径",
|
||||
component: "VariableInput",
|
||||
icon: "folder",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.system.path.dirname",
|
||||
label: "获取目录名",
|
||||
icon: "folder",
|
||||
config: [
|
||||
{
|
||||
label: "路径",
|
||||
component: "VariableInput",
|
||||
icon: "folder",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.system.path.basename",
|
||||
label: "获取文件名",
|
||||
icon: "description",
|
||||
config: [
|
||||
{
|
||||
label: "路径",
|
||||
component: "VariableInput",
|
||||
icon: "folder",
|
||||
width: "auto",
|
||||
},
|
||||
{
|
||||
label: "要移除的扩展名",
|
||||
component: "VariableInput",
|
||||
@@ -349,17 +372,32 @@ export const systemCommands = {
|
||||
value: "quickcomposer.system.path.extname",
|
||||
label: "获取扩展名",
|
||||
icon: "extension",
|
||||
config: [
|
||||
{
|
||||
label: "路径",
|
||||
component: "VariableInput",
|
||||
icon: "folder",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.system.path.isAbsolute",
|
||||
label: "判断绝对路径",
|
||||
icon: "check_circle",
|
||||
config: [
|
||||
{
|
||||
label: "路径",
|
||||
component: "VariableInput",
|
||||
icon: "folder",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.system.path.join",
|
||||
label: "连接路径",
|
||||
icon: "add_link",
|
||||
excludeConfig: [0],
|
||||
config: [
|
||||
{
|
||||
label: "路径片段",
|
||||
@@ -379,7 +417,6 @@ export const systemCommands = {
|
||||
value: "quickcomposer.system.path.resolve",
|
||||
label: "解析绝对路径",
|
||||
icon: "assistant_direction",
|
||||
excludeConfig: [0],
|
||||
config: [
|
||||
{
|
||||
label: "路径片段",
|
||||
@@ -399,7 +436,6 @@ export const systemCommands = {
|
||||
value: "quickcomposer.system.path.relative",
|
||||
label: "计算相对路径",
|
||||
icon: "compare_arrows",
|
||||
excludeConfig: [0],
|
||||
config: [
|
||||
{
|
||||
label: "起始路径",
|
||||
@@ -419,7 +455,6 @@ export const systemCommands = {
|
||||
value: "quickcomposer.system.path.format",
|
||||
label: "格式化路径",
|
||||
icon: "format_shapes",
|
||||
excludeConfig: [0],
|
||||
config: [
|
||||
{
|
||||
label: "根路径",
|
||||
|
@@ -104,6 +104,32 @@ const registryPaths = [
|
||||
},
|
||||
];
|
||||
|
||||
const searchWindowConfig = [
|
||||
{
|
||||
key: "method",
|
||||
label: "查找方式",
|
||||
component: "q-select",
|
||||
icon: "search",
|
||||
width: 3,
|
||||
options: [
|
||||
{ label: "标题", value: "title" },
|
||||
// { label: "类名", value: "class" },
|
||||
{ label: "句柄", value: "handle" },
|
||||
// { label: "进程", value: "process" },
|
||||
{ label: "活动窗口", value: "active" },
|
||||
],
|
||||
defaultValue: "title",
|
||||
},
|
||||
{
|
||||
key: "value",
|
||||
label: "窗口标题/句柄",
|
||||
component: "VariableInput",
|
||||
icon: "title",
|
||||
width: 9,
|
||||
placeholder: "标题支持模糊匹配,选择活动窗口无需输入",
|
||||
},
|
||||
];
|
||||
|
||||
export const windowsCommands = {
|
||||
label: "Win自动化",
|
||||
icon: "window",
|
||||
@@ -114,29 +140,7 @@ export const windowsCommands = {
|
||||
label: "窗口控制",
|
||||
desc: "Windows窗口操作",
|
||||
icon: "window",
|
||||
config: [
|
||||
{
|
||||
key: "method",
|
||||
label: "查找方式",
|
||||
component: "q-select",
|
||||
icon: "search",
|
||||
width: 3,
|
||||
options: [
|
||||
{ label: "标题", value: "title" },
|
||||
{ label: "句柄", value: "handle" },
|
||||
{ label: "活动窗口", value: "active" },
|
||||
],
|
||||
defaultValue: "title",
|
||||
},
|
||||
{
|
||||
key: "value",
|
||||
label: "窗口标题/句柄",
|
||||
component: "VariableInput",
|
||||
icon: "title",
|
||||
width: 9,
|
||||
placeholder: "标题支持模糊匹配,选择活动窗口无需输入",
|
||||
},
|
||||
],
|
||||
config: searchWindowConfig,
|
||||
subCommands: [
|
||||
{
|
||||
value: "quickcomposer.windows.window.getWindowInfo",
|
||||
@@ -357,7 +361,7 @@ export const windowsCommands = {
|
||||
items: controlClass,
|
||||
},
|
||||
width: 8,
|
||||
placeholder: "可选,输入要过滤的控件类名或文本",
|
||||
placeholder: "可选,输入要过滤的控件类型或文本",
|
||||
},
|
||||
background: {
|
||||
label: "后台操作",
|
||||
@@ -394,7 +398,7 @@ export const windowsCommands = {
|
||||
width: 12,
|
||||
options: {
|
||||
control: {
|
||||
label: "控件类名",
|
||||
label: "控件类型",
|
||||
component: "VariableInput",
|
||||
icon: "class",
|
||||
options: {
|
||||
@@ -408,7 +412,7 @@ export const windowsCommands = {
|
||||
component: "VariableInput",
|
||||
icon: "text_fields",
|
||||
width: 6,
|
||||
placeholder: "可选,和控件类名至少输入一个",
|
||||
placeholder: "可选,和控件类型至少输入一个",
|
||||
},
|
||||
pos: {
|
||||
label: "坐标",
|
||||
@@ -1097,5 +1101,175 @@ export const windowsCommands = {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.windows.automation.inspectElement",
|
||||
label: "UI自动化",
|
||||
desc: "Windows界面自动化操作",
|
||||
icon: "smart_button",
|
||||
isAsync: true,
|
||||
config: [],
|
||||
subCommands: [
|
||||
{
|
||||
value: "quickcomposer.windows.automation.inspectElement",
|
||||
label: "检查元素",
|
||||
icon: "search",
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.windows.automation.listElements",
|
||||
label: "列出元素",
|
||||
icon: "list",
|
||||
config: [
|
||||
...searchWindowConfig,
|
||||
{
|
||||
component: "OptionEditor",
|
||||
icon: "settings",
|
||||
width: 12,
|
||||
options: {
|
||||
scope: {
|
||||
label: "范围",
|
||||
component: "q-select",
|
||||
icon: "account_tree",
|
||||
width: 3,
|
||||
options: [
|
||||
{ label: "子元素", value: "children" },
|
||||
{ label: "所有后代", value: "descendants" },
|
||||
{ label: "整个子树", value: "subtree" },
|
||||
],
|
||||
},
|
||||
filter: {
|
||||
label: "过滤条件",
|
||||
component: "VariableInput",
|
||||
icon: "filter_alt",
|
||||
width: 9,
|
||||
placeholder: "可选,按名称/类名/ControlType/AutomationId过滤",
|
||||
},
|
||||
},
|
||||
defaultValue: {
|
||||
scope: "children",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.windows.automation.clickElement",
|
||||
label: "点击元素",
|
||||
icon: "mouse",
|
||||
config: [
|
||||
...searchWindowConfig,
|
||||
{
|
||||
key: "by",
|
||||
label: "查找方式",
|
||||
component: "q-select",
|
||||
icon: "search",
|
||||
width: 4,
|
||||
options: [
|
||||
{ label: "名称", value: "name" },
|
||||
{ label: "类名", value: "class" },
|
||||
{ label: "类型", value: "type" },
|
||||
{ label: "AutomationId", value: "automationid" },
|
||||
],
|
||||
defaultValue: "name",
|
||||
},
|
||||
{
|
||||
key: "value",
|
||||
label: "查找值",
|
||||
component: "VariableInput",
|
||||
icon: "text_fields",
|
||||
width: 8,
|
||||
placeholder: "要点击的元素值",
|
||||
},
|
||||
{
|
||||
key: "pattern",
|
||||
label: "点击模式",
|
||||
component: "ButtonGroup",
|
||||
icon: "touch_app",
|
||||
width: 12,
|
||||
options: [
|
||||
{ label: "普通点击", value: "invoke" },
|
||||
{ label: "切换状态", value: "toggle" },
|
||||
],
|
||||
defaultValue: "invoke",
|
||||
},
|
||||
{
|
||||
key: "background",
|
||||
label: "后台操作",
|
||||
component: "CheckButton",
|
||||
icon: "back_hand",
|
||||
width: 12,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.windows.automation.setElementValue",
|
||||
label: "设置值",
|
||||
icon: "edit",
|
||||
config: [
|
||||
...searchWindowConfig,
|
||||
{
|
||||
key: "by",
|
||||
label: "查找方式",
|
||||
component: "q-select",
|
||||
icon: "search",
|
||||
width: 4,
|
||||
options: [
|
||||
{ label: "名称", value: "name" },
|
||||
{ label: "类名", value: "class" },
|
||||
{ label: "类型", value: "type" },
|
||||
{ label: "AutomationId", value: "automationid" },
|
||||
],
|
||||
defaultValue: "name",
|
||||
},
|
||||
{
|
||||
key: "value",
|
||||
label: "查找值",
|
||||
component: "VariableInput",
|
||||
icon: "text_fields",
|
||||
width: 8,
|
||||
placeholder: "要设置值的元素",
|
||||
},
|
||||
{
|
||||
key: "newValue",
|
||||
label: "新值",
|
||||
component: "VariableInput",
|
||||
icon: "edit",
|
||||
width: 12,
|
||||
placeholder: "要设置的新值",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.windows.automation.getElementValue",
|
||||
label: "获取值",
|
||||
icon: "content_paste",
|
||||
outputVariable: "elementValue",
|
||||
saveOutput: true,
|
||||
config: [
|
||||
...searchWindowConfig,
|
||||
{
|
||||
key: "by",
|
||||
label: "查找方式",
|
||||
component: "q-select",
|
||||
icon: "search",
|
||||
width: 4,
|
||||
options: [
|
||||
{ label: "名称", value: "name" },
|
||||
{ label: "类名", value: "class" },
|
||||
{ label: "类型", value: "type" },
|
||||
{ label: "AutomationId", value: "automationid" },
|
||||
],
|
||||
defaultValue: "name",
|
||||
},
|
||||
{
|
||||
key: "value",
|
||||
label: "查找值",
|
||||
component: "VariableInput",
|
||||
icon: "text_fields",
|
||||
width: 8,
|
||||
placeholder: "要获取值的元素",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
Reference in New Issue
Block a user