mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-10-10 07:23:23 +08:00
模拟鼠标点击增加循环点击
This commit is contained in:
@@ -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;
|
Reference in New Issue
Block a user