我有以下无限循环,但只有在2次尝试后,它才会继续执行run_click()
;
我该如何修复它,让我们永远奔跑而不会阻挡?
var forever = null;
function loopit() {
forever = setTimeout(function() {
run_click();
loopit(); // Please run for-ever to keep alive the robot
}, 5000);
}
function run_click() {
var robot = require("robotjs");
var mouse=robot.getMousePos();
// 2 time it shows on the console but then nothing...
console.log("Mouse is at x:" + mouse.x + " y:" + mouse.y);
robot.moveMouse(770,442);
robot.mouseClick();
robot = null;
}
loopit();