mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-28 03:42:51 +08:00
模拟鼠标点击增加循环点击
This commit is contained in:
parent
db281ce38c
commit
b026b484f7
@ -2,6 +2,7 @@ const { findImage } = require("./imageFinder");
|
||||
const { keyboardTap, keySequence } = require("./keyboardTap");
|
||||
const { screenColorPick } = require("./screenColorPick");
|
||||
const screenCapture = require("./screenCapture");
|
||||
const mouseClick = require("./mouseClick");
|
||||
|
||||
module.exports = {
|
||||
findImage,
|
||||
@ -9,5 +10,6 @@ module.exports = {
|
||||
keyboardTap,
|
||||
keySequence,
|
||||
screenColorPick,
|
||||
mouseClick,
|
||||
...screenCapture,
|
||||
};
|
||||
|
18
plugin/lib/quickcomposer/simulate/mouseClick.js
Normal file
18
plugin/lib/quickcomposer/simulate/mouseClick.js
Normal file
@ -0,0 +1,18 @@
|
||||
const mouseClick = (mouseAction = "Click", options) => {
|
||||
const { x, y, count = 1, interval = 0 } = options;
|
||||
let mouseActionFn = () => {};
|
||||
if (x !== undefined && y !== undefined) {
|
||||
mouseActionFn = () => utools["simulateMouse" + mouseAction](x, y);
|
||||
} else {
|
||||
mouseActionFn = () => utools["simulateMouse" + mouseAction]();
|
||||
}
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
mouseActionFn();
|
||||
if (interval > 0 && i < count - 1) {
|
||||
quickcommand.sleep(interval);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = mouseClick;
|
@ -110,41 +110,68 @@ export const simulateCommands = {
|
||||
],
|
||||
},
|
||||
{
|
||||
value: "utools.simulateMouseClick",
|
||||
value: "quickcomposer.simulate.mouseClick",
|
||||
label: "鼠标点击",
|
||||
config: [
|
||||
{
|
||||
label: "X坐标(留空则原地点击)",
|
||||
icon: "drag_handle",
|
||||
component: "NumberInput",
|
||||
min: 0,
|
||||
step: 10,
|
||||
width: 6,
|
||||
component: "ButtonGroup",
|
||||
options: [
|
||||
{
|
||||
label: "单击",
|
||||
value: "Click",
|
||||
},
|
||||
{
|
||||
label: "右击",
|
||||
value: "RightClick",
|
||||
},
|
||||
{
|
||||
label: "双击",
|
||||
value: "DoubleClick",
|
||||
},
|
||||
],
|
||||
defaultValue: "Click",
|
||||
width: 12,
|
||||
},
|
||||
{
|
||||
label: "Y坐标(留空则原地点击)",
|
||||
icon: "drag_handle",
|
||||
component: "NumberInput",
|
||||
min: 0,
|
||||
step: 10,
|
||||
width: 6,
|
||||
},
|
||||
],
|
||||
subCommands: [
|
||||
{
|
||||
label: "单击",
|
||||
value: "utools.simulateMouseClick",
|
||||
icon: "mouse",
|
||||
},
|
||||
{
|
||||
label: "右击",
|
||||
value: "utools.simulateMouseRightClick",
|
||||
icon: "mouse",
|
||||
},
|
||||
{
|
||||
label: "双击",
|
||||
value: "utools.simulateMouseDoubleClick",
|
||||
icon: "mouse",
|
||||
component: "OptionEditor",
|
||||
options: {
|
||||
x: {
|
||||
label: "X坐标",
|
||||
icon: "drag_handle",
|
||||
component: "NumberInput",
|
||||
min: 0,
|
||||
step: 10,
|
||||
width: 6,
|
||||
placeholder: "XY任意留空原地点击",
|
||||
},
|
||||
y: {
|
||||
label: "Y坐标",
|
||||
icon: "drag_handle",
|
||||
component: "NumberInput",
|
||||
min: 0,
|
||||
step: 10,
|
||||
width: 6,
|
||||
placeholder: "XY任意留空原地点击",
|
||||
},
|
||||
count: {
|
||||
label: "点击次数",
|
||||
component: "NumberInput",
|
||||
min: 1,
|
||||
step: 1,
|
||||
width: 6,
|
||||
defaultValue: 1,
|
||||
},
|
||||
interval: {
|
||||
label: "点击间隔(毫秒)",
|
||||
component: "NumberInput",
|
||||
min: 0,
|
||||
step: 100,
|
||||
width: 6,
|
||||
},
|
||||
},
|
||||
defaultValue: {
|
||||
count: 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user