AutoHotkey Community

It is currently May 27th, 2012, 1:06 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: January 6th, 2010, 4:51 pm 
Offline

Joined: November 24th, 2008, 7:22 pm
Posts: 73
I like to do unexpected things in meetings to liven things up at times. Sound effects like a game show BUZZZZ can be hilarious if your timing is right. I wanted a quick way to launch into an app that would let me play any wav file in a directory with minimal keystrokes while controlling the volume. Again, timing is everything, right? So, I wrote this script. Enjoy.

It launches into a directory you choose as default but allows navigation to other directories. Escape will terminate a long playing file if it needs to be killed early.

-Relayer

Code:
#SingleInstance Force
#NoEnv

EffectsPath = C:\utilities\WAV
initVol = 4
Gui:  ;build gui based on files in a directory
   Gui, Font, s8 w700
   Gui, Add, Edit, x16 y17 w140 h20 , %EffectsPath%
   Gui, Add, Button, gBrowse x156 y17 w60 h20 , Browse
   Gui, Add, Edit, y17 w40
   Gui, Add, UpDown, Group vVol gVol xp Range1-10, %initVol%
      Gui, Add, Radio, vRadVol gRadVol y17, 1
      Gui, Add, Radio, gRadVol y17, 2
      Gui, Add, Radio, gRadVol y17, 3
      Gui, Add, Radio, gRadVol Checked y17, 4
      Gui, Add, Radio, gRadVol y17, 5
      Gui, Add, Radio, gRadVol y17, 6
      Gui, Add, Radio, gRadVol y17, 7
      Gui, Add, Radio, gRadVol y17, 8
      Gui, Add, Radio, gRadVol y17, 9
      Gui, Add, Radio, gRadVol y17, 10
   
   Loop, %EffectsPath%\*.wav
   if (A_Index = 1)
      Gui, Add, Button, gPlayIt x16 section, %A_LoopFileName%  ;make this a section
   else
   {
      if(mod(A_Index,25) = 1)
         Gui, Add, Button, gPlayIt ys , %A_LoopFileName%
      else
         Gui, Add, Button, gPlayIt , %A_LoopFileName%
   }
   Gui, Show
Return

PlayIt:
Gui, Submit, NoHide
;msgbox, %A_Gui% `n %A_GuiControl% `n %A_GuiEvent% `n %A_EventInfo%
wav = %EffectsPath%\%A_GuiControl%
SoundGet, mastermute, Master, Mute
;msgbox, %mastermute%
SoundGet, mastervol, Master, Volume
SoundGet, wavemute, Wave, Mute
SoundGet, wavevol, Wave, Volume
SoundSet, (10 * Vol), Master, Volume  ;temporary volume handled in 10 rough steps (adequate for meetings, hehehe!)
SoundSet, (10 * Vol), Wave, Volume
SoundSet, Off, Master, Mute
SoundSet, Off, Wave, Mute
SoundPlay, %wav%, Wait
if mastermute = On
   SoundSet, 1, Master, Mute
SoundSet, mastervol, Master, Volume
if wavemute = On
   SoundSet, 1, Wave, Mute
SoundSet, wavevol, Wave, Volume
Return

Escape::  ;esc will terminate a playing sound
SoundPlay, Nonexistent.wav
Return

GuiClose:
ExitApp

Browse:
FileSelectFolder, EffectsPath, C:\utilities\WAV
Gui, Submit
initVol = %Vol%
Gui, Destroy
GoSub, Gui
Return

Vol:
Gui, Submit, NoHide
initVol = %Vol%
junk := initVol+1   ;found using spy that radio button number is +1 my volume index
;msgbox, %junk%
GuiControl, , Button%junk% , 1
Return

RadVol:
Gui, Submit, NoHide
initVol = %RadVol%
GuiControl, ,Vol , %RadVol%
Return


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] and 11 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