模拟鼠标点击增加循环点击

This commit is contained in:
fofolee
2025-01-20 23:00:01 +08:00
parent db281ce38c
commit b026b484f7
3 changed files with 77 additions and 30 deletions

View 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;