mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-28 20:02:44 +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 { keyboardTap, keySequence } = require("./keyboardTap");
|
||||||
const { screenColorPick } = require("./screenColorPick");
|
const { screenColorPick } = require("./screenColorPick");
|
||||||
const screenCapture = require("./screenCapture");
|
const screenCapture = require("./screenCapture");
|
||||||
|
const mouseClick = require("./mouseClick");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
findImage,
|
findImage,
|
||||||
@ -9,5 +10,6 @@ module.exports = {
|
|||||||
keyboardTap,
|
keyboardTap,
|
||||||
keySequence,
|
keySequence,
|
||||||
screenColorPick,
|
screenColorPick,
|
||||||
|
mouseClick,
|
||||||
...screenCapture,
|
...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: "鼠标点击",
|
label: "鼠标点击",
|
||||||
config: [
|
config: [
|
||||||
{
|
{
|
||||||
label: "X坐标(留空则原地点击)",
|
component: "ButtonGroup",
|
||||||
icon: "drag_handle",
|
options: [
|
||||||
component: "NumberInput",
|
{
|
||||||
min: 0,
|
label: "单击",
|
||||||
step: 10,
|
value: "Click",
|
||||||
width: 6,
|
},
|
||||||
|
{
|
||||||
|
label: "右击",
|
||||||
|
value: "RightClick",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "双击",
|
||||||
|
value: "DoubleClick",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
defaultValue: "Click",
|
||||||
|
width: 12,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Y坐标(留空则原地点击)",
|
component: "OptionEditor",
|
||||||
icon: "drag_handle",
|
options: {
|
||||||
component: "NumberInput",
|
x: {
|
||||||
min: 0,
|
label: "X坐标",
|
||||||
step: 10,
|
icon: "drag_handle",
|
||||||
width: 6,
|
component: "NumberInput",
|
||||||
},
|
min: 0,
|
||||||
],
|
step: 10,
|
||||||
subCommands: [
|
width: 6,
|
||||||
{
|
placeholder: "XY任意留空原地点击",
|
||||||
label: "单击",
|
},
|
||||||
value: "utools.simulateMouseClick",
|
y: {
|
||||||
icon: "mouse",
|
label: "Y坐标",
|
||||||
},
|
icon: "drag_handle",
|
||||||
{
|
component: "NumberInput",
|
||||||
label: "右击",
|
min: 0,
|
||||||
value: "utools.simulateMouseRightClick",
|
step: 10,
|
||||||
icon: "mouse",
|
width: 6,
|
||||||
},
|
placeholder: "XY任意留空原地点击",
|
||||||
{
|
},
|
||||||
label: "双击",
|
count: {
|
||||||
value: "utools.simulateMouseDoubleClick",
|
label: "点击次数",
|
||||||
icon: "mouse",
|
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