AutoHotkey Community

It is currently May 26th, 2012, 3:35 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: April 21st, 2008, 6:53 pm 
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 :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 21st, 2008, 9:23 pm 
Offline

Joined: June 27th, 2006, 4:36 pm
Posts: 182
You could write an idle time script with the same idle time as the screensaver.

Code:

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.

Code:
;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.

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

_________________
Image Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 22nd, 2008, 12:06 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3328
Location: Simi Valley, CA
well, here's my crack at it. This script doesn't check the registry and it hasn't been extensively tested.
Code:
#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

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 22nd, 2008, 12:36 am 
Offline

Joined: June 27th, 2006, 4:36 pm
Posts: 182
Works for me. You wouldn't know how to detect if the monitor's off would you? I don't use screensavers.

_________________
Image Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 22nd, 2008, 1:29 am 
Offline

Joined: April 9th, 2008, 8:46 am
Posts: 35
Location: Espoo, Finland
This sounds like a job for the shell hook method explained here http://www.autohotkey.com/forum/viewtopic.php?p=123323#123323
You'll get notified immediately when the screensaver starts instead of waiting inside a loop.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 22nd, 2008, 1:39 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3328
Location: Simi Valley, CA
Clash wrote:
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.

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: 0x150||ISO, Bing [Bot], Exabot [Bot] and 22 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group