mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-19 18:25:44 +08:00
完善编辑命令界面
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
const commandTypes = {
|
||||
keyword: {
|
||||
name: "keyword",
|
||||
key: {
|
||||
name: "key",
|
||||
label: "关键词",
|
||||
icon: "font_download",
|
||||
matchLabel: "关键词",
|
||||
desc: "在主输入框输入对应关键字进入插件,最通用的一种模式,关键字可以设置多个",
|
||||
valueType: "array"
|
||||
valueType: "array",
|
||||
matchToCmds: (rules, desc) => rules,
|
||||
verify: (rules) => rules.length > 0 || "关键词不能为空"
|
||||
},
|
||||
regex: {
|
||||
name: "regex",
|
||||
@@ -13,7 +15,14 @@ const commandTypes = {
|
||||
matchLabel: "正则",
|
||||
icon: "rule",
|
||||
desc: "匹配主输入框或超级面板选中的文本,可以获取输入框文本或选中文本作为变量",
|
||||
valueType: "regex"
|
||||
valueType: "regex",
|
||||
matchToCmds: (rules, desc) => [{
|
||||
label: desc,
|
||||
type: "regex",
|
||||
match: rules,
|
||||
minNum: 1,
|
||||
}, ],
|
||||
verify: rules => !!rules > 0 || "正则不能为空"
|
||||
},
|
||||
over: {
|
||||
name: "over",
|
||||
@@ -21,7 +30,13 @@ const commandTypes = {
|
||||
matchLabel: "无需设置",
|
||||
icon: "emergency",
|
||||
desc: "匹配主输入框的所有文本,但只有在该文本未设置对应的插件或功能时才生效",
|
||||
valueType: "null"
|
||||
valueType: null,
|
||||
matchToCmds: (rules, desc) => [{
|
||||
label: desc,
|
||||
type: "over",
|
||||
minNum: 1,
|
||||
}],
|
||||
verify: rules => true
|
||||
},
|
||||
window: {
|
||||
name: "window",
|
||||
@@ -29,7 +44,15 @@ const commandTypes = {
|
||||
matchLabel: "进程名",
|
||||
icon: "widgets",
|
||||
desc: "匹配呼出uTools前或唤出超级面板时的活动窗口,可以获取窗口的信息或文件夹路径作为变量",
|
||||
valueType: "array"
|
||||
valueType: "array",
|
||||
matchToCmds: (rules, desc) => [{
|
||||
type: "window",
|
||||
label: desc,
|
||||
match: {
|
||||
"app": rules
|
||||
}
|
||||
}],
|
||||
verify: rules => rules.length > 0 || "进程名不能为空"
|
||||
},
|
||||
img: {
|
||||
name: "img",
|
||||
@@ -37,7 +60,12 @@ const commandTypes = {
|
||||
matchLabel: "无需配置",
|
||||
icon: "panorama",
|
||||
desc: "匹配主输入框或超级面板选中的图片,并返回图片的 base64",
|
||||
valueType: "null"
|
||||
valueType: null,
|
||||
matchToCmds: (rules, desc) => [{
|
||||
label: desc,
|
||||
type: "img",
|
||||
}],
|
||||
verify: rules => true
|
||||
},
|
||||
files: {
|
||||
name: "files",
|
||||
@@ -45,7 +73,14 @@ const commandTypes = {
|
||||
matchLabel: "正则",
|
||||
icon: "description",
|
||||
desc: "匹配主输入框或超级面板选中的文件,可以获取复制及选中的文件信息作为变量",
|
||||
valueType: "regex"
|
||||
valueType: "regex",
|
||||
matchToCmds: (rules, desc) => [{
|
||||
type: "files",
|
||||
label: desc,
|
||||
match: rules,
|
||||
"minLength": 1,
|
||||
}, ],
|
||||
verify: rules => !!rules > 0 || "正则不能为空"
|
||||
|
||||
},
|
||||
professional: {
|
||||
@@ -54,8 +89,60 @@ const commandTypes = {
|
||||
matchLabel: "json配置",
|
||||
icon: "construction",
|
||||
desc: "通过json格式的配置实现同时匹配关键字、窗口、文件甚至图片,或者指定文件数量、窗口类等",
|
||||
valueType: "json"
|
||||
valueType: "json",
|
||||
matchToCmds: (rules, desc) => JSON.parse(rules),
|
||||
verify: rules => {
|
||||
try {
|
||||
JSON.parse(rules);
|
||||
return true
|
||||
} catch (error) {
|
||||
return "专业模式json配置错误"
|
||||
}
|
||||
},
|
||||
jsonSample: [
|
||||
"关键词",
|
||||
{
|
||||
"type": "img",
|
||||
"label": "图片匹配"
|
||||
},
|
||||
{
|
||||
"type": "files",
|
||||
"label": "文件匹配",
|
||||
"fileType": "file",
|
||||
"match": "/aaa/",
|
||||
"minLength": 1,
|
||||
"maxLength": 99
|
||||
},
|
||||
{
|
||||
"type": "regex",
|
||||
"label": "文本正则匹配",
|
||||
"match": "/bbb/i",
|
||||
"minLength": 1,
|
||||
"maxLength": 99
|
||||
},
|
||||
{
|
||||
"type": "over",
|
||||
"label": "无匹配时",
|
||||
"exclude": "/ccc/i",
|
||||
"minLength": 1,
|
||||
"maxLength": 99
|
||||
},
|
||||
{
|
||||
"type": "window",
|
||||
"label": "窗口动作",
|
||||
"match": {
|
||||
"app": [
|
||||
"ddd.app",
|
||||
"eee.exe"
|
||||
],
|
||||
"title": "/fff/",
|
||||
"class": [
|
||||
"ggg"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
export default commandTypes
|
||||
export default commandTypes
|
||||
|
||||
64
src/js/options/specialVars.js
Normal file
64
src/js/options/specialVars.js
Normal file
@@ -0,0 +1,64 @@
|
||||
const specialVars = {
|
||||
isWin: {
|
||||
name: "isWin",
|
||||
label: "{{isWin}}",
|
||||
desc: "是否Window系统, 返回1或0"
|
||||
},
|
||||
LocalId: {
|
||||
name: "LocalId",
|
||||
label: "{{LocalId}}",
|
||||
desc: "本机唯一ID"
|
||||
},
|
||||
BrowserUrl: {
|
||||
name: "BrowserUrl",
|
||||
label: "{{BrowserUrl}}",
|
||||
desc: "浏览器当前链接"
|
||||
},
|
||||
ClipText: {
|
||||
name: "ClipText",
|
||||
label: "{{ClipText}}",
|
||||
desc: "剪贴板内容"
|
||||
},
|
||||
subinput: {
|
||||
name: "subinput",
|
||||
label: "{{subinput}}",
|
||||
desc: "子输入框的文本"
|
||||
},
|
||||
input: {
|
||||
name: "input",
|
||||
label: "{{input}}",
|
||||
desc: "主输入框的文本"
|
||||
},
|
||||
pwd: {
|
||||
name: "pwd",
|
||||
label: "{{pwd}}",
|
||||
desc: "文件管理器当前目录"
|
||||
},
|
||||
WindowInfo: {
|
||||
name: "WindowInfo",
|
||||
label: "{{WindowInfo}}",
|
||||
desc: "当前窗口信息,JSON格式"
|
||||
},
|
||||
SelectFile: {
|
||||
name: "SelectFile",
|
||||
label: "{{SelectFile}}",
|
||||
desc: "文件管理器选中的文件,不支持Linux"
|
||||
},
|
||||
MatchedFiles: {
|
||||
name: "MatchedFiles",
|
||||
label: "{{MatchedFiles}}",
|
||||
desc: "匹配的文件,JSON格式"
|
||||
},
|
||||
type: {
|
||||
name: "type",
|
||||
label: "{{type}}",
|
||||
desc: "专业模式的type"
|
||||
},
|
||||
payload: {
|
||||
name: "payload",
|
||||
label: "{{payload}}",
|
||||
desc: "专业模式的payload,JSON格式"
|
||||
}
|
||||
}
|
||||
|
||||
export default specialVars
|
||||
Reference in New Issue
Block a user