用node.js移动鼠标光标 [英] Move mouse cursor with node.js

查看:295
本文介绍了用node.js移动鼠标光标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何方法或模块可以移动光标并使用node.js模拟windows7 / 8中的鼠标点击?

Is there is any way or module to move cursor and simulate mouse clicks in windows7/8 with node.js?

我发现这个库https://www.npmjs.org/package/win_mouse 但似乎不起作用

I found this library https://www.npmjs.org/package/win_mouse but seems like it doesn't work

推荐答案

我一直在研究这个模块, RobotJS

I've been working on a module for this, RobotJS.

示例代码:

var robot = require("robotjs");

//Get the mouse position, retuns an object with x and y. 
var mouse=robot.getMousePos();
console.log("Mouse is at x:" + mouse.x + " y:" + mouse.y);

//Move the mouse down by 100 pixels.
robot.moveMouse(mouse.x,mouse.y+100);

//Left click!
robot.mouseClick();

它仍在进行中,但它会做你想做的事!

It's still a work in progress but it will do what you want!

这篇关于用node.js移动鼠标光标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆