Sam
Sam

Reputation: 21

Script to move mouse every 5 minutes

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?

Upvotes: 1

Views: 15294

Answers (3)

Yavor S
Yavor S

Reputation: 1493

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.

Upvotes: 0

Adriaan Koster
Adriaan Koster

Reputation: 16209

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

Upvotes: 0

talnicolas
talnicolas

Reputation: 14053

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.

Upvotes: 2

Related Questions