Jump to content

Recommended Posts

Posted

Hi

Is it possible to detect if the screensaver has activated ?

For the avoidance of doubt, I'm not writing my own screensaver and I know there are lots of example posts for that already.

Basically, I'd like to have a script running silently in the background and as soon as the screensaver kicks-in, it runs a cpu-intensive simulation I'm working on then automatically ceases when the user logs back in.

Thanks

Scott

Posted

i'm not very keen in process-detection, but as far as i know you just have to know the processname and check if it is active

maybe you should consider using 2 scripts (1 for the detection the other for your cpu-consuming stuff) if you do the process-stuff i can help you with the rest

maybe you can find the process in the registry

the process should be scrnsave.exe, so the code might look like

while 1
while not processexists ("SCRNSAVE.EXE")
sleep (10)
wend
if processexists ("SCRNSAVE.EXE") then run ("other prog")
while processexists ("SCRNSAVE.EXE")
sleep (10)
wend
if not processexists ("SCRNSAVE.EXE") then send ("!a")
wend

this was the code for the frist prog

2nd:

hotkeyset ("!a", "stop")
;your code here - maybe store your line somewhere and make a reentry-point

func stop()
exit
endfunc

this could do the job - maybe give it a try

Posted

I personally would do it like this:

Main Screensaver detector:

Run("otherprog.exe")
while 1
   ProcessWait ("SCRNSAVE.EXE")
   AutoItWinSetTitle ( "SSC_RESUME_10222948377793847" )
   ProcessWaitClose ("SCRNSAVE.EXE")
   AutoItWinSetTitle ( "SSC" )
   Send ("!^#a")
WEnd

The simulator code: (otherprog.exe)

WinWait("SSC_RESUME_10222948377793847")
HotKeySet("!^#a", "_ssc_pause")

;;;;;;;PUT YOUR CODE HERE

Func _ssc_pause()
   WinWait("SSC_RESUME_10222948377793847")
   Return
EndFunc

The otherprog.exe will pause it's script's execution when the screensaver comes off then resume at the point it paused when the screensaver appears again.

#)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...