Requires COM and VA libraries to work properly. Simply download appropriate .ahk files and put them into your ...\AutoHotkey\Lib\ folder.
Simple Volume Control increases or decreases master volume using following hotkeys:
- Media Volume Up / Media Volume Down
- Win+UpArrow / Win+DownArrow
- MouseButton5+MouseScrollUp / MouseButton5+MouseScrollDown
When you set master volume to 0 it actually mutes all sounds, because Windows 7, for some strange reason, keeps playing music even if you set master volume to 0.
That's it. This script doesn't do anything else :wink:.
Feel free to customize it in any way you want. Tested on Windows 7 x64 build 7100.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #SingleInstance force SetBatchLines -1 COM_Init() vol_Master := VA_GetMasterVolume() ; ------------------- ; START CONFIGURATION ; ------------------- ; The percentage by which to raise or lower the volume each time vol_Step = 3 ; How long to display the volume level bar graphs (in milliseconds) vol_DisplayTime = 1000 ; Transparency of window (0-255) vol_TransValue = 255 ; Bar's background colour vol_CW = EEEEEE vol_Width = 200 ; width of bar vol_Thick = 20 ; thickness of bar ; Bar's screen position vol_PosX := A_ScreenWidth - vol_Width - 50 vol_PosY := A_ScreenHeight - vol_Thick - 100 ; -------------------- ; END OF CONFIGURATION ; -------------------- vol_BarOptionsMaster = 1:B1 ZH%vol_Thick% ZX8 ZY4 W%vol_Width% X%vol_PosX% Y%vol_PosY% CW%vol_CW% return $Volume_down:: #Down:: ~XButton2 & WheelDown:: { if vol_Master > .01 { VA_SetMasterVolume(vol_Master-=vol_Step) if vol_Master <= 0 { VA_SetMute(True) } } Gosub, vol_ShowBars } return $Volume_up:: #Up:: ~XButton2 & WheelUp:: { if vol_Master <= 99 { VA_SetMasterVolume(vol_Master+=vol_Step) if vol_Master > 1 { VA_SetMute(False) } } Gosub, vol_ShowBars } return vol_ShowBars: ; Get volumes in case the user or an external program changed them: vol_Master := VA_GetMasterVolume() vol_Mute := VA_GetMasterMute() if vol_Mute <> 1 { vol_Colour = Green vol_Text = Volume } else { vol_Colour = Red vol_Text = Volume (muted) } ; To prevent the "flashing" effect, only create the bar window if it doesn't already exist: IfWinNotExist, VolumeOSDxyz { Progress, %vol_BarOptionsMaster% CB%vol_Colour% CT%vol_Colour%, , %vol_Text%, VolumeOSDxyz WinSet, Transparent, %vol_TransValue%, VolumeOSDxyz } Progress, 1:%vol_Master%, , %vol_Text% SetTimer, vol_BarOff, %vol_DisplayTime% return vol_BarOff: SetTimer, vol_BarOff, off Progress, 1:Off return