Page 1 of 1

Move Mouse on Interval

Posted: Aug 19th, ’21, 07:27
by TokyoMike
Hi - I have an app that moves my mouse every "x" seconds in order to prevent my machine from going to sleep.

If you move the mouse manually it turns the functionality off.

I was wondering if this type of script could be supported by Fastkeys, and would someone be willing to write one?

The use case is simple - if the computer is IDLE (user is not moving the mouse around) then start a counter - if the user doesn't move the mouse during that time (so 30 seconds) then move the mouse slightly. This would tell the computer that there has been user input and keep the sleep function from executing.

This is an example of the capability I am trying to replace (no GUI needed - just the capability): https://www.microsoft.com/en-us/p/move- ... verviewtab

Thanks!

Re: Move Mouse on Interval

Posted: Aug 21st, ’21, 13:47
by Tom
Great idea. This is very handy when you want to keep the computer awake, for example, when working from home and want to keep your remote session alive while you are away from your machine.

This simple script will simulate user activity by slightly moving the mouse every minute. Running the script again will disable it. Create it as a shortcut (Type: Command):

Code: Select all

if TimerActive
{
    SetTimer, MoveMouse, Off
    TimerActive:=0
    SplashTextOn, , , Move Mouse DISABLED
    Sleep 1000
    SplashTextOff
}
else
{
    SetTimer, MoveMouse
    TimerActive:=1
    SplashTextOn, , , Move Mouse ACTIVE
    Sleep 1000
    SplashTextOff
}
        
MoveMouse:
if (A_TimeIdle>59999)
{
    MouseMove, 1, 1,, R
    MouseMove, -1, -1,, R
}
return

Re: Move Mouse on Interval

Posted: Aug 22nd, ’21, 23:50
by TokyoMike
Oh man, THANK YOU! This works great!

Great as I am working from home 100% of the time yet IT still wants to make sure my PC locks after 5 minutes. Thank you so much.