AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SoundSleep

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Sandeep



Joined: 29 Nov 2004
Posts: 10

PostPosted: Mon Nov 29, 2004 1:49 pm    Post subject: SoundSleep Reply with quote

How about getting a SoundSleep!
Well following script turns down your computer's volume over a specified period of time. After the specified period it just sends a stop signal to the media player or optionally you can also shutdown your computer.
Good for all those who have a habit of listening to music while retiring to bed.
Code:

#s::
InputBox, ss_SecToStop, SoundSleep, Please enter sleep time in minutes, , 150, 125
if ErrorLevel <> 0

   return
SoundGet, ss_OriginalVol
ss_SecToStop *= 60
Loop, %ss_SecToStop%
{
   Sleep, 1000
   SoundGet, ss_CurVol
   ss_VolStep = %ss_CurVol%
   ss_VolStep /= %ss_SecToStop%
   SoundSet, -%ss_VolStep%
   ss_SecToStop--
}
Send, {MEDIA_STOP}
;Some Media Players take time to stop
Sleep, 1000   
;Restore the original volume
SoundSet, %ss_OriginalVol%

;You can as well shutdown your computer
;Shutdown, 9 ;(Shutdown + Power down)

_________________
Sandeep
Back to top
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Mon Nov 29, 2004 6:39 pm    Post subject: Reply with quote

Cool script! Sometimes I do like to go to sleep listening to Bach.

Btw, welcome to the forum, Sandeep! Wink
Back to top
View user's profile Send private message
Sandeep



Joined: 29 Nov 2004
Posts: 10

PostPosted: Tue Nov 30, 2004 1:33 am    Post subject: Reply with quote

Thanks Buddy!
_________________
Sandeep
Back to top
View user's profile Send private message
sleepyy35



Joined: 22 Jul 2004
Posts: 194
Location: cedar city UT

PostPosted: Tue Nov 30, 2004 8:42 am    Post subject: Reply with quote

nice script thanks for sharing Laughing
_________________
^sleepy^
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group