Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Reducing system volume / muting when screensaver comes on


  • Please log in to reply
5 replies to this topic
Fuzz
  • Guests
  • Last active:
  • Joined: --
Hi,

I've been looking for a way to reduce the volume when a screensaver comes on and so far have been unable to do so. The reducing volume bit is fairly easy, but I have been unable to find a way to detect when the screensaver is running. Any help would be greatly appreciated!

On a side note I was wondering whether there was a way to fade the volume in to a certain level e.g. 25% from a lower value through a script.

Thanks :)

Clash
  • Members
  • 182 posts
  • Last active: Oct 26 2009 08:31 PM
  • Joined: 27 Jun 2006
You could write an idle time script with the same idle time as the screensaver.

time=1 ;activate after 1 minute of idle time.

result := time
result *= 60000

loop {
if(A_TimeIdle = result){
soundset, 0, master,,1
}
sleep, 1000
}

To fade, you use a loop. These will loop 50 times making the volume go up one notch each loop. There's 100 'notches' in the volume. That is to say if the volume was at 0 you would need to press volume up 100 times to get to max.

;fade up - getting louder

loop 50{
vol:=vol
vol+=1 ; increment by 1. change to 2,3 etc to fade faster
soundset, %vol%, master,,1
sleep, 1000
}

;fade down - getting quieter

loop 50{
vol:=vol
vol-=1 ; decrement by 1. change to 2,3 etc to fade faster
soundset, %vol%, master,,1
sleep, 1000
}

If you really needed to only mute when the screensaver is activate, you'd need to find the reg key to the screensaver filename. then make a script which waits for that filename to be active using the process command.

You could cut out the reg bit by hard coding the screensaver filename. You can find the filenames in C:\WINDOWS\system32.

I made it myself because i thought it'd be useful. turned out to be really easy.

loop {
process, wait, FLIQLO.scr
soundset, 0, master,,1
sleep, 1
}

Posted Image Posted Image

VxE
  • Moderators
  • 3622 posts
  • Last active: Dec 24 2015 02:21 AM
  • Joined: 07 Oct 2006
well, here's my crack at it. This script doesn't check the registry and it hasn't been extensively tested.
#Persistent

#SingleInstance Force

SetTimer, DetectScreenSaver, 1000

DetectScreenSaver:

winget, pn, processname, A

If (SubStr(pn, -3) = ".scr" )

{

	If !sc_on

	{

		SoundGet, OldSound

		SoundSet, 0

		sc_on = 1

	}

}

else If sc_on

{

	SoundSet, %OldSound%

	sc_on = 0

}

return


Clash
  • Members
  • 182 posts
  • Last active: Oct 26 2009 08:31 PM
  • Joined: 27 Jun 2006
Works for me. You wouldn't know how to detect if the monitor's off would you? I don't use screensavers.
Posted Image Posted Image

orbik
  • Members
  • 36 posts
  • Last active: Jul 11 2015 05:35 PM
  • Joined: 09 Apr 2008
This sounds like a job for the shell hook method explained here http://www.autohotke...p=123323#123323
You'll get notified immediately when the screensaver starts instead of waiting inside a loop.

VxE
  • Moderators
  • 3622 posts
  • Last active: Dec 24 2015 02:21 AM
  • Joined: 07 Oct 2006

Works for me. You wouldn't know how to detect if the monitor's off would you? I don't use screensavers.

Sry, I don't. I'm sure there's a magic Dll somewhere with a "MonitorStatus" function, but I don't know where.