Sunday, 23 April 2017

Loop dont execute until keyboard is pressed

So i have this node.js script which supposed to get mouse position and move it few times. The problem is that my loop executes 1 time and then it just stops and does nothing, but it also dont end the script(It just shows blinking underline in new line). When i press something on keyboard script executes all lasting times and script ends like it should be. So where might be the problem?

var robot = require("robotjs");


for(var i = 1; i < 5; i++) {

var mouse=robot.getMousePos();
console.log("Mouse is at x:" + mouse.x + " y:" + mouse.y);
robot.moveMouse(mouse.x,mouse.y+100);
robot.mouseClick();

}



via greyb3ast

No comments:

Post a Comment