最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Script to move mouse every 5 minutes - Stack Overflow

programmeradmin0浏览0评论

I am trying to write a simple script that will move my mouse every 5 minutes if it has been idle. I am familiar with Java and C but I have never written a script before.

I've tried VBS and JavaScript but I can't seem to find a way to determine when the mouse has moved. Does anyone have some advice?

I am trying to write a simple script that will move my mouse every 5 minutes if it has been idle. I am familiar with Java and C but I have never written a script before.

I've tried VBS and JavaScript but I can't seem to find a way to determine when the mouse has moved. Does anyone have some advice?

Share Improve this question edited Mar 5, 2021 at 10:39 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Aug 10, 2011 at 18:44 SamSam 211 gold badge1 silver badge2 bronze badges 2
  • Are you talking about "Java" or JavaScript", and do you know the difference between the two? – Hovercraft Full Of Eels Commented Aug 10, 2011 at 18:47
  • Why do you want to move your mouse like that? If you want to stop screensavers, sleep then there are ways to do that. – David Heffernan Commented Aug 10, 2011 at 18:47
Add a ment  | 

3 Answers 3

Reset to default 2

In Java, you could take a look at the Robot class here that will allow you to move the mouse directly from your program.

You can also use a mouse-motion listener to check if the mouse has been moved, check here, or MouseInfo, as indicated in the first ment below.

I suggest you take a look at AutoIt. It's a script language for Windows automation.

You can use onmousemove

I prefer query but you can do it with onmousemove js event http://api.jquery./mousemove/

You should have a global variable and set the time when last moved. Also put a timeout (setTimeout('update()', 1);) for five minutes and check when the mouse has last moved.

发布评论

评论列表(0)

  1. 暂无评论