Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Move Mouse when Not in Use to Disable Screensaver


  • Please log in to reply
14 replies to this topic
ClintiePoo
  • Members
  • 6 posts
  • Last active: Jun 03 2011 05:13 AM
  • Joined: 08 Dec 2006
Where I work, they automatically activate the screensaver after a certain amount of time. This gets annoying when you're using a desktop and a laptop. I'm trying to create a script that if you don't move the mouse in a certain amount of time does it for you. When you move the mouse again, it gives you back control.
Here's my code so far. I'm not that good at this, so please bear with me. Any help is appreciated. Thanks!

#Persistent
SetTimer, WatchCursor, 100
return

Loop
{
WatchCursor:
MouseGetPos,X1 ,Y1 
Sleep 10000
MouseGetPos,X2,Y2
if X1=X2 And Y1=Y2 
{
MouseMove,100,100
Sleep, 10000
MouseMove,200,200
Sleep, 10000
}
}


SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
#Persistent
SetTimer, MoveMouse

MoveMouse:
If ( A_TimeIdle > 59999 ) {
  MouseMove, 1 , 1,, R
  MouseMove, -1,-1,, R
}
Return

:D
kWo4Lk1.png

ClintiePoo
  • Members
  • 6 posts
  • Last active: Jun 03 2011 05:13 AM
  • Joined: 08 Dec 2006
Thank you so much! That's exactly what I needed!

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Thank you so much!


Anytime! :D
kWo4Lk1.png

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Perhaps it is easier to deactivate the screensaver, tweaking the registry for example... Now, perhaps you need higher rights than you have.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

Perhaps it is easier to deactivate the screensaver, tweaking the registry for example... Now, perhaps you need higher rights than you have.


Oh Yes! :shock: : How to Disable Screen Saver Temporarily ? :D
kWo4Lk1.png

ClintiePoo
  • Members
  • 6 posts
  • Last active: Jun 03 2011 05:13 AM
  • Joined: 08 Dec 2006

Perhaps it is easier to deactivate the screensaver, tweaking the registry for example... Now, perhaps you need higher rights than you have.


This just doesn't work with the way they have it set up.

Oh Yes! : How to Disable Screen Saver Temporarily ?


This doesn't work correctly either. It causes error messages when it closes the screen saver. They have it hard coded somehow, and I'm not sure how to disable it. The mouse solution, I think, is the most simple and elegant solution for my situation. Thanks again for the help.

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005

How to Disable Screen Saver Temporarily ?


This doesn't work correctly either. It causes error messages when it closes the screen saver. They have it hard coded somehow, and I'm not sure how to disable it.


Oh I See!.. Lack of Admin rights, I guess!

:)
kWo4Lk1.png

Lemming
  • Members
  • 184 posts
  • Last active: Feb 03 2014 11:03 AM
  • Joined: 20 Dec 2005

Oh I See!.. Lack of Admin rights, I guess!
:)


Even that may not be enough. I suspect he's on a network with Group Policy in effect.

In this case, the network admin can lock down many desktop settings, so even if you were the local admin, the network admin's settings would overwrite yours.

CyBerend
  • Members
  • 2 posts
  • Last active: Nov 10 2015 10:33 PM
  • Joined: 16 Oct 2013

Hi,

I realize this is an old topic, but my question relates exactly to the script that is suggested here.

I have been using this code for a few months now inside my master script and so far, it's done exactly what it promised: every 9 minutes (as I set it up), it moves the mouse a tiny bit and this way, I'm able to circumvent the forced lock screen after 10 min. idle which I can't change.

 

For some reason, it suddenly stopped working and I can't figure out why. I made lots of changes in the master script, and it's possible that something has impacted on it, but even if I now set it up as a standalone script it doesn't seem to work anymore. I also tried to run the script standalone without my big main script running, same result.

 

For testing, I set it up like this, to get a more vigorous and frequent response from the mouse:

 

#Persistent
SetTimer, MoveMouse
MoveMouse:
If ( A_TimeIdle > 3000 ) {
  MouseMove, 10 , 0,, R
Sleep, 1000
  MouseMove, -10, 0,, R
}
Return

 

so you'd expect to see the mouse jump 10px to the right, and 10px to the left one second later, repeating every three seconds. What I see is nothing. Anyone have an idea of what I'm doing wrong here? It used to work, configured exactly like this (except the values).

 

 



CyBerend
  • Members
  • 2 posts
  • Last active: Nov 10 2015 10:33 PM
  • Joined: 16 Oct 2013

Well, it seems that I underestimated the importance of where in the script the routine is placed; I moved it up a bit and now it works again.

I thought I covered (and discarded) that possibility already when I tried to run the routine as a standalone script, but I probably made a mistake that  time, because if I do it now, it just works again.

 

So: I broke it by moving the routine below my list of hotstrings, and fixed it by moving it back up again



Lemming
  • Members
  • 184 posts
  • Last active: Feb 03 2014 11:03 AM
  • Joined: 20 Dec 2005

I can confirm that Group Policy will override any user attempts to change screensaver settings or disable it.

 

I'm facing the same situation so I came up with a similar script some months ago. The only difference is, mine presses the right-shift key every minute, if the computer is idle. This might work better than jiggling the mouse because the right-shift key is "do nothing" in most programs and in Windows, but it is enought to wake the computer up.

#Persistent
SetTimer, CheckIdle, 60000    ; 60 sec / 1 min
Return

CheckIdle:
If (A_TimeIdle > 60000)
{
    Send {RShift}
}
Return


Annihilannic
  • Members
  • 9 posts
  • Last active: Nov 26 2018 03:20 AM
  • Joined: 26 Oct 2011

Perfect, thanks guys, just what I was looking for!

 

I'm glad CyberEnd mentioned about the position in the script too... I had to move it to the top before it would work.  Is that normal for #Persistent?



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

Perfect, thanks guys, just what I was looking for!

 

I'm glad CyberEnd mentioned about the position in the script too... I had to move it to the top before it would work.  Is that normal for #Persistent?

 

There's a section to a script called the auto-execute section. The auto-execute section ends as soon as a hotkey/hotstring is introduced to the script. The auto-execute system launches whenever the script is loaded. What you'd need is for the SetTimer that makes the periodic check to be in the auto-execute section. The label (MoveMouse: in CyBerend's example) does not need to be in the auto-execute section.

 

The function of #Persistent is for scripts without a hotkey. Normally if an auto-execute section reaches the end of the script, it will exit the script. But #Persistent overrides that behavior and keeps the script open (but does not reload the script).



Annihilannic
  • Members
  • 9 posts
  • Last active: Nov 26 2018 03:20 AM
  • Joined: 26 Oct 2011

Thanks, all clear now.