Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Move mouse if idle...?


  • Please log in to reply
8 replies to this topic
paulparkie
  • Guests
  • Last active:
  • Joined: --
Hi... I'm very new to this. I'm a school teacher and my school laptop (which is ridiculously locked down by admin) logs me out after 5 minutes of inactivity, which isn't very handy when it is linked to the projector that all the class are reading from!

I'm sure what I want is possible, and I've managed to make the mouse move with a script, but is it possible to make the script run automatically after 3 minutes of inactivity, and every 3 minutes thereafter?

So basically, after 3 minutes of inactivity I want the mouse to move a little, and then to keep moving a little every 3 minutes until I return the the laptop.

Many thanks

Paul

Leef_me
  • Moderators
  • 8510 posts
  • Last active: Sep 10 2015 05:50 AM
  • Joined: 08 Apr 2009
I tested this script using the values shown, with my screensaver set at 1 minute.
This prevented the screensaver from activating.
Since the laptop is "... ridiculously locked down by admin" I wonder if you will able to use the script.


#singleinstance force
#Persistent

; ================================================================
;        Move mouse if idle
; ================================================================
; adjust the folowing 3 values to suit your circumstances
; ================================================================

inactivity_limit=55	; measured in seconds
how_often_to_test=1	; measured in seconds
show_tooltip=1       ; 1=show, anything else means hide

; ================================================================

inactivity_limit_ms:=inactivity_limit*1000
how_often_to_test_ms:=how_often_to_test*1000


settimer, check_active, %how_often_to_test_ms%

mm_cnt=0
return

; ================================================================
; test if the mouse and keyboard have been idle

check_active:

; this tooltip is just a diagnostic, allow for disabling it during normal use
if show_tooltip=1
  tooltip, % A_TimeIdlePhysical "ms`rmoves " mm_cnt


if A_TimeIdlePhysical > %inactivity_limit_ms%
{
  mousemove,1,1,100, R	; down and right 1 pixel each time

  mm_cnt++	; tally number of times the mouse was artificially moved
}

return


; these hotkeys are diagnostics, disable during normal use

; esc::exitapp	
; f10::reload
Further improvements might include use only when certain windows are present
Such as the presentation window of PPT2007
>>>>>>>>>>( Window Title & Class )<<<<<<<<<<<
PowerPoint Slide Show - [Presentation1]
ahk_class screenClass


paulparkie
  • Guests
  • Last active:
  • Joined: --
Many thanks for the quick response - I will try it as soon as I get into school tomorrow. So just to check (as I said, I'm a complete 'code novice') can I just cut and paste your code into the script window, then delete all the green writing and leave everything else as it is and it will be good to run...?

Thanks

  • Guests
  • Last active:
  • Joined: --

...can I just cut and paste your code into the script window, then delete all the green writing and leave everything else as it is and it will be good to run...?

As a teacher, you should know how valuable the instructions can be.

paulparkie
  • Guests
  • Last active:
  • Joined: --
Yes, and thank you for pointing that out. I have read the instructions already, but I just wanted to know about taking the green writing out. As i have tried a few other scripts and I just wondered, how specific the scripts need to be with leaving 'spaces' and 'lines' etc within them to make them work. Basically, can I just delete the green writing and the script will work?

Thanks

Leef_me
  • Moderators
  • 8510 posts
  • Last active: Sep 10 2015 05:50 AM
  • Joined: 08 Apr 2009

Yes, and thank you for pointing that out. I have read the instructions already, but I just wanted to know about taking the green writing out. As i have tried a few other scripts and I just wondered, how specific the scripts need to be with leaving 'spaces' and 'lines' etc within them to make them work. Basically, can I just delete the green writing and the script will work?


What you FAILED to comprehend when you passed over "Guest" suggestion
is that the lines that appear green in the web posting are comments <!-- m -->http://www.autohotke...ts.htm#Comments<!-- m -->

Leaving the comments in will not hurt the script or make it malfunction.
Conversely, taking the comments out will not hurt the script, nor will it improve readability or functionality.

Why would you WANT to remove the comments?

Tom93
  • Members
  • 3 posts
  • Last active: Jun 01 2013 05:34 PM
  • Joined: 24 Apr 2011
Thanks Leef_me - that little script works great for me, too.
I sometimes need to leave my computer available with tools running for hours to allow coworkers to investigate issues, and this prevents them having to come find me every X minutes to log back in.

mastahcez
  • Members
  • 12 posts
  • Last active: Oct 10 2015 09:49 PM
  • Joined: 20 Sep 2015

I'm going to revive this thread because this script is almost exactly what I'm looking for but I need to modify it to move(and click) the mouse once and then wait till I make a move. This one keeps moving the cursor continuously..

The purpose for this script would be to pause my work timer if I'm away for more than x seconds. Currently it doesn't work for me because it keeps toggling the said timer on and off every time it tests.. help?

 

Thanks!



mastahcez
  • Members
  • 12 posts
  • Last active: Oct 10 2015 09:49 PM
  • Joined: 20 Sep 2015

Nevermind, it was SetTimer, Off:P

 

I actually ended up writing my script from scratch anyway.

 

If anyone else is using Baralga and wants to save their clients some money:

 #singleinstance force
 #Persistent

 SetTimer, PauseBaralga, 20000 
 return

 PauseBaralga:
 if A_TimeIdle > 20000
 	{
		SetTimer, PauseBaralga, Off 		;stop the timer
		IfWinExist, Baralga 			;application to pause
		WinActivate 				;go to application
		Click 130, 145 				;pause
		MouseMove -435, 721 			;move to position of msgbox
		MsgBox Get back to work. 
		KeyWait, LButton, D 			;wait for me to unpause application
		reload
  	}
 return


 F10::reload ;dev stuff, remember to comment out when happy with script
 F11::pause

I know it's rough but it's my third script so far, I'm open to critique though.

 

Cheers