将发送文本从消息通知移到模拟操作,增加模拟粘贴选项

This commit is contained in:
fofolee 2025-01-08 15:05:21 +08:00
parent 7a43695e2d
commit 6af4a15e2a
4 changed files with 62 additions and 34 deletions

View File

@ -1,7 +1,9 @@
const { findImage } = require("./imageFinder");
const { captureScreen } = require("./screenCapture");
const sendText = require("./sendText");
module.exports = {
findImage,
captureScreen,
sendText,
};

View File

@ -0,0 +1,11 @@
const sendText = (text, simulateCopy = false) => {
if (simulateCopy) {
window.utools.copyText(text);
quickcommand.sleep(200);
quickcommand.simulatePaste();
} else {
window.utools.hideMainWindowTypeString(text);
}
};
module.exports = sendText;

View File

@ -5,7 +5,7 @@ export const notifyCommands = {
commands: [
{
value: "console.log",
label: "打印消息",
label: "显示消息",
config: [
{
key: "log",
@ -27,17 +27,5 @@ export const notifyCommands = {
},
],
},
{
value: "utools.hideMainWindowTypeString",
label: "发送文本到活动窗口",
config: [
{
key: "text",
label: "要发送到窗口的文本内容",
type: "varInput",
icon: "send",
},
],
},
],
};

View File

@ -9,10 +9,33 @@ export const simulateCommands = {
config: [],
component: "KeyEditor",
},
{
value: "quickcomposer.simulate.sendText",
label: "发送文本",
config: [
{
key: "text",
label: "要发送的文本内容",
type: "varInput",
icon: "send",
width: 9,
},
{
label: "发送方式",
type: "select",
defaultValue: false,
icon: "keyboard",
options: [
{ label: "模拟输入", value: false },
{ label: "模拟粘贴", value: true },
],
width: 3,
},
],
},
{
value: "utools.simulateMouseClick",
label: "鼠标点击",
allowEmptyArgv: true,
config: [
{
label: "X坐标留空则原地点击",
@ -47,32 +70,36 @@ export const simulateCommands = {
},
{
value: "utools.simulateMouseMove",
label: "鼠标移动",
config: [
label: "鼠标位置",
functionSelector: [
{
label: "X坐标",
icon: "drag_handle",
defaultValue: 0,
type: "numInput",
width: 6,
label: "移动到坐标",
value: "utools.simulateMouseMove",
icon: "mouse",
config: [
{
label: "X坐标",
icon: "drag_handle",
defaultValue: 0,
type: "numInput",
width: 6,
},
{
label: "Y坐标",
icon: "drag_handle",
defaultValue: 0,
type: "numInput",
width: 6,
},
],
},
{
label: "Y坐标",
icon: "drag_handle",
defaultValue: 0,
type: "numInput",
width: 6,
label: "获取坐标",
value: "utools.getCursorScreenPoint",
icon: "mouse",
},
],
},
{
value: "utools.getCursorScreenPoint",
label: "获取鼠标坐标",
outputVariable: "{x:curX,y:curY}",
saveOutput: true,
config: [],
allowEmptyArgv: true,
},
{
value: "quickcomposer.simulate.findImage",
label: "屏幕找图",