I am trying to write a simple script that will move my mouse every 5 minutes if it has been idle. I am familiar wit开发者_JAVA百科h 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?
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 comment 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.com/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.
精彩评论