mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-07 05:25:39 +08:00
为大部分命令添加输出结构结构化数据
This commit is contained in:
parent
73684865ae
commit
deade3e1de
@ -58,13 +58,19 @@ const quickcommand = {
|
||||
{
|
||||
timeout: ms,
|
||||
},
|
||||
(err, stdout, stderr) => {
|
||||
() => {
|
||||
var end = new Date().getTime();
|
||||
callback(end - start);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
asyncSleep: async function (ms) {
|
||||
return new Promise((resolve) => {
|
||||
this.setTimeout(resolve, ms);
|
||||
});
|
||||
},
|
||||
|
||||
// 关闭进程
|
||||
kill: function (pid, signal = "SIGTERM", cb) {
|
||||
kill(pid, signal, cb);
|
||||
|
@ -72,7 +72,8 @@ const submitForm = async (tab, buttonSelector, inputSelectors) => {
|
||||
const getText = async (tab, selector) => {
|
||||
return await executeScript(
|
||||
tab,
|
||||
`document.querySelector('${selector}')?.textContent || ''`
|
||||
`const element = document.querySelector('${selector}');
|
||||
return element?.textContent || element?.innerText || '';`
|
||||
);
|
||||
};
|
||||
|
||||
@ -80,7 +81,7 @@ const getHtml = async (tab, selector) => {
|
||||
return await executeScript(
|
||||
tab,
|
||||
`const element = document.querySelector('${selector}');
|
||||
return element ? element.innerHTML : '';`
|
||||
return element?.outerHTML || '';`
|
||||
);
|
||||
};
|
||||
|
||||
@ -110,7 +111,7 @@ const scrollToElement = async (tab, selector) => {
|
||||
};
|
||||
|
||||
const getScrollPosition = async (tab) => {
|
||||
return await executeScript(
|
||||
const result = await executeScript(
|
||||
tab,
|
||||
`
|
||||
return JSON.stringify({
|
||||
@ -119,10 +120,11 @@ const getScrollPosition = async (tab) => {
|
||||
});
|
||||
`
|
||||
);
|
||||
return JSON.parse(result);
|
||||
};
|
||||
|
||||
const getPageSize = async (tab) => {
|
||||
return await executeScript(
|
||||
const result = await executeScript(
|
||||
tab,
|
||||
`
|
||||
return JSON.stringify({
|
||||
@ -137,6 +139,7 @@ const getPageSize = async (tab) => {
|
||||
});
|
||||
`
|
||||
);
|
||||
return JSON.parse(result);
|
||||
};
|
||||
|
||||
const waitForElement = async (tab, selector, timeout = 5000) => {
|
||||
|
@ -4,6 +4,7 @@ const zlib = require("./zlib");
|
||||
const { htmlParser } = require("./htmlParser");
|
||||
const array = require("./array");
|
||||
const time = require("./time");
|
||||
const { regexTransform } = require("./regexTransform");
|
||||
|
||||
module.exports = {
|
||||
htmlParser,
|
||||
@ -12,4 +13,5 @@ module.exports = {
|
||||
zlib,
|
||||
array,
|
||||
time,
|
||||
regexTransform,
|
||||
};
|
||||
|
9
plugin/lib/quickcomposer/data/regexTransform.js
Normal file
9
plugin/lib/quickcomposer/data/regexTransform.js
Normal file
@ -0,0 +1,9 @@
|
||||
const regexTransform = (text, regex, replacement) => {
|
||||
if (replacement) {
|
||||
return text.replace(regex, replacement);
|
||||
} else {
|
||||
return text.match(regex);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = { regexTransform };
|
@ -76,44 +76,207 @@ const time = {
|
||||
parse: function (time, format) {
|
||||
if (!time) return null;
|
||||
|
||||
const now = new Date();
|
||||
let year = now.getFullYear();
|
||||
let month = now.getMonth() + 1; // 转换为正常月份
|
||||
let day = now.getDate();
|
||||
let hours = 0;
|
||||
let minutes = 0;
|
||||
let seconds = 0;
|
||||
|
||||
// 处理时间戳
|
||||
if (format === "timestamp") {
|
||||
return new Date(Number(time) * 1000);
|
||||
const date = new Date(Number(time) * 1000);
|
||||
return this._formatTimeObject(date);
|
||||
}
|
||||
if (format === "timestamp_ms") {
|
||||
return new Date(Number(time));
|
||||
const date = new Date(Number(time));
|
||||
return this._formatTimeObject(date);
|
||||
}
|
||||
|
||||
// 处理标准格式
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
let result;
|
||||
// 如果没有指定格式,尝试自动识别
|
||||
if (!format) {
|
||||
// 尝试直接解析
|
||||
const date = new Date(time);
|
||||
if (date.getTime()) {
|
||||
return this._formatTimeObject(date);
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case "YYYY-MM-DD":
|
||||
case "YYYY-MM-DD HH:mm:ss":
|
||||
case "YYYY-MM-DD HH:mm":
|
||||
result = new Date(time);
|
||||
break;
|
||||
case "YYYY年MM月DD日":
|
||||
time = time.replace(/[年月日]/g, (match) => {
|
||||
return { 年: "-", 月: "-", 日: "" }[match];
|
||||
});
|
||||
result = new Date(time);
|
||||
break;
|
||||
case "MM/DD/YYYY":
|
||||
const [month, day, yyyy] = time.split("/");
|
||||
result = new Date(yyyy, month - 1, day);
|
||||
break;
|
||||
case "DD/MM/YYYY":
|
||||
const [dd, mm, yy] = time.split("/");
|
||||
result = new Date(yy, mm - 1, dd);
|
||||
break;
|
||||
default:
|
||||
result = new Date(time);
|
||||
// 尝试解析常见格式
|
||||
const patterns = {
|
||||
// 标准格式
|
||||
"YYYY-MM-DD HH:mm:ss":
|
||||
/^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/,
|
||||
"YYYY-MM-DD HH:mm": /^(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2})$/,
|
||||
"YYYY-MM-DD": /^(\d{4})-(\d{1,2})-(\d{1,2})$/,
|
||||
// 中文格式
|
||||
"YYYY年MM月DD日 HH时mm分ss秒":
|
||||
/^(\d{4})年(\d{1,2})月(\d{1,2})日 (\d{1,2})时(\d{1,2})分(\d{1,2})秒$/,
|
||||
"YYYY年MM月DD日 HH:mm:ss":
|
||||
/^(\d{4})年(\d{1,2})月(\d{1,2})日 (\d{1,2}):(\d{1,2}):(\d{1,2})$/,
|
||||
YYYY年MM月DD日: /^(\d{4})年(\d{1,2})月(\d{1,2})日$/,
|
||||
// 斜杠格式
|
||||
"MM/DD/YYYY HH:mm:ss":
|
||||
/^(\d{1,2})\/(\d{1,2})\/(\d{4}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/,
|
||||
"DD/MM/YYYY HH:mm:ss":
|
||||
/^(\d{1,2})\/(\d{1,2})\/(\d{4}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/,
|
||||
"MM/DD/YYYY": /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,
|
||||
"DD/MM/YYYY": /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,
|
||||
// 点号格式
|
||||
"DD.MM.YYYY": /^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,
|
||||
// 时间格式
|
||||
"HH:mm:ss": /^(\d{1,2}):(\d{1,2}):(\d{1,2})$/,
|
||||
"HH:mm": /^(\d{1,2}):(\d{1,2})$/,
|
||||
};
|
||||
|
||||
for (const [patternFormat, regex] of Object.entries(patterns)) {
|
||||
const matches = time.match(regex);
|
||||
if (matches) {
|
||||
format = patternFormat;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result.getTime() ? result : null;
|
||||
// 解析时间字符串
|
||||
const parseTimeString = (timeStr) => {
|
||||
const parts = timeStr.split(/[: ]/);
|
||||
return {
|
||||
hours: parseInt(parts[0]) || 0,
|
||||
minutes: parseInt(parts[1]) || 0,
|
||||
seconds: parseInt(parts[2]) || 0,
|
||||
};
|
||||
};
|
||||
|
||||
// 根据格式解析
|
||||
if (format) {
|
||||
// 移除所有非数字和分隔符
|
||||
const cleanTime = time.replace(/[^0-9/\-.: ]/g, "");
|
||||
const parts = cleanTime.split(/[/\-.: ]/);
|
||||
|
||||
switch (format) {
|
||||
case "YYYY-MM-DD":
|
||||
case "YYYY-MM-DD HH:mm:ss":
|
||||
case "YYYY-MM-DD HH:mm":
|
||||
case "YYYY年MM月DD日":
|
||||
case "YYYY年MM月DD日 HH:mm:ss":
|
||||
case "YYYY年MM月DD日 HH时mm分ss秒":
|
||||
year = parseInt(parts[0]);
|
||||
month = parseInt(parts[1]);
|
||||
day = parseInt(parts[2]);
|
||||
if (parts.length > 3) {
|
||||
const timeStr = parts.slice(3).join(":");
|
||||
const timeObj = parseTimeString(timeStr);
|
||||
hours = timeObj.hours;
|
||||
minutes = timeObj.minutes;
|
||||
seconds = timeObj.seconds;
|
||||
}
|
||||
break;
|
||||
case "MM/DD/YYYY":
|
||||
case "MM/DD/YYYY HH:mm:ss":
|
||||
year = parseInt(parts[2]);
|
||||
month = parseInt(parts[0]);
|
||||
day = parseInt(parts[1]);
|
||||
if (parts.length > 3) {
|
||||
const timeStr = parts.slice(3).join(":");
|
||||
const timeObj = parseTimeString(timeStr);
|
||||
hours = timeObj.hours;
|
||||
minutes = timeObj.minutes;
|
||||
seconds = timeObj.seconds;
|
||||
}
|
||||
break;
|
||||
case "DD/MM/YYYY":
|
||||
case "DD/MM/YYYY HH:mm:ss":
|
||||
case "DD.MM.YYYY":
|
||||
year = parseInt(parts[2]);
|
||||
month = parseInt(parts[1]);
|
||||
day = parseInt(parts[0]);
|
||||
if (parts.length > 3) {
|
||||
const timeStr = parts.slice(3).join(":");
|
||||
const timeObj = parseTimeString(timeStr);
|
||||
hours = timeObj.hours;
|
||||
minutes = timeObj.minutes;
|
||||
seconds = timeObj.seconds;
|
||||
}
|
||||
break;
|
||||
case "HH:mm:ss":
|
||||
case "HH:mm":
|
||||
const timeObj = parseTimeString(cleanTime);
|
||||
hours = timeObj.hours;
|
||||
minutes = timeObj.minutes;
|
||||
seconds = timeObj.seconds;
|
||||
break;
|
||||
default:
|
||||
// 尝试使用原生解析
|
||||
const date = new Date(time);
|
||||
if (date.getTime()) {
|
||||
year = date.getFullYear();
|
||||
month = date.getMonth() + 1;
|
||||
day = date.getDate();
|
||||
hours = date.getHours();
|
||||
minutes = date.getMinutes();
|
||||
seconds = date.getSeconds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 验证日期是否有效
|
||||
const testDate = new Date(year, month - 1, day, hours, minutes, seconds);
|
||||
if (!testDate.getTime()) return null;
|
||||
|
||||
return this._formatTimeObject(testDate);
|
||||
},
|
||||
|
||||
// 格式化时间对象
|
||||
_formatTimeObject: function (date) {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth() + 1;
|
||||
const day = date.getDate();
|
||||
const hours = date.getHours();
|
||||
const minutes = date.getMinutes();
|
||||
const seconds = date.getSeconds();
|
||||
|
||||
return {
|
||||
date: {
|
||||
year,
|
||||
month,
|
||||
day,
|
||||
},
|
||||
time: {
|
||||
hours,
|
||||
minutes,
|
||||
seconds,
|
||||
},
|
||||
formats: {
|
||||
// 标准格式
|
||||
iso: date.toISOString(),
|
||||
locale: date.toLocaleString(),
|
||||
localeDate: date.toLocaleDateString(),
|
||||
localeTime: date.toLocaleTimeString(),
|
||||
// 常用格式
|
||||
"YYYY-MM-DD": `${year}-${this._pad(month)}-${this._pad(day)}`,
|
||||
"YYYY-MM-DD HH:mm:ss": `${year}-${this._pad(month)}-${this._pad(
|
||||
day
|
||||
)} ${this._pad(hours)}:${this._pad(minutes)}:${this._pad(seconds)}`,
|
||||
dateCN: `${year}年${this._pad(month)}月${this._pad(day)}日`,
|
||||
"MM/DD/YYYY": `${this._pad(month)}/${this._pad(day)}/${year}`,
|
||||
"DD/MM/YYYY": `${this._pad(day)}/${this._pad(month)}/${year}`,
|
||||
"HH:mm:ss": `${this._pad(hours)}:${this._pad(minutes)}:${this._pad(
|
||||
seconds
|
||||
)}`,
|
||||
},
|
||||
timestamp: Math.floor(date.getTime() / 1000),
|
||||
timestamp_ms: date.getTime(),
|
||||
// 日历信息
|
||||
calendar: {
|
||||
week: date.getDay(),
|
||||
weekText: ["日", "一", "二", "三", "四", "五", "六"][date.getDay()],
|
||||
isWeekend: date.getDay() === 0 || date.getDay() === 6,
|
||||
isLeapYear: (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0,
|
||||
daysInMonth: new Date(year, month, 0).getDate(),
|
||||
constellation: this._getConstellation(month, day),
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
// 时间加减
|
||||
|
@ -192,7 +192,8 @@ module.exports = {
|
||||
|
||||
// 启动应用
|
||||
launch: async function (appName) {
|
||||
return await quickcommand.runAppleScript(`
|
||||
if (!appName) return;
|
||||
await quickcommand.runAppleScript(`
|
||||
tell application "${appName}"
|
||||
activate
|
||||
end tell
|
||||
@ -201,7 +202,8 @@ module.exports = {
|
||||
|
||||
// 退出应用
|
||||
quit: async function (appName) {
|
||||
return await quickcommand.runAppleScript(`
|
||||
if (!appName) return;
|
||||
await quickcommand.runAppleScript(`
|
||||
tell application "${appName}"
|
||||
quit
|
||||
end tell
|
||||
@ -210,7 +212,8 @@ module.exports = {
|
||||
|
||||
// 隐藏应用
|
||||
hide: async function (appName) {
|
||||
return await quickcommand.runAppleScript(`
|
||||
if (!appName) return;
|
||||
await quickcommand.runAppleScript(`
|
||||
tell application "System Events"
|
||||
set visible of process "${appName}" to false
|
||||
end tell
|
||||
@ -219,7 +222,8 @@ module.exports = {
|
||||
|
||||
// 显示应用
|
||||
show: async function (appName) {
|
||||
return await quickcommand.runAppleScript(`
|
||||
if (!appName) return;
|
||||
await quickcommand.runAppleScript(`
|
||||
tell application "System Events"
|
||||
set visible of process "${appName}" to true
|
||||
end tell
|
||||
@ -231,7 +235,8 @@ module.exports = {
|
||||
|
||||
// 最小化窗口
|
||||
minimize: async function (appName) {
|
||||
return await quickcommand.runAppleScript(`
|
||||
if (!appName) return;
|
||||
await quickcommand.runAppleScript(`
|
||||
tell application "System Events"
|
||||
tell process "${appName}"
|
||||
try
|
||||
@ -244,7 +249,8 @@ module.exports = {
|
||||
|
||||
// 最大化窗口
|
||||
maximize: async function (appName) {
|
||||
return await quickcommand.runAppleScript(`
|
||||
if (!appName) return;
|
||||
await quickcommand.runAppleScript(`
|
||||
tell application "System Events"
|
||||
tell process "${appName}"
|
||||
try
|
||||
@ -258,6 +264,7 @@ module.exports = {
|
||||
|
||||
// 获取窗口信息
|
||||
getWindows: async function (appName) {
|
||||
if (!appName) return;
|
||||
const result = await quickcommand.runAppleScript(`
|
||||
tell application "System Events"
|
||||
tell process "${appName}"
|
||||
@ -341,6 +348,7 @@ module.exports = {
|
||||
|
||||
// 获取应用脚本字典
|
||||
getScriptDictionary: async function (appName) {
|
||||
if (!appName) return;
|
||||
try {
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
|
@ -23,7 +23,7 @@ module.exports = {
|
||||
return json
|
||||
end tell
|
||||
`);
|
||||
return JSON.parse(result);
|
||||
return JSON.parse(result.replace(/missing value/g, "null"));
|
||||
},
|
||||
|
||||
// 获取当前文件夹
|
||||
|
@ -54,17 +54,6 @@ function formatQuery(queryParams) {
|
||||
}
|
||||
}
|
||||
|
||||
// 解析路径名
|
||||
function parsePath(path) {
|
||||
return url.parse(path);
|
||||
}
|
||||
|
||||
// 解析主机名
|
||||
function parseHost(host) {
|
||||
const { hostname, port } = url.parse(`http://${host}`);
|
||||
return { hostname, port };
|
||||
}
|
||||
|
||||
// 解析 URL 参数
|
||||
function getQueryParam(urlString, param) {
|
||||
const { query } = url.parse(urlString, true);
|
||||
@ -92,32 +81,13 @@ function isAbsolute(urlString) {
|
||||
return url.parse(urlString).protocol !== null;
|
||||
}
|
||||
|
||||
// 解析 URL 的各个部分
|
||||
function parseComponents(urlString) {
|
||||
const { protocol, auth, hostname, port, pathname, search, hash } =
|
||||
url.parse(urlString);
|
||||
|
||||
return {
|
||||
protocol: protocol?.replace(":", ""),
|
||||
auth,
|
||||
hostname,
|
||||
port,
|
||||
pathname,
|
||||
search: search?.replace("?", ""),
|
||||
hash: hash?.replace("#", ""),
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
parse,
|
||||
format,
|
||||
parseQuery,
|
||||
formatQuery,
|
||||
parsePath,
|
||||
parseHost,
|
||||
getQueryParam,
|
||||
addQueryParam,
|
||||
removeQueryParam,
|
||||
isAbsolute,
|
||||
parseComponents,
|
||||
};
|
||||
|
@ -3,7 +3,7 @@
|
||||
<OperationCard
|
||||
v-if="hasSubCommands"
|
||||
:model-value="funcName"
|
||||
@update:model-value="updateFuncName"
|
||||
@update:model-value="funcName = $event"
|
||||
:options="localCommand.subCommands"
|
||||
/>
|
||||
<ParamInput :configs="localConfig" :values="argvs" @update="updateArgv" />
|
||||
@ -77,7 +77,7 @@ export default defineComponent({
|
||||
newArgvs[this.commonConfig.length + index] = config.defaultValue;
|
||||
});
|
||||
|
||||
this.updateModelValue(value, newArgvs);
|
||||
this.updateModelValue(value, newArgvs, true);
|
||||
},
|
||||
},
|
||||
argvs() {
|
||||
@ -189,14 +189,18 @@ export default defineComponent({
|
||||
);
|
||||
return `${subFeature}${allArgvs.join(",")}`;
|
||||
},
|
||||
updateModelValue(funcName, argvs) {
|
||||
this.$emit("update:modelValue", {
|
||||
updateModelValue(funcName, argvs, resetOutputVariable = false) {
|
||||
const newModelValue = {
|
||||
...this.modelValue,
|
||||
value: funcName,
|
||||
argvs,
|
||||
summary: this.getSummary(argvs),
|
||||
code: this.generateCode(funcName, argvs),
|
||||
});
|
||||
};
|
||||
if (resetOutputVariable) {
|
||||
delete newModelValue.outputVariable;
|
||||
}
|
||||
this.$emit("update:modelValue", newModelValue);
|
||||
},
|
||||
getColumnStyle(width = 12) {
|
||||
const columnWidth = (width / 12) * 100;
|
||||
@ -204,15 +208,6 @@ export default defineComponent({
|
||||
width: `calc(${columnWidth}% - var(--grid-gap))`,
|
||||
};
|
||||
},
|
||||
updateFuncName(value) {
|
||||
this.funcName = value;
|
||||
// 如果切换了子命令,更新输出变量
|
||||
const selectSubCommand = this.getSelectSubCommand(value);
|
||||
if (!selectSubCommand) return;
|
||||
const newModelValue = { ...this.modelValue, value: value };
|
||||
delete newModelValue.outputVariable;
|
||||
this.$emit("update:modelValue", newModelValue);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
const argvs = this.modelValue.argvs || this.defaultArgvs;
|
||||
|
@ -6,7 +6,7 @@
|
||||
</div>
|
||||
|
||||
<!-- 完整结果部分 -->
|
||||
<SectionBlock title="完整结果">
|
||||
<SectionBlock title="完整结果" :subtitle="outputTypeName || ''">
|
||||
<OutputField
|
||||
v-model="simpleOutputVar"
|
||||
:label="currentOutputs?.label || '输出变量名'"
|
||||
@ -22,27 +22,61 @@
|
||||
<SectionBlock
|
||||
title="详细输出"
|
||||
:subtitle="
|
||||
Array.isArray(currentOutputs.structure) ? '数组中第一个元素' : ''
|
||||
isOutputTypeArray && currentOutputs.structure.length === 1
|
||||
? '第一个元素'
|
||||
: ''
|
||||
"
|
||||
>
|
||||
<q-scroll-area
|
||||
style="height: 200px"
|
||||
:style="{
|
||||
height: `${Math.min(220, 44 * inputNumbers)}px`,
|
||||
}"
|
||||
:thumb-style="{
|
||||
width: '2px',
|
||||
}"
|
||||
>
|
||||
<div class="detail-output column q-col-gutter-sm q-px-sm">
|
||||
<template v-if="Array.isArray(currentOutputs.structure)">
|
||||
<template
|
||||
v-for="(output, key) in currentOutputs.structure[0]"
|
||||
:key="key"
|
||||
>
|
||||
<OutputStructure
|
||||
:output="output"
|
||||
:output-key="key"
|
||||
:is-array="true"
|
||||
v-model="outputVars"
|
||||
/>
|
||||
<template v-if="isOutputTypeArray">
|
||||
<!-- 处理数组结构但内部是简单对象的情况 -->
|
||||
<template v-if="isSimpleArrayStructure">
|
||||
<template
|
||||
v-for="(output, index) in currentOutputs.structure"
|
||||
:key="index"
|
||||
>
|
||||
<OutputField
|
||||
v-model="outputVars['[' + index + ']']"
|
||||
:label="output.label"
|
||||
:placeholder="output.placeholder"
|
||||
:suggest-name="output.suggestName"
|
||||
:show-variable-list="true"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 处理数组结构且内部是复杂对象的情况 -->
|
||||
<template v-else>
|
||||
<template
|
||||
v-for="(item, index) in currentOutputs.structure"
|
||||
:key="index"
|
||||
>
|
||||
<div
|
||||
class="text-caption q-px-sm"
|
||||
v-if="currentOutputs.structure.length > 1"
|
||||
>
|
||||
第{{ index + 1 }}个元素
|
||||
</div>
|
||||
<div class="q-col-gutter-sm column">
|
||||
<OutputStructure
|
||||
v-for="(output, key) in item"
|
||||
:key="key"
|
||||
:output="output"
|
||||
:output-key="key"
|
||||
:is-array="true"
|
||||
:array-index="index"
|
||||
:fixed-fields="fixedFields"
|
||||
v-model="outputVars"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
@ -53,6 +87,7 @@
|
||||
<OutputStructure
|
||||
:output="output"
|
||||
:output-key="key"
|
||||
:fixed-fields="fixedFields"
|
||||
v-model="outputVars"
|
||||
/>
|
||||
</template>
|
||||
@ -85,6 +120,7 @@
|
||||
</template>
|
||||
|
||||
<div class="row justify-end q-px-sm q-py-sm">
|
||||
<q-btn flat label="清空" color="primary" @click="handleClear" />
|
||||
<q-btn flat label="取消" color="primary" v-close-popup />
|
||||
<q-btn flat label="确定" color="primary" @click="handleConfirm" />
|
||||
</div>
|
||||
@ -126,6 +162,41 @@ export default defineComponent({
|
||||
this.$emit("update:modelValue", value);
|
||||
},
|
||||
},
|
||||
inputNumbers() {
|
||||
const structure = this.currentOutputs?.structure;
|
||||
if (!structure) return 0;
|
||||
if (Array.isArray(structure)) {
|
||||
if (this.isSimpleArrayStructure) {
|
||||
return structure.length;
|
||||
}
|
||||
return Object.keys(structure[0]).length;
|
||||
}
|
||||
return Object.keys(structure).length;
|
||||
},
|
||||
outputTypeName() {
|
||||
const structure = this.currentOutputs?.structure;
|
||||
if (Array.isArray(structure)) {
|
||||
return "数组";
|
||||
}
|
||||
if (typeof structure === "object") {
|
||||
return "对象";
|
||||
}
|
||||
return this.currentOutputs?.typeName;
|
||||
},
|
||||
isOutputTypeArray() {
|
||||
return this.outputTypeName === "数组";
|
||||
},
|
||||
isSimpleArrayStructure() {
|
||||
if (!this.isOutputTypeArray || !this.currentOutputs?.structure?.length) {
|
||||
return false;
|
||||
}
|
||||
const firstItem = this.currentOutputs.structure[0];
|
||||
// 如果数组第一项只包含 label 和 placeholder,则认为是简单结构
|
||||
return (
|
||||
Object.keys(firstItem).every((key) => this.fixedFields.includes(key)) &&
|
||||
firstItem.label
|
||||
);
|
||||
},
|
||||
currentSubCommand() {
|
||||
if (!this.command.subCommands) return {};
|
||||
return this.command.subCommands.find(
|
||||
@ -161,6 +232,7 @@ export default defineComponent({
|
||||
value: "then",
|
||||
},
|
||||
],
|
||||
fixedFields: ["label", "placeholder", "suggestName"],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@ -233,7 +305,7 @@ export default defineComponent({
|
||||
// 检查变量名是否合法
|
||||
const varNames = [
|
||||
outputVariable.name,
|
||||
...Object.keys(outputVariable.details || {}),
|
||||
...Object.values(outputVariable.details || {}),
|
||||
result.callbackFunc,
|
||||
].filter(Boolean);
|
||||
|
||||
@ -252,6 +324,10 @@ export default defineComponent({
|
||||
this.$emit("confirm", result);
|
||||
this.isOpen = false;
|
||||
},
|
||||
handleClear() {
|
||||
this.simpleOutputVar = "";
|
||||
this.outputVars = {};
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
@ -75,15 +75,18 @@ export default defineComponent({
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
arrayIndex: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
modelValue: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fixedFields: ["label", "placeholder", "suggestName"],
|
||||
};
|
||||
fixedFields: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
emits: ["update:modelValue"],
|
||||
computed: {
|
||||
@ -105,7 +108,9 @@ export default defineComponent({
|
||||
},
|
||||
methods: {
|
||||
getFieldPath(subKey = "") {
|
||||
const base = this.isArray ? `[0].${this.outputKey}` : this.outputKey;
|
||||
const base = this.isArray
|
||||
? `[${this.arrayIndex}]?.${this.outputKey}`
|
||||
: this.outputKey;
|
||||
return subKey ? `${base}.${subKey}` : base;
|
||||
},
|
||||
updateField(subKey, value) {
|
||||
|
@ -106,6 +106,7 @@ export const audioCommands = {
|
||||
{
|
||||
value: "quickcomposer.audio.speech.speak",
|
||||
label: "文本朗读",
|
||||
asyncMode: "await",
|
||||
icon: "record_voice_over",
|
||||
subCommands: [
|
||||
{
|
||||
@ -262,6 +263,15 @@ export const audioCommands = {
|
||||
},
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "音频信息",
|
||||
suggestName: "audioInfo",
|
||||
structure: {
|
||||
duration: { label: "时长", suggestName: "audioDuration" },
|
||||
channels: { label: "声道", suggestName: "audioChannels" },
|
||||
sampleRate: { label: "采样率", suggestName: "audioSampleRate" },
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -117,6 +117,14 @@ export const browserCommands = {
|
||||
},
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "实例信息",
|
||||
suggestName: "browserInstance",
|
||||
structure: {
|
||||
pid: { label: "进程ID", suggestName: "instancePid" },
|
||||
port: { label: "端口", suggestName: "instancePort" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.destroyClientByPort",
|
||||
@ -139,11 +147,25 @@ export const browserCommands = {
|
||||
value: "quickcomposer.browser.getClientPorts",
|
||||
label: "获取所有浏览器实例端口",
|
||||
icon: "list",
|
||||
outputs: {
|
||||
label: "实例端口列表",
|
||||
suggestName: "instancePorts",
|
||||
structure: [
|
||||
{ label: "实例一端口", suggestName: "instancePort1" },
|
||||
{ label: "实例二端口", suggestName: "instancePort2" },
|
||||
{ label: "实例三端口", suggestName: "instancePort3" },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.getCurrentClientPort",
|
||||
label: "获取当前操控的实例端口",
|
||||
icon: "label",
|
||||
outputs: {
|
||||
label: "实例端口",
|
||||
suggestName: "currentInstancePort",
|
||||
typeName: "数字",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.switchClientByPort",
|
||||
@ -175,6 +197,11 @@ export const browserCommands = {
|
||||
value: "quickcomposer.browser.getUrl",
|
||||
label: "获取当前地址",
|
||||
icon: "link",
|
||||
outputs: {
|
||||
label: "当前地址",
|
||||
suggestName: "currentUrl",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.setUrl",
|
||||
@ -202,6 +229,17 @@ export const browserCommands = {
|
||||
value: "quickcomposer.browser.getTabs",
|
||||
label: "获取标签列表",
|
||||
icon: "tab",
|
||||
outputs: {
|
||||
label: "标签列表",
|
||||
suggestName: "tabList",
|
||||
structure: [
|
||||
{
|
||||
url: { label: "标签一网址", suggestName: "firstTabUrl" },
|
||||
title: { label: "标签一标题", suggestName: "firstTabTitle" },
|
||||
id: { label: "标签一ID", suggestName: "firstTabId" },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.activateTab",
|
||||
@ -213,6 +251,15 @@ export const browserCommands = {
|
||||
value: "quickcomposer.browser.getCurrentTab",
|
||||
label: "获取当前标签页",
|
||||
icon: "tab",
|
||||
outputs: {
|
||||
label: "当前标签页",
|
||||
suggestName: "currentTab",
|
||||
structure: {
|
||||
url: { label: "标签网址", suggestName: "currentTabUrl" },
|
||||
title: { label: "标签标题", suggestName: "currentTabTitle" },
|
||||
id: { label: "标签ID", suggestName: "currentTabId" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.createNewTab",
|
||||
@ -227,6 +274,15 @@ export const browserCommands = {
|
||||
placeholder: "留空则打开about:blank",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "新标签页",
|
||||
suggestName: "newTab",
|
||||
structure: {
|
||||
url: { label: "新标签网址", suggestName: "newTabUrl" },
|
||||
title: { label: "新标签标题", suggestName: "newTabTitle" },
|
||||
id: { label: "新标签ID", suggestName: "newTabId" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.closeTab",
|
||||
@ -323,6 +379,11 @@ export const browserCommands = {
|
||||
width: 12,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "执行结果",
|
||||
suggestName: "executeResult",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.injectRemoteScript",
|
||||
@ -479,6 +540,32 @@ export const browserCommands = {
|
||||
placeholder: "输入Cookie名称,留空则获取所有",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "Cookie",
|
||||
suggestName: "cookie",
|
||||
structure: {
|
||||
name: { label: "名称", suggestName: "cookieName" },
|
||||
value: { label: "值", suggestName: "cookieValue" },
|
||||
domain: { label: "域名", suggestName: "cookieDomain" },
|
||||
path: { label: "路径", suggestName: "cookiePath" },
|
||||
expires: { label: "过期时间", suggestName: "cookieExpires" },
|
||||
size: { label: "大小", suggestName: "cookieSize" },
|
||||
httpOnly: { label: "HTTPOnly", suggestName: "isCookieHttpOnly" },
|
||||
secure: { label: "安全", suggestName: "isCookieSecure" },
|
||||
session: { label: "会话", suggestName: "isCookieSession" },
|
||||
sameSite: { label: "同站", suggestName: "isCookieSameSite" },
|
||||
priority: { label: "优先级", suggestName: "cookiePriority" },
|
||||
sameParty: { label: "同域", suggestName: "isCookieSameParty" },
|
||||
sourceScheme: {
|
||||
label: "来源协议",
|
||||
suggestName: "cookieSourceScheme",
|
||||
},
|
||||
sourcePort: {
|
||||
label: "来源端口",
|
||||
suggestName: "cookieSourcePort",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -546,13 +633,23 @@ export const browserCommands = {
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.getText",
|
||||
label: "获取文本",
|
||||
label: "获取元素文本",
|
||||
icon: "text_fields",
|
||||
outputs: {
|
||||
label: "元素文本",
|
||||
suggestName: "elementInnerText",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.getHtml",
|
||||
label: "获取HTML",
|
||||
label: "获取元素HTML",
|
||||
icon: "code",
|
||||
outputs: {
|
||||
label: "元素outerHTML",
|
||||
suggestName: "elementOuterHTML",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.hideElement",
|
||||
@ -619,11 +716,27 @@ export const browserCommands = {
|
||||
value: "quickcomposer.browser.getScrollPosition",
|
||||
label: "获取滚动位置",
|
||||
icon: "open_in_full",
|
||||
outputs: {
|
||||
label: "滚动位置",
|
||||
suggestName: "scrollPosition",
|
||||
structure: {
|
||||
x: { label: "X坐标", suggestName: "scrollPositionX" },
|
||||
y: { label: "Y坐标", suggestName: "scrollPositionY" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.getPageSize",
|
||||
label: "获取页面尺寸",
|
||||
icon: "open_in_full",
|
||||
outputs: {
|
||||
label: "页面尺寸",
|
||||
suggestName: "pageSize",
|
||||
structure: {
|
||||
width: { label: "宽度", suggestName: "pageWidth" },
|
||||
height: { label: "高度", suggestName: "pageHeight" },
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -686,6 +799,20 @@ export const browserCommands = {
|
||||
},
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "设置结果",
|
||||
suggestName: "interceptRequestResult",
|
||||
structure: {
|
||||
success: {
|
||||
label: "是否成功",
|
||||
suggestName: "isInterceptRequestSuccess",
|
||||
},
|
||||
message: {
|
||||
label: "消息",
|
||||
suggestName: "interceptRequestMessage",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.network.setResponseInterception",
|
||||
@ -741,11 +868,39 @@ export const browserCommands = {
|
||||
},
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "设置结果",
|
||||
suggestName: "interceptResponseResult",
|
||||
structure: {
|
||||
success: {
|
||||
label: "是否成功",
|
||||
suggestName: "isInterceptResponseSuccess",
|
||||
},
|
||||
message: {
|
||||
label: "消息",
|
||||
suggestName: "interceptResponseMessage",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.browser.network.clearInterception",
|
||||
label: "清除所有拦截规则",
|
||||
icon: "clear",
|
||||
outputs: {
|
||||
label: "清除结果",
|
||||
suggestName: "clearInterceptionResult",
|
||||
structure: {
|
||||
success: {
|
||||
label: "是否成功",
|
||||
suggestName: "isClearInterceptionSuccess",
|
||||
},
|
||||
message: {
|
||||
label: "消息",
|
||||
suggestName: "clearInterceptionMessage",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -19,41 +19,81 @@ export const codingCommands = {
|
||||
label: "Base64编码",
|
||||
value: "quickcomposer.coding.base64Encode",
|
||||
icon: "title",
|
||||
outputs: {
|
||||
label: "base64编码结果",
|
||||
suggestName: "base64Encoded",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Base64解码",
|
||||
value: "quickcomposer.coding.base64Decode",
|
||||
icon: "title",
|
||||
outputs: {
|
||||
label: "base64解码结果",
|
||||
suggestName: "base64Decoded",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "十六进制编码",
|
||||
value: "quickcomposer.coding.hexEncode",
|
||||
icon: "code",
|
||||
outputs: {
|
||||
label: "十六进制编码结果",
|
||||
suggestName: "hexEncoded",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "十六进制解码",
|
||||
value: "quickcomposer.coding.hexDecode",
|
||||
icon: "code",
|
||||
outputs: {
|
||||
label: "十六进制解码结果",
|
||||
suggestName: "hexDecoded",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "URL编码",
|
||||
value: "quickcomposer.coding.urlEncode",
|
||||
icon: "link",
|
||||
outputs: {
|
||||
label: "URL编码结果",
|
||||
suggestName: "urlEncoded",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "URL解码",
|
||||
value: "quickcomposer.coding.urlDecode",
|
||||
icon: "link",
|
||||
outputs: {
|
||||
label: "URL解码结果",
|
||||
suggestName: "urlDecoded",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "HTML编码",
|
||||
value: "quickcomposer.coding.htmlEncode",
|
||||
icon: "html",
|
||||
outputs: {
|
||||
label: "HTML编码结果",
|
||||
suggestName: "htmlEncoded",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "HTML解码",
|
||||
value: "quickcomposer.coding.htmlDecode",
|
||||
icon: "html",
|
||||
outputs: {
|
||||
label: "HTML解码结果",
|
||||
suggestName: "htmlDecoded",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -61,11 +101,21 @@ export const codingCommands = {
|
||||
value: "quickcomposer.coding.symmetricCrypto",
|
||||
label: "对称加解密",
|
||||
component: "SymmetricCryptoEditor",
|
||||
outputs: {
|
||||
label: "加解密结果",
|
||||
suggestName: "symmetricCryptoResult",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.coding.asymmetricCrypto",
|
||||
label: "非对称加解密",
|
||||
component: "AsymmetricCryptoEditor",
|
||||
outputs: {
|
||||
label: "加解密结果",
|
||||
suggestName: "asymmetricCryptoResult",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.coding.md5Hash",
|
||||
@ -83,26 +133,51 @@ export const codingCommands = {
|
||||
label: "MD5",
|
||||
value: "quickcomposer.coding.md5Hash",
|
||||
icon: "functions",
|
||||
outputs: {
|
||||
label: "MD5哈希结果",
|
||||
suggestName: "md5HashResult",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "SHA1",
|
||||
value: "quickcomposer.coding.sha1Hash",
|
||||
icon: "functions",
|
||||
outputs: {
|
||||
label: "SHA1哈希结果",
|
||||
suggestName: "sha1HashResult",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "SHA256",
|
||||
value: "quickcomposer.coding.sha256Hash",
|
||||
icon: "functions",
|
||||
outputs: {
|
||||
label: "SHA256哈希结果",
|
||||
suggestName: "sha256HashResult",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "SHA512",
|
||||
value: "quickcomposer.coding.sha512Hash",
|
||||
icon: "functions",
|
||||
outputs: {
|
||||
label: "SHA512哈希结果",
|
||||
suggestName: "sha512HashResult",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "SM3",
|
||||
value: "quickcomposer.coding.sm3Hash",
|
||||
icon: "functions",
|
||||
outputs: {
|
||||
label: "SM3哈希结果",
|
||||
suggestName: "sm3HashResult",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -22,6 +22,11 @@ export const dataCommands = {
|
||||
width: 12,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "反转结果",
|
||||
suggestName: "reversedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.replace",
|
||||
@ -47,6 +52,11 @@ export const dataCommands = {
|
||||
width: 6,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "替换结果",
|
||||
suggestName: "replacedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.substring",
|
||||
@ -76,6 +86,11 @@ export const dataCommands = {
|
||||
width: 6,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "截取结果",
|
||||
suggestName: "substringedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.trim",
|
||||
@ -101,6 +116,11 @@ export const dataCommands = {
|
||||
width: 4,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "去除空白结果",
|
||||
suggestName: "trimmedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.changeCase",
|
||||
@ -130,6 +150,11 @@ export const dataCommands = {
|
||||
width: 4,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "转换结果",
|
||||
suggestName: "changedCaseString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.pad",
|
||||
@ -170,6 +195,11 @@ export const dataCommands = {
|
||||
width: 4,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "填充结果",
|
||||
suggestName: "paddedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.split",
|
||||
@ -190,6 +220,11 @@ export const dataCommands = {
|
||||
defaultValue: newVarInputVal("str", ","),
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "分割结果",
|
||||
suggestName: "splitedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.join",
|
||||
@ -210,6 +245,11 @@ export const dataCommands = {
|
||||
defaultValue: newVarInputVal("str", ","),
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "合并结果",
|
||||
suggestName: "joinedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.repeat",
|
||||
@ -232,6 +272,11 @@ export const dataCommands = {
|
||||
defaultValue: 1,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "重复结果",
|
||||
suggestName: "repeatedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.extract",
|
||||
@ -259,6 +304,11 @@ export const dataCommands = {
|
||||
width: 4,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "提取结果",
|
||||
suggestName: "extractedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.count",
|
||||
@ -288,6 +338,11 @@ export const dataCommands = {
|
||||
width: 4,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "统计结果",
|
||||
suggestName: "countedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.wrap",
|
||||
@ -310,6 +365,11 @@ export const dataCommands = {
|
||||
defaultValue: 80,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "换行结果",
|
||||
suggestName: "wrappedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.string.align",
|
||||
@ -345,6 +405,11 @@ export const dataCommands = {
|
||||
defaultValue: 80,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "对齐结果",
|
||||
suggestName: "alignedString",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -1208,26 +1273,62 @@ export const dataCommands = {
|
||||
label: "时间字符串",
|
||||
component: "VariableInput",
|
||||
icon: "schedule",
|
||||
width: 8,
|
||||
placeholder: "2024-01-01 12:00:00",
|
||||
},
|
||||
{
|
||||
label: "原格式",
|
||||
component: "QSelect",
|
||||
icon: "format_shapes",
|
||||
width: 4,
|
||||
options: [
|
||||
{ label: "YYYY-MM-DD", value: "YYYY-MM-DD" },
|
||||
{ label: "YYYY-MM-DD HH:mm:ss", value: "YYYY-MM-DD HH:mm:ss" },
|
||||
{ label: "YYYY年MM月DD日", value: "YYYY年MM月DD日" },
|
||||
{ label: "MM/DD/YYYY", value: "MM/DD/YYYY" },
|
||||
{ label: "DD/MM/YYYY", value: "DD/MM/YYYY" },
|
||||
{ label: "时间戳(秒)", value: "timestamp" },
|
||||
{ label: "时间戳(毫秒)", value: "timestamp_ms" },
|
||||
],
|
||||
defaultValue: "YYYY-MM-DD HH:mm:ss",
|
||||
width: 12,
|
||||
placeholder: "2024-01-01 或 now 或 timestamp",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "时间解析结果",
|
||||
suggestName: "timeParseResult",
|
||||
structure: {
|
||||
date: {
|
||||
label: "日期",
|
||||
year: { label: "年", suggestName: "dateYear" },
|
||||
month: { label: "月", suggestName: "dateMonth" },
|
||||
day: { label: "日", suggestName: "dateDay" },
|
||||
},
|
||||
time: {
|
||||
label: "时间",
|
||||
hours: { label: "时", suggestName: "timeHours" },
|
||||
minutes: { label: "分", suggestName: "timeMinutes" },
|
||||
seconds: { label: "秒", suggestName: "timeSeconds" },
|
||||
},
|
||||
formats: {
|
||||
label: "格式化结果",
|
||||
iso: { label: "ISO 8601 格式", suggestName: "formatIso" },
|
||||
locale: { label: "本地格式", suggestName: "formatLocale" },
|
||||
localeDate: {
|
||||
label: "本地日期",
|
||||
suggestName: "formatLocaleDate",
|
||||
},
|
||||
localeTime: {
|
||||
label: "本地时间",
|
||||
suggestName: "formatLocaleTime",
|
||||
},
|
||||
dateCN: {
|
||||
label: "YYYY年MM月DD日",
|
||||
suggestName: "formatDateCN",
|
||||
},
|
||||
},
|
||||
timestamp: {
|
||||
label: "时间戳(秒)",
|
||||
suggestName: "formatTimestamp",
|
||||
},
|
||||
timestamp_ms: {
|
||||
label: "时间戳(毫秒)",
|
||||
suggestName: "formatTimestampMs",
|
||||
},
|
||||
calendar: {
|
||||
label: "日历信息",
|
||||
week: { label: "周", suggestName: "calendarWeek" },
|
||||
weekText: { label: "周文本", suggestName: "canlendarweekText" },
|
||||
isWeekend: { label: "是否周末", suggestName: "isWeekend" },
|
||||
isLeapYear: { label: "是否闰年", suggestName: "isLeapYear" },
|
||||
daysInMonth: { label: "月份天数", suggestName: "daysInMonth" },
|
||||
constellation: { label: "星座", suggestName: "constellation" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.time.add",
|
||||
@ -1379,20 +1480,6 @@ export const dataCommands = {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.time.calendar",
|
||||
label: "日历信息",
|
||||
icon: "calendar_month",
|
||||
config: [
|
||||
{
|
||||
label: "时间",
|
||||
component: "VariableInput",
|
||||
icon: "schedule",
|
||||
width: 12,
|
||||
placeholder: "2024-01-01 或 now",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.data.time.workday",
|
||||
label: "工作日计算",
|
||||
|
@ -8,10 +8,15 @@ export const fileCommands = {
|
||||
label: "文件/文件夹操作",
|
||||
component: "FileOperationEditor",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "文件/文件夹操作结果",
|
||||
suggestName: "fileOperationResult",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.shellOpenItem",
|
||||
label: "默认程序打开",
|
||||
neverHasOutput: true,
|
||||
config: [
|
||||
{
|
||||
label: "文件、文件夹或软件的绝对路径",
|
||||
@ -29,6 +34,7 @@ export const fileCommands = {
|
||||
{
|
||||
value: "utools.shellShowItemInFolder",
|
||||
label: "文件管理器中显示",
|
||||
neverHasOutput: true,
|
||||
config: [
|
||||
{
|
||||
label: "文件、文件夹或软件的绝对路径",
|
||||
@ -62,6 +68,10 @@ export const fileCommands = {
|
||||
},
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "文件图标",
|
||||
suggestName: "fileIcon",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.file.archive",
|
||||
@ -124,6 +134,7 @@ export const fileCommands = {
|
||||
value: "utools.shellTrashItem",
|
||||
label: "删除文件到回收站",
|
||||
icon: "delete",
|
||||
neverHasOutput: true,
|
||||
config: [
|
||||
{
|
||||
label: "文件或文件夹的绝对路径",
|
||||
|
@ -49,6 +49,47 @@ export const imageCommands = {
|
||||
},
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "图片信息",
|
||||
suggestName: "imageInfo",
|
||||
structure: {
|
||||
width: { label: "宽度", suggestName: "imageWidth" },
|
||||
height: { label: "高度", suggestName: "imageHeight" },
|
||||
aspectRatio: { label: "宽高比", suggestName: "imageAspectRatio" },
|
||||
resolution: { label: "分辨率", suggestName: "imageResolution" },
|
||||
type: { label: "类型", suggestName: "imageType" },
|
||||
format: { label: "格式", suggestName: "imageFormat" },
|
||||
size: { label: "大小", suggestName: "imageSize" },
|
||||
bytes: { label: "字节", suggestName: "imageBytes" },
|
||||
createTime: { label: "创建时间", suggestName: "imageCreateTime" },
|
||||
modifyTime: { label: "修改时间", suggestName: "imageModifyTime" },
|
||||
accessTime: { label: "访问时间", suggestName: "imageAccessTime" },
|
||||
path: { label: "路径", suggestName: "imagePath" },
|
||||
filename: { label: "文件名", suggestName: "imageFilename" },
|
||||
colorInfo: {
|
||||
label: "颜色信息",
|
||||
averageColor: {
|
||||
label: "平均RGBA",
|
||||
suggestName: "imageAverageRgba",
|
||||
},
|
||||
isTransparent: {
|
||||
label: "是否透明",
|
||||
suggestName: "imageIsTransparent",
|
||||
},
|
||||
hasAlphaChannel: {
|
||||
label: "是否包含Alpha通道",
|
||||
suggestName: "imageHasAlphaChannel",
|
||||
},
|
||||
},
|
||||
exif: { label: "EXIF", suggestName: "imageExif" },
|
||||
rawExif: { label: "原始EXIF", suggestName: "imageRawExif" },
|
||||
naturalWidth: { label: "自然宽度", suggestName: "imageNaturalWidth" },
|
||||
naturalHeight: {
|
||||
label: "自然高度",
|
||||
suggestName: "imageNaturalHeight",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.image.resize",
|
||||
@ -475,6 +516,7 @@ export const imageCommands = {
|
||||
{
|
||||
value: "quickcomposer.image.pngToIcon",
|
||||
label: "PNG转图标",
|
||||
neverHasOutput: true,
|
||||
icon: "transform",
|
||||
config: [
|
||||
{
|
||||
|
@ -1,3 +1,44 @@
|
||||
const windowOutputStructure = {
|
||||
name: { label: "应用名称", suggestName: "appName" },
|
||||
displayedName: {
|
||||
label: "应用显示名称",
|
||||
suggestName: "appDisplayName",
|
||||
},
|
||||
path: { label: "应用路径", suggestName: "appPath" },
|
||||
version: { label: "应用版本", suggestName: "appVersion" },
|
||||
pid: { label: "应用进程ID", suggestName: "appPid" },
|
||||
backgroundOnly: {
|
||||
label: "是否后台运行",
|
||||
suggestName: "appBackgroundOnly",
|
||||
},
|
||||
visible: { label: "是否可见", suggestName: "appVisible" },
|
||||
frontmost: { label: "是否前台运行", suggestName: "appFrontmost" },
|
||||
window: {
|
||||
label: "窗口信息",
|
||||
name: { label: "窗口名称", suggestName: "windowName" },
|
||||
title: { label: "窗口标题", suggestName: "windowTitle" },
|
||||
index: { label: "窗口索引", suggestName: "windowIndex" },
|
||||
position: {
|
||||
label: "窗口位置",
|
||||
placeholder: "数组,分别为 x 坐标,y 坐标",
|
||||
suggestName: "windowPosition",
|
||||
},
|
||||
size: {
|
||||
label: "窗口大小",
|
||||
placeholder: "数组,分别为 宽度,高度",
|
||||
suggestName: "windowSize",
|
||||
},
|
||||
minimized: {
|
||||
label: "是否最小化",
|
||||
suggestName: "windowMinimized",
|
||||
},
|
||||
fullscreen: {
|
||||
label: "是否全屏",
|
||||
suggestName: "windowFullscreen",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const macosCommands = {
|
||||
label: "Mac自动化",
|
||||
icon: "laptop_mac",
|
||||
@ -16,47 +57,7 @@ export const macosCommands = {
|
||||
outputs: {
|
||||
label: "前台应用信息",
|
||||
suggestName: "frontmostApp",
|
||||
structure: {
|
||||
name: { label: "应用名称", suggestName: "appName" },
|
||||
displayedName: {
|
||||
label: "应用显示名称",
|
||||
suggestName: "appDisplayName",
|
||||
},
|
||||
path: { label: "应用路径", suggestName: "appPath" },
|
||||
version: { label: "应用版本", suggestName: "appVersion" },
|
||||
pid: { label: "应用进程ID", suggestName: "appPid" },
|
||||
backgroundOnly: {
|
||||
label: "是否后台运行",
|
||||
suggestName: "appBackgroundOnly",
|
||||
},
|
||||
visible: { label: "是否可见", suggestName: "appVisible" },
|
||||
frontmost: { label: "是否前台运行", suggestName: "appFrontmost" },
|
||||
window: {
|
||||
label: "窗口信息",
|
||||
name: { label: "窗口名称", suggestName: "windowName" },
|
||||
title: { label: "窗口标题", suggestName: "windowTitle" },
|
||||
index: { label: "窗口索引", suggestName: "windowIndex" },
|
||||
position: {
|
||||
label: "窗口位置",
|
||||
placeholder:
|
||||
"数组, 第一个元素是 x 坐标,第二个元素是 y 坐标",
|
||||
suggestName: "windowPosition",
|
||||
},
|
||||
size: {
|
||||
label: "窗口大小",
|
||||
placeholder: "数组, 第一个元素是宽度,第二个元素是高度",
|
||||
suggestName: "windowSize",
|
||||
},
|
||||
minimized: {
|
||||
label: "是否最小化",
|
||||
suggestName: "windowMinimized",
|
||||
},
|
||||
fullscreen: {
|
||||
label: "是否全屏",
|
||||
suggestName: "windowFullscreen",
|
||||
},
|
||||
},
|
||||
},
|
||||
structure: windowOutputStructure,
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -64,7 +65,7 @@ export const macosCommands = {
|
||||
label: "获取活动应用",
|
||||
icon: "list",
|
||||
outputs: {
|
||||
label: "活动应用列表(数组)",
|
||||
label: "活动应用列表",
|
||||
suggestName: "runningApps",
|
||||
},
|
||||
},
|
||||
@ -78,7 +79,7 @@ export const macosCommands = {
|
||||
component: "VariableInput",
|
||||
icon: "apps",
|
||||
width: 12,
|
||||
placeholder: "输入应用名称",
|
||||
placeholder: "输入应用名称,如 Finder",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -92,7 +93,7 @@ export const macosCommands = {
|
||||
component: "VariableInput",
|
||||
icon: "apps",
|
||||
width: 12,
|
||||
placeholder: "输入应用名称",
|
||||
placeholder: "输入应用名称,如 Finder",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -106,7 +107,7 @@ export const macosCommands = {
|
||||
component: "VariableInput",
|
||||
icon: "apps",
|
||||
width: 12,
|
||||
placeholder: "输入应用名称",
|
||||
placeholder: "输入应用名称,如 Finder",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -120,7 +121,7 @@ export const macosCommands = {
|
||||
component: "VariableInput",
|
||||
icon: "apps",
|
||||
width: 12,
|
||||
placeholder: "输入应用名称",
|
||||
placeholder: "输入应用名称,如 Finder",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -134,7 +135,7 @@ export const macosCommands = {
|
||||
component: "VariableInput",
|
||||
icon: "apps",
|
||||
width: 12,
|
||||
placeholder: "输入应用名称",
|
||||
placeholder: "输入应用名称,如 Finder",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -148,7 +149,7 @@ export const macosCommands = {
|
||||
component: "VariableInput",
|
||||
icon: "apps",
|
||||
width: 12,
|
||||
placeholder: "输入应用名称",
|
||||
placeholder: "输入应用名称,如 Finder",
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -162,9 +163,14 @@ export const macosCommands = {
|
||||
component: "VariableInput",
|
||||
icon: "apps",
|
||||
width: 12,
|
||||
placeholder: "输入应用名称",
|
||||
placeholder: "输入应用名称,如 Finder",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "窗口信息",
|
||||
suggestName: "windows",
|
||||
structure: [windowOutputStructure],
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.macos.app.getScriptDictionary",
|
||||
@ -176,9 +182,40 @@ export const macosCommands = {
|
||||
component: "VariableInput",
|
||||
icon: "apps",
|
||||
width: 12,
|
||||
placeholder: "输入应用名称",
|
||||
placeholder: "输入应用名称,如 Finder",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "应用脚本字典",
|
||||
suggestName: "appScriptDictionary",
|
||||
structure: {
|
||||
commands: {
|
||||
label: "命令列表",
|
||||
suggestName: "appCommands",
|
||||
placeholder: "数组",
|
||||
},
|
||||
properties: {
|
||||
label: "属性列表",
|
||||
suggestName: "appProperties",
|
||||
placeholder: "数组",
|
||||
},
|
||||
summary: {
|
||||
label: "概要信息",
|
||||
totalCommands: {
|
||||
label: "命令总数",
|
||||
suggestName: "appTotalCommands",
|
||||
},
|
||||
totalProperties: {
|
||||
label: "属性总数",
|
||||
suggestName: "appTotalProperties",
|
||||
},
|
||||
hasScriptingSupport: {
|
||||
label: "是否支持脚本",
|
||||
suggestName: "appHasScriptingSupport",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -312,11 +349,48 @@ export const macosCommands = {
|
||||
value: "quickcomposer.macos.finder.getSelection",
|
||||
label: "获取选中项",
|
||||
icon: "select_all",
|
||||
outputs: {
|
||||
label: "选中项",
|
||||
suggestName: "selectedItems",
|
||||
structure: [
|
||||
{
|
||||
name: { label: "名称", suggestName: "firstItemName" },
|
||||
path: { label: "路径", suggestName: "firstItemPath" },
|
||||
kind: { label: "类型", suggestName: "firstItemKind" },
|
||||
size: { label: "大小", suggestName: "firstItemSize" },
|
||||
created: {
|
||||
label: "创建时间",
|
||||
suggestName: "firstItemCreatedTime",
|
||||
},
|
||||
modified: {
|
||||
label: "修改时间",
|
||||
suggestName: "firstItemModifiedTime",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.macos.finder.getCurrentFolder",
|
||||
label: "获取打开的路径",
|
||||
label: "获取打开的文件夹信息",
|
||||
icon: "folder_open",
|
||||
outputs: {
|
||||
label: "打开的文件夹信息",
|
||||
suggestName: "currentFolder",
|
||||
structure: {
|
||||
name: { label: "名称", suggestName: "currentFolderName" },
|
||||
path: { label: "路径", suggestName: "currentFolderPath" },
|
||||
kind: { label: "类型", suggestName: "currentFolderKind" },
|
||||
created: {
|
||||
label: "创建时间",
|
||||
suggestName: "currentFolderCreatedTime",
|
||||
},
|
||||
modified: {
|
||||
label: "修改时间",
|
||||
suggestName: "currentFolderModifiedTime",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.macos.finder.setShowHiddenFiles",
|
||||
@ -335,6 +409,21 @@ export const macosCommands = {
|
||||
value: "quickcomposer.macos.finder.getWindows",
|
||||
label: "获取窗口列表",
|
||||
icon: "window",
|
||||
outputs: {
|
||||
label: "窗口列表",
|
||||
suggestName: "finderWindows",
|
||||
structure: [
|
||||
{
|
||||
name: { label: "名称", suggestName: "firstFinderWindowName" },
|
||||
index: { label: "索引", suggestName: "firstFinderWindowIndex" },
|
||||
bounds: {
|
||||
label: "边界",
|
||||
suggestName: "firstFinderWindowBounds",
|
||||
},
|
||||
target: { label: "路径", suggestName: "firstFinderWindowPath" },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.macos.finder.activateWindow",
|
||||
|
@ -103,11 +103,21 @@ export const mathCommands = {
|
||||
value: "quickcomposer.math.random.number",
|
||||
label: "随机数",
|
||||
icon: "casino",
|
||||
outputs: {
|
||||
label: "随机数",
|
||||
suggestName: "randomNumber",
|
||||
typeName: "数字",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.math.random.integer",
|
||||
label: "随机整数",
|
||||
icon: "casino",
|
||||
outputs: {
|
||||
label: "随机整数",
|
||||
suggestName: "randomInteger",
|
||||
typeName: "数字",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -298,6 +308,11 @@ export const mathCommands = {
|
||||
value: "quickcomposer.math.conversion.base",
|
||||
label: "进制转换",
|
||||
icon: "swap_horiz",
|
||||
outputs: {
|
||||
label: "转换结果",
|
||||
suggestName: "convertedResult",
|
||||
typeName: "字符串",
|
||||
},
|
||||
config: [
|
||||
{
|
||||
label: "数值",
|
||||
|
@ -8,6 +8,7 @@ export const networkCommands = {
|
||||
{
|
||||
value: "utools.shellOpenExternal",
|
||||
label: "默认浏览器打开网址",
|
||||
neverHasOutput: true,
|
||||
config: [
|
||||
{
|
||||
label: "要访问的网址链接",
|
||||
@ -19,6 +20,7 @@ export const networkCommands = {
|
||||
{
|
||||
value: "utools.ubrowser.goto",
|
||||
label: "ubrowser打开网址",
|
||||
neverHasOutput: true,
|
||||
config: [
|
||||
{
|
||||
label: "要访问的网址链接",
|
||||
@ -43,6 +45,21 @@ export const networkCommands = {
|
||||
component: "AxiosConfigEditor",
|
||||
asyncMode: "await",
|
||||
icon: "http",
|
||||
outputs: {
|
||||
label: "HTTP请求结果",
|
||||
suggestName: "responseResult",
|
||||
structure: {
|
||||
status: { label: "HTTP状态码", suggestName: "responseStatus" },
|
||||
statusText: {
|
||||
label: "HTTP状态信息",
|
||||
suggestName: "responseStatusText",
|
||||
},
|
||||
headers: { label: "服务器响应头", suggestName: "responseHeaders" },
|
||||
config: { label: "请求配置信息", suggestName: "requestConfig" },
|
||||
request: { label: "发送的请求", suggestName: "request" },
|
||||
data: { label: "响应数据", suggestName: "responseData" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.parse",
|
||||
@ -54,12 +71,44 @@ export const networkCommands = {
|
||||
value: "quickcomposer.network.url.parse",
|
||||
label: "解析URL",
|
||||
icon: "link_off",
|
||||
config: [
|
||||
{
|
||||
label: "URL",
|
||||
component: "VariableInput",
|
||||
icon: "link",
|
||||
width: 12,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "URL解析结果",
|
||||
suggestName: "urlParseResult",
|
||||
structure: {
|
||||
protocol: { label: "协议", suggestName: "protocol" },
|
||||
slashes: { label: "是否包含斜杠", suggestName: "slashes" },
|
||||
auth: { label: "认证信息", suggestName: "auth" },
|
||||
host: { label: "主机", suggestName: "host" },
|
||||
port: { label: "端口", suggestName: "port" },
|
||||
hostname: { label: "主机名", suggestName: "hostname" },
|
||||
hash: { label: "锚点", suggestName: "hash" },
|
||||
search: { label: "查询字符串", suggestName: "search" },
|
||||
query: { label: "查询参数", suggestName: "query" },
|
||||
pathname: { label: "路径", suggestName: "pathname" },
|
||||
path: { label: "路径", suggestName: "path" },
|
||||
href: { label: "完整URL", suggestName: "href" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.format",
|
||||
label: "格式化URL",
|
||||
icon: "link",
|
||||
config: [
|
||||
{
|
||||
label: "URL",
|
||||
component: "VariableInput",
|
||||
icon: "link",
|
||||
width: 12,
|
||||
},
|
||||
{
|
||||
label: "协议",
|
||||
component: "VariableInput",
|
||||
@ -102,6 +151,10 @@ export const networkCommands = {
|
||||
width: 6,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "URL格式化结果",
|
||||
suggestName: "urlFormatResult",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.parseQuery",
|
||||
@ -114,6 +167,10 @@ export const networkCommands = {
|
||||
icon: "search",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "解析结果",
|
||||
suggestName: "queryParseResult",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.formatQuery",
|
||||
@ -126,30 +183,10 @@ export const networkCommands = {
|
||||
icon: "edit",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.parsePath",
|
||||
label: "解析路径",
|
||||
icon: "folder_open",
|
||||
config: [
|
||||
{
|
||||
label: "路径",
|
||||
component: "VariableInput",
|
||||
icon: "folder",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.parseHost",
|
||||
label: "解析主机名",
|
||||
icon: "dns",
|
||||
config: [
|
||||
{
|
||||
label: "主机名",
|
||||
component: "VariableInput",
|
||||
icon: "dns",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "格式化结果",
|
||||
suggestName: "queryFormatResult",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.getQueryParam",
|
||||
@ -169,6 +206,10 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "参数值",
|
||||
suggestName: "paramValue",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.addQueryParam",
|
||||
@ -194,6 +235,10 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "处理后URL",
|
||||
suggestName: "urlAfterAddParam",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.removeQueryParam",
|
||||
@ -213,6 +258,10 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "处理后URL",
|
||||
suggestName: "urlAfterRemoveParam",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.isAbsolute",
|
||||
@ -226,19 +275,11 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.url.parseComponents",
|
||||
label: "解析组成部分",
|
||||
icon: "category",
|
||||
config: [
|
||||
{
|
||||
label: "URL",
|
||||
component: "VariableInput",
|
||||
icon: "link",
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "是否是绝对URL",
|
||||
typeName: "布尔值",
|
||||
suggestName: "isAbsoluteUrl",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -279,6 +320,14 @@ export const networkCommands = {
|
||||
width: 2.5,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "解析结果",
|
||||
suggestName: "dnsLookupResult",
|
||||
structure: {
|
||||
address: { label: "IP地址", suggestName: "address" },
|
||||
family: { label: "IP版本", suggestName: "family" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveAll",
|
||||
@ -292,6 +341,10 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "解析地址列表",
|
||||
suggestName: "dnsResolveIpList",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveIpv4",
|
||||
@ -305,6 +358,10 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "IPv4地址列表",
|
||||
suggestName: "ipv4AddressList",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveIpv6",
|
||||
@ -318,6 +375,10 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "IPv6地址列表",
|
||||
suggestName: "ipv6AddressList",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveMxRecords",
|
||||
@ -331,6 +392,10 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "MX记录列表",
|
||||
suggestName: "mxRecordList",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveTxtRecords",
|
||||
@ -344,6 +409,10 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "TXT记录列表",
|
||||
suggestName: "txtRecordList",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveNsRecords",
|
||||
@ -357,6 +426,10 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "NS记录列表",
|
||||
suggestName: "nsRecordList",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.resolveCnameRecords",
|
||||
@ -370,6 +443,10 @@ export const networkCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "CNAME记录列表",
|
||||
suggestName: "cnameRecordList",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.network.dns.reverseResolve",
|
||||
@ -382,6 +459,10 @@ export const networkCommands = {
|
||||
component: "VariableInput",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "解析域名列表",
|
||||
suggestName: "reverseResolveDomainList",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -6,6 +6,7 @@ export const notifyCommands = {
|
||||
{
|
||||
value: "console.log",
|
||||
label: "显示消息",
|
||||
neverHasOutput: true,
|
||||
config: [
|
||||
{
|
||||
label: "要打印的消息文本",
|
||||
@ -17,6 +18,7 @@ export const notifyCommands = {
|
||||
{
|
||||
value: "utools.showNotification",
|
||||
label: "发送系统消息",
|
||||
neverHasOutput: true,
|
||||
config: [
|
||||
{
|
||||
label: "要发送的系统消息文本",
|
||||
|
@ -4,8 +4,9 @@ export const otherCommands = {
|
||||
defaultOpened: false,
|
||||
commands: [
|
||||
{
|
||||
value: "quickcommand.sleep",
|
||||
value: "quickcommand.asyncSleep",
|
||||
label: "添加延时",
|
||||
asyncMode: "await",
|
||||
config: [
|
||||
{
|
||||
label: "延迟的毫秒数",
|
||||
|
@ -65,6 +65,111 @@ const RECT_DICT_EDITOR = {
|
||||
},
|
||||
};
|
||||
|
||||
const DISPLAY_INFO_STRUCTURE = {
|
||||
id: { label: "显示器ID", suggestName: "primaryDisplayId" },
|
||||
label: { label: "显示器标签", suggestName: "primaryDisplayLabel" },
|
||||
bounds: {
|
||||
label: "边界",
|
||||
x: { label: "X坐标", suggestName: "primaryDisplayBoundsX" },
|
||||
y: { label: "Y坐标", suggestName: "primaryDisplayBoundsY" },
|
||||
width: {
|
||||
label: "宽度",
|
||||
suggestName: "primaryDisplayBoundsWidth",
|
||||
},
|
||||
height: {
|
||||
label: "高度",
|
||||
suggestName: "primaryDisplayBoundsHeight",
|
||||
},
|
||||
},
|
||||
workArea: {
|
||||
label: "工作区",
|
||||
x: { label: "X坐标", suggestName: "primaryDisplayWorkAreaX" },
|
||||
y: { label: "Y坐标", suggestName: "primaryDisplayWorkAreaY" },
|
||||
width: {
|
||||
label: "宽度",
|
||||
suggestName: "primaryDisplayWorkAreaWidth",
|
||||
},
|
||||
height: {
|
||||
label: "高度",
|
||||
suggestName: "primaryDisplayWorkAreaHeight",
|
||||
},
|
||||
},
|
||||
accelerometerSupport: {
|
||||
label: "是否支持加速度计",
|
||||
suggestName: "primaryDisplayAccelerometerSupport",
|
||||
},
|
||||
monochrome: {
|
||||
label: "是否是黑白显示器",
|
||||
suggestName: "primaryDisplayMonochrome",
|
||||
},
|
||||
colorDepth: {
|
||||
label: "颜色深度",
|
||||
suggestName: "primaryDisplayColorDepth",
|
||||
},
|
||||
colorSpace: {
|
||||
label: "颜色空间",
|
||||
suggestName: "primaryDisplayColorSpace",
|
||||
},
|
||||
depthPerComponent: {
|
||||
label: "每组件深度",
|
||||
suggestName: "primaryDisplayDepthPerComponent",
|
||||
},
|
||||
size: {
|
||||
label: "尺寸",
|
||||
width: {
|
||||
label: "宽度",
|
||||
suggestName: "primaryDisplaySizeWidth",
|
||||
},
|
||||
height: {
|
||||
label: "高度",
|
||||
suggestName: "primaryDisplaySizeHeight",
|
||||
},
|
||||
},
|
||||
displayFrequency: {
|
||||
label: "显示频率",
|
||||
suggestName: "primaryDisplayDisplayFrequency",
|
||||
},
|
||||
workAreaSize: {
|
||||
label: "工作区尺寸",
|
||||
width: {
|
||||
label: "宽度",
|
||||
suggestName: "primaryDisplayWorkAreaSizeWidth",
|
||||
},
|
||||
height: {
|
||||
label: "高度",
|
||||
suggestName: "primaryDisplayWorkAreaSizeHeight",
|
||||
},
|
||||
},
|
||||
scaleFactor: {
|
||||
label: "缩放比例",
|
||||
suggestName: "primaryDisplayScaleFactor",
|
||||
},
|
||||
rotation: {
|
||||
label: "旋转角度",
|
||||
suggestName: "primaryDisplayRotation",
|
||||
},
|
||||
internal: {
|
||||
label: "是否是内置显示器",
|
||||
suggestName: "primaryDisplayInternal",
|
||||
},
|
||||
touchSupport: {
|
||||
label: "是否支持触摸",
|
||||
suggestName: "primaryDisplayTouchSupport",
|
||||
},
|
||||
};
|
||||
|
||||
const XY_STRUCTURE = {
|
||||
x: { label: "X坐标", suggestName: "pointX" },
|
||||
y: { label: "Y坐标", suggestName: "pointY" },
|
||||
};
|
||||
|
||||
const RECT_STRUCTURE = {
|
||||
x: { label: "X坐标", suggestName: "rectX" },
|
||||
y: { label: "Y坐标", suggestName: "rectY" },
|
||||
width: { label: "宽度", suggestName: "rectWidth" },
|
||||
height: { label: "高度", suggestName: "rectHeight" },
|
||||
};
|
||||
|
||||
export const screenCommands = {
|
||||
label: "显示器",
|
||||
icon: "display_settings",
|
||||
@ -78,23 +183,43 @@ export const screenCommands = {
|
||||
value: "utools.getPrimaryDisplay",
|
||||
label: "获取主显示器",
|
||||
icon: "monitor",
|
||||
outputs: {
|
||||
label: "主显示器信息",
|
||||
suggestName: "primaryDisplayInfo",
|
||||
structure: DISPLAY_INFO_STRUCTURE,
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.getAllDisplays",
|
||||
label: "获取所有显示器",
|
||||
icon: "desktop_windows",
|
||||
outputs: {
|
||||
label: "所有显示器信息",
|
||||
suggestName: "allDisplaysInfo",
|
||||
structure: [DISPLAY_INFO_STRUCTURE],
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.getDisplayNearestPoint",
|
||||
label: "获取位置所在显示器",
|
||||
icon: "gps_fixed",
|
||||
config: [XY_DICT_EDITOR],
|
||||
outputs: {
|
||||
label: "显示器信息",
|
||||
suggestName: "nearestDisplayInfo",
|
||||
structure: DISPLAY_INFO_STRUCTURE,
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.getDisplayMatching",
|
||||
label: "获取矩形所在显示器",
|
||||
icon: "crop_square",
|
||||
config: [RECT_DICT_EDITOR],
|
||||
outputs: {
|
||||
label: "显示器信息",
|
||||
suggestName: "matchingDisplayInfo",
|
||||
structure: DISPLAY_INFO_STRUCTURE,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -103,6 +228,11 @@ export const screenCommands = {
|
||||
label: "物理/DIP坐标转换",
|
||||
icon: "transform",
|
||||
config: [XY_DICT_EDITOR],
|
||||
outputs: {
|
||||
label: "转换结果",
|
||||
suggestName: "convertedResult",
|
||||
structure: XY_STRUCTURE,
|
||||
},
|
||||
subCommands: [
|
||||
{
|
||||
value: "utools.screenToDipPoint",
|
||||
@ -121,6 +251,11 @@ export const screenCommands = {
|
||||
label: "物理/DIP区域转换",
|
||||
icon: "transform",
|
||||
config: [RECT_DICT_EDITOR],
|
||||
outputs: {
|
||||
label: "转换结果",
|
||||
suggestName: "convertedResult",
|
||||
structure: RECT_STRUCTURE,
|
||||
},
|
||||
subCommands: [
|
||||
{
|
||||
value: "utools.screenToDipRect",
|
||||
|
@ -25,6 +25,11 @@ export const scriptCommands = {
|
||||
component: "ScriptEditor",
|
||||
desc: "运行各种编程语言的代码",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "运行结果",
|
||||
suggestName: "runScriptResult",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "return",
|
||||
|
@ -10,15 +10,18 @@ export const simulateCommands = {
|
||||
label: "模拟按键",
|
||||
config: [],
|
||||
component: "KeyEditor",
|
||||
neverHasOutput: true,
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.simulate.keySequence",
|
||||
label: "按键序列",
|
||||
component: "KeySequenceEditor",
|
||||
neverHasOutput: true,
|
||||
},
|
||||
{
|
||||
value: "quickcommand.simulateCopy",
|
||||
label: "模拟复制粘贴",
|
||||
neverHasOutput: true,
|
||||
config: [],
|
||||
subCommands: [
|
||||
{
|
||||
@ -36,6 +39,11 @@ export const simulateCommands = {
|
||||
{
|
||||
value: "utools.hideMainWindowTypeString",
|
||||
label: "发送文本",
|
||||
outputs: {
|
||||
label: "是否发送成功",
|
||||
suggestName: "isSendSuccess",
|
||||
typeName: "布尔值",
|
||||
},
|
||||
config: [
|
||||
{
|
||||
label: "要发送的文本内容",
|
||||
@ -60,6 +68,11 @@ export const simulateCommands = {
|
||||
{
|
||||
value: "utools.hideMainWindowPasteFile",
|
||||
label: "模拟粘贴文件/图片",
|
||||
outputs: {
|
||||
label: "是否粘贴成功",
|
||||
suggestName: "isPasteSuccess",
|
||||
typeName: "布尔值",
|
||||
},
|
||||
icon: "file_copy",
|
||||
subCommands: [
|
||||
{
|
||||
@ -112,6 +125,7 @@ export const simulateCommands = {
|
||||
{
|
||||
value: "quickcomposer.simulate.mouseClick",
|
||||
label: "鼠标点击",
|
||||
neverHasOutput: true,
|
||||
config: [
|
||||
{
|
||||
component: "ButtonGroup",
|
||||
@ -208,6 +222,20 @@ export const simulateCommands = {
|
||||
label: "获取坐标",
|
||||
value: "utools.getCursorScreenPoint",
|
||||
icon: "mouse",
|
||||
outputs: {
|
||||
label: "鼠标坐标",
|
||||
suggestName: "mousePoint",
|
||||
structure: {
|
||||
x: {
|
||||
label: "X坐标",
|
||||
suggestName: "mouseX",
|
||||
},
|
||||
y: {
|
||||
label: "Y坐标",
|
||||
suggestName: "mouseY",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -217,12 +245,52 @@ export const simulateCommands = {
|
||||
component: "ImageSearchEditor",
|
||||
config: [],
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "图片坐标",
|
||||
suggestName: "foundImagePosition",
|
||||
structure: {
|
||||
x: {
|
||||
label: "X坐标",
|
||||
suggestName: "imageX",
|
||||
},
|
||||
y: {
|
||||
label: "Y坐标",
|
||||
suggestName: "imageY",
|
||||
},
|
||||
width: {
|
||||
label: "宽度",
|
||||
suggestName: "imageWidth",
|
||||
},
|
||||
height: {
|
||||
label: "高度",
|
||||
suggestName: "imageHeight",
|
||||
},
|
||||
confidence: {
|
||||
label: "置信度",
|
||||
suggestName: "imageConfidence",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.simulate.screenColorPick",
|
||||
label: "屏幕取色",
|
||||
icon: "colorize",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "颜色值",
|
||||
suggestName: "colorValue",
|
||||
structure: {
|
||||
hex: {
|
||||
label: "十六进制颜色值",
|
||||
suggestName: "colorHex",
|
||||
},
|
||||
rgb: {
|
||||
label: "RGB颜色值",
|
||||
suggestName: "colorRgb",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.simulate.captureScreen",
|
||||
@ -252,6 +320,11 @@ export const simulateCommands = {
|
||||
label: "保存到dataUrl",
|
||||
value: "quickcomposer.simulate.captureScreen",
|
||||
icon: "link",
|
||||
outputs: {
|
||||
label: "图片dataUrl",
|
||||
suggestName: "imageDataUrl",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "保存到文件",
|
||||
|
@ -7,30 +7,62 @@ export const statusCommands = {
|
||||
label: "获取当前文件管理器路径",
|
||||
icon: "folder",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "当前文件管理器路径",
|
||||
suggestName: "currentFolderPath",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.readCurrentBrowserUrl",
|
||||
label: "获取当前浏览器地址",
|
||||
icon: "language",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "当前浏览器地址",
|
||||
suggestName: "currentBrowserUrl",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.status.getSelectedText",
|
||||
label: "获取选中文本",
|
||||
icon: "text_fields",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "选中文本",
|
||||
suggestName: "selectedText",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.status.getSelectedImage",
|
||||
label: "获取选中的图片",
|
||||
icon: "image",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "选中图片DataUrl",
|
||||
suggestName: "selectedImageDataUrl",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.status.getSelectedFiles",
|
||||
label: "获取选中的文件",
|
||||
icon: "file_present",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "选中的文件列表",
|
||||
suggestName: "selectedFiles",
|
||||
structure: [
|
||||
{
|
||||
isFile: { label: "是否是文件", suggestName: "isSelectedFile" },
|
||||
isDirectory: { label: "是否是目录", suggestName: "isSelectedDirectory" },
|
||||
name: { label: "文件名", suggestName: "selectedFileName" },
|
||||
path: { label: "文件路径", suggestName: "selectedFilePath" },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -77,16 +77,39 @@ export const systemCommands = {
|
||||
value: "electron.clipboard.readText",
|
||||
label: "剪贴板文本",
|
||||
icon: "content_copy",
|
||||
outputs: {
|
||||
label: "剪贴板文本",
|
||||
suggestName: "clipboardText",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcommand.readClipboardImage",
|
||||
label: "剪贴板图片",
|
||||
icon: "image",
|
||||
outputs: {
|
||||
label: "图片DataURL",
|
||||
suggestName: "clipboardImageDataURL",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.getCopyedFiles",
|
||||
label: "剪贴板文件",
|
||||
icon: "file_copy",
|
||||
outputs: {
|
||||
label: "剪贴板文件列表",
|
||||
suggestName: "clipboardFileList",
|
||||
structure: [
|
||||
{
|
||||
isFile: { label: "是否是文件", suggestName: "isFile" },
|
||||
isDirectory: {
|
||||
label: "是否是目录",
|
||||
suggestName: "isDirectory",
|
||||
},
|
||||
name: { label: "文件名", suggestName: "name" },
|
||||
path: { label: "文件路径", suggestName: "path" },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "electron.clipboard.readRTF",
|
||||
@ -106,6 +129,10 @@ export const systemCommands = {
|
||||
component: "SystemCommandEditor",
|
||||
icon: "terminal",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "执行结果",
|
||||
suggestName: "execResult",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.getPath",
|
||||
@ -175,6 +202,10 @@ export const systemCommands = {
|
||||
],
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "系统路径",
|
||||
suggestName: "systemPath",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.isMacOS",
|
||||
@ -184,16 +215,31 @@ export const systemCommands = {
|
||||
value: "utools.isMacOS",
|
||||
label: "是否Mac",
|
||||
icon: "computer",
|
||||
outputs: {
|
||||
label: "是否是Mac",
|
||||
typeName: "布尔值",
|
||||
suggestName: "isMacOS",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.isWindows",
|
||||
label: "是否Windows",
|
||||
icon: "computer",
|
||||
outputs: {
|
||||
label: "是否是Windows",
|
||||
typeName: "布尔值",
|
||||
suggestName: "isWindows",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.isLinux",
|
||||
label: "是否Linux",
|
||||
icon: "computer",
|
||||
outputs: {
|
||||
label: "是否是Linux",
|
||||
typeName: "布尔值",
|
||||
suggestName: "isLinux",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@ -212,18 +258,24 @@ export const systemCommands = {
|
||||
value: "quickcomposer.system.os.cpus",
|
||||
label: "CPU信息",
|
||||
icon: "developer_board",
|
||||
config: [
|
||||
{
|
||||
label: "信息格式",
|
||||
component: "ButtonGroup",
|
||||
options: [
|
||||
{ label: "完整信息", value: "full" },
|
||||
{ label: "仅型号和速度", value: "simple" },
|
||||
],
|
||||
defaultValue: "full",
|
||||
width: 12,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "CPU信息",
|
||||
suggestName: "cpuInfo",
|
||||
structure: [
|
||||
{
|
||||
model: { label: "型号", suggestName: "model" },
|
||||
speed: { label: "速度", suggestName: "speed" },
|
||||
times: {
|
||||
label: "时间",
|
||||
user: { label: "user", suggestName: "user" },
|
||||
nice: { label: "nice", suggestName: "nice" },
|
||||
sys: { label: "sys", suggestName: "sys" },
|
||||
idle: { label: "idle", suggestName: "idle" },
|
||||
irq: { label: "irq", suggestName: "irq" },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.system.os.memory",
|
||||
@ -323,6 +375,17 @@ export const systemCommands = {
|
||||
width: "auto",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "路径解析结果",
|
||||
suggestName: "pathParseResult",
|
||||
structure: {
|
||||
root: { label: "根路径", suggestName: "parseRoot" },
|
||||
dir: { label: "目录", suggestName: "parseDir" },
|
||||
base: { label: "基本名称", suggestName: "parseBaseName" },
|
||||
ext: { label: "扩展名", suggestName: "parseExtName" },
|
||||
name: { label: "文件名", suggestName: "parseFileName" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcomposer.system.path.dirname",
|
||||
@ -482,6 +545,7 @@ export const systemCommands = {
|
||||
value: "quickcommand.kill",
|
||||
label: "关闭进程",
|
||||
icon: "dangerous",
|
||||
neverHasOutput: true,
|
||||
config: [
|
||||
{
|
||||
label: "进程ID",
|
||||
|
@ -171,6 +171,8 @@ export const uiCommands = {
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "是否确认",
|
||||
suggestName: "isConfirmed",
|
||||
typeName: "布尔值",
|
||||
},
|
||||
config: [
|
||||
{
|
||||
@ -221,6 +223,21 @@ export const uiCommands = {
|
||||
label: "按钮组",
|
||||
asyncMode: "await",
|
||||
width: 12,
|
||||
outputs: {
|
||||
label: "选择的按钮",
|
||||
suggestName: "selectedButton",
|
||||
structure: {
|
||||
id: {
|
||||
label: "按钮序号",
|
||||
suggestName: "buttonId",
|
||||
placeholder: "按钮的序号,从0开始",
|
||||
},
|
||||
text: {
|
||||
label: "按钮文本",
|
||||
suggestName: "buttonText",
|
||||
},
|
||||
},
|
||||
},
|
||||
config: [
|
||||
{
|
||||
label: "按钮",
|
||||
@ -255,6 +272,15 @@ export const uiCommands = {
|
||||
value: "quickcommand.showInputBox",
|
||||
label: "输入框",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "输入框值",
|
||||
suggestName: "inputValues",
|
||||
structure: [
|
||||
{ label: "第一个输入框的值", suggestName: "inputValue1" },
|
||||
{ label: "第二个输入框的值", suggestName: "inputValue2" },
|
||||
{ label: "第三个输入框的值", suggestName: "inputValue3" },
|
||||
],
|
||||
},
|
||||
config: [
|
||||
{
|
||||
label: "输入框",
|
||||
@ -294,11 +320,42 @@ export const uiCommands = {
|
||||
label: "选择列表",
|
||||
component: "SelectListEditor",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "选择结果",
|
||||
suggestName: "selectedItem",
|
||||
structure: {
|
||||
id: {
|
||||
label: "选项序号",
|
||||
suggestName: "itemId",
|
||||
placeholder: "选项的序号,从0开始",
|
||||
},
|
||||
text: {
|
||||
label: "选项文本",
|
||||
suggestName: "itemText",
|
||||
placeholder: "纯文本模式时选项的文本",
|
||||
},
|
||||
title: {
|
||||
label: "选项标题",
|
||||
suggestName: "itemTitle",
|
||||
placeholder: "JSON模式时选项的标题",
|
||||
},
|
||||
description: {
|
||||
label: "选项描述",
|
||||
suggestName: "itemDescription",
|
||||
placeholder: "JSON模式时选项的描述",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcommand.showTextArea",
|
||||
label: "文本框",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "文本框内容",
|
||||
suggestName: "textAreaContent",
|
||||
typeName: "字符串",
|
||||
},
|
||||
config: [
|
||||
{
|
||||
label: "文本框占位符",
|
||||
@ -330,6 +387,11 @@ export const uiCommands = {
|
||||
value: "quickcommand.showSystemWaitButton",
|
||||
label: "等待操作按钮",
|
||||
asyncMode: "await",
|
||||
outputs: {
|
||||
label: "是否点击按钮",
|
||||
suggestName: "isWaitButtonClicked",
|
||||
typeName: "布尔值",
|
||||
},
|
||||
config: [
|
||||
{
|
||||
component: "OptionEditor",
|
||||
@ -383,6 +445,15 @@ export const uiCommands = {
|
||||
},
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "选择的文件列表",
|
||||
suggestName: "selectedFiles",
|
||||
structure: [
|
||||
{ label: "第一个文件路径", suggestName: "firstFilePath" },
|
||||
{ label: "第二个文件路径", suggestName: "secondFilePath" },
|
||||
{ label: "第三个文件路径", suggestName: "thirdFilePath" },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.showSaveDialog",
|
||||
@ -399,6 +470,11 @@ export const uiCommands = {
|
||||
},
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "保存文件路径",
|
||||
suggestName: "selectedSavePath",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
@ -14,11 +14,27 @@ export const userdataCommands = {
|
||||
icon: "title",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "数据值",
|
||||
suggestName: "userDataValue",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcommand.userData.all",
|
||||
label: "获取所有用户数据",
|
||||
icon: "database",
|
||||
outputs: {
|
||||
label: "所有用户数据",
|
||||
suggestName: "allUserData",
|
||||
structure: [
|
||||
{
|
||||
id: { label: "数据标识", suggestName: "userDataId" },
|
||||
isNative: { label: "是否是本地数据", suggestName: "isNativeData" },
|
||||
value: { label: "数据值", suggestName: "userDataValue" },
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcommand.userData.put",
|
||||
@ -44,6 +60,11 @@ export const userdataCommands = {
|
||||
width: 2,
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "是否成功",
|
||||
suggestName: "isSetUserDataSuccess",
|
||||
typeName: "布尔值",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcommand.userData.del",
|
||||
@ -56,6 +77,11 @@ export const userdataCommands = {
|
||||
icon: "title",
|
||||
},
|
||||
],
|
||||
outputs: {
|
||||
label: "是否成功",
|
||||
suggestName: "isDelUserDataSuccess",
|
||||
typeName: "布尔值",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -6,15 +6,22 @@ export const utoolsCommands = {
|
||||
value: "utools.hideMainWindow",
|
||||
label: "隐藏主窗口",
|
||||
icon: "visibility_off",
|
||||
outputs: {
|
||||
label: "是否隐藏成功",
|
||||
typeName: "布尔值",
|
||||
suggestName: "isHideMainWindowSuccess",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "quickcommand.wakeUtools",
|
||||
label: "唤醒uTools",
|
||||
neverHasOutput: true,
|
||||
icon: "visibility",
|
||||
},
|
||||
{
|
||||
value: "utools.setExpendHeight",
|
||||
label: "设置uTools高度",
|
||||
neverHasOutput: true,
|
||||
icon: "height",
|
||||
config: [
|
||||
{
|
||||
@ -30,6 +37,7 @@ export const utoolsCommands = {
|
||||
{
|
||||
value: "utools.outPlugin",
|
||||
label: "退出插件",
|
||||
neverHasOutput: true,
|
||||
icon: "exit_to_app",
|
||||
config: [
|
||||
{
|
||||
@ -47,15 +55,30 @@ export const utoolsCommands = {
|
||||
value: "utools.isDarkColors",
|
||||
label: "是否深色模式",
|
||||
icon: "dark_mode",
|
||||
outputs: {
|
||||
label: "是否深色模式",
|
||||
suggestName: "isDarkColors",
|
||||
typeName: "布尔值",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.getUser",
|
||||
label: "获取用户信息",
|
||||
icon: "person",
|
||||
outputs: {
|
||||
label: "用户信息",
|
||||
suggestName: "userInfo",
|
||||
structure: {
|
||||
avatar: { label: "头像", suggestName: "userAvatar" },
|
||||
nickname: { label: "昵称", suggestName: "userNickname" },
|
||||
type: { label: "类型", suggestName: "userType" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.redirect",
|
||||
label: "转至指定插件",
|
||||
neverHasOutput: true,
|
||||
config: [
|
||||
{
|
||||
label: "要跳转至的插件名称",
|
||||
@ -74,6 +97,7 @@ export const utoolsCommands = {
|
||||
{
|
||||
value: "utools.findInPage",
|
||||
label: "插件内查找",
|
||||
neverHasOutput: true,
|
||||
icon: "search",
|
||||
subCommands: [
|
||||
{
|
||||
@ -137,6 +161,7 @@ export const utoolsCommands = {
|
||||
{
|
||||
value: "utools.stopFindInPage",
|
||||
label: "停止查找",
|
||||
neverHasOutput: true,
|
||||
icon: "stop",
|
||||
config: [
|
||||
{
|
||||
@ -159,14 +184,29 @@ export const utoolsCommands = {
|
||||
value: "utools.getWindowType",
|
||||
label: "获取当前窗口类型",
|
||||
icon: "window",
|
||||
outputs: {
|
||||
label: "窗口类型",
|
||||
suggestName: "windowType",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.getNativeId",
|
||||
label: "获取本地ID",
|
||||
outputs: {
|
||||
label: "本地ID",
|
||||
suggestName: "nativeId",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
{
|
||||
value: "utools.getAppVersion",
|
||||
label: "获取uTools版本",
|
||||
outputs: {
|
||||
label: "uTools版本",
|
||||
suggestName: "appVersion",
|
||||
typeName: "字符串",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -208,7 +208,7 @@ export const windowsCommands = {
|
||||
label: "搜索窗口",
|
||||
icon: "search",
|
||||
outputs: {
|
||||
label: "窗口信息(数组)",
|
||||
label: "窗口信息",
|
||||
structure: [
|
||||
{
|
||||
handle: { label: "窗口句柄" },
|
||||
|
@ -91,15 +91,15 @@ export function generateCode(flow) {
|
||||
code.push(
|
||||
`${indent}${getVarAssignCode(
|
||||
varName,
|
||||
getVarByPath(promiseName, path),
|
||||
flow.name
|
||||
getVarByPath(promiseName, path)
|
||||
)}`
|
||||
);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 非Async命令
|
||||
cmdCode = getVarAssignCode(name, `${cmdCode}`);
|
||||
const resultVarName = name || "result";
|
||||
cmdCode = getVarAssignCode(resultVarName, `${cmdCode}`);
|
||||
code.push(indent + cmdCode);
|
||||
// 处理详细变量
|
||||
if (details) {
|
||||
@ -107,8 +107,7 @@ export function generateCode(flow) {
|
||||
code.push(
|
||||
`${indent}${getVarAssignCode(
|
||||
varName,
|
||||
getVarByPath(name, path),
|
||||
flow.name
|
||||
getVarByPath(resultVarName, path)
|
||||
)}`
|
||||
);
|
||||
});
|
||||
@ -130,5 +129,9 @@ export function generateCode(flow) {
|
||||
code.push("\nmain();"); // Call the main function
|
||||
}
|
||||
|
||||
return code.join("\n");
|
||||
const finalCode = code.join("\n");
|
||||
|
||||
console.log(finalCode);
|
||||
|
||||
return finalCode;
|
||||
}
|
||||
|
12
src/plugins/monaco/types/quickcommand.api.d.ts
vendored
12
src/plugins/monaco/types/quickcommand.api.d.ts
vendored
@ -235,6 +235,18 @@ interface quickcommandApi {
|
||||
*/
|
||||
setTimeout(callback: () => void, ms);
|
||||
|
||||
/**
|
||||
* async 等待
|
||||
*
|
||||
* @param ms 等待的毫秒数
|
||||
* ```js
|
||||
* quickcommand.asyncSleep(2000).then(() => {
|
||||
* console.log('2000毫秒后执行')
|
||||
* })
|
||||
* ```
|
||||
*/
|
||||
asyncSleep(ms: number): Promise<number>;
|
||||
|
||||
/**
|
||||
* 将给定的html字符串解析为 DOM 对象,用于快速编写爬虫脚本
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user