Mouse Click After Inactivity

cmb991
cmb991 used Ask the Experts™
on
Does anyone know of a program that I can use to execute a mouse  click in a certain spot of after 3 minutes of inactivity?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Joe WinogradDeveloper
Fellow 2017
Most Valuable Expert 2018

Commented:
A simple script in AutoHotkey can do it. You can get started learning about AutoHotkey with this EE article:
AutoHotkey - Getting Started

After learning the basics, you'll want to study these built-in variables:
A_TimeIdle
A_TimeIdlePhysical

And this command:
MouseClick

Regards, Joe

Author

Commented:
Like this?

IfGreater, A_TimeIdle, 180
	MouseClick, left, 60, 45

Open in new window

Developer
Fellow 2017
Most Valuable Expert 2018
Commented:
That's correct syntax, although I personally don't use statements like IfEqual, IfNotEqual, IfGreater, etc. I prefer more traditional If statements, like

If (var=1000)
If (var<>0)
If (var>180)

The A_TimeIdle built-in variable is in milliseconds, not seconds. So you want 180000 there, not 180.

Of course, you'll want to put that in some type of loop. Here's a script that works, but it's just for test purposes — to stop it, right-click on the tray icon and click Exit. Note that you need to understand the CoordMode statement:
https://autohotkey.com/docs/commands/CoordMode.htm

CoordMode,Mouse,Screen ; or whatever you want here
IdleTimeLimit:=3*60*1000 ; 3 minutes in milliseconds
Loop
{
  If (A_TimeIdle>IdleTimeLimit)
  {
    MouseClick,Left,60,45
    ; any other code you want when the idle time limit is exceeded
  }
}

Open in new window

Regards, Joe

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial