#SingleInstance force ; from http://www.autohotkey.com/docs/scripts/VolumeOSD.htm ;_________________________________________________ ;_______User Settings_____________________________ ; Make customisation only in this area or hotkey area only!! ; The percentage by which to raise or lower the volume each time: vol_Step = 3 ; How long to display the volume level bar graphs: vol_DisplayTime = 800 ; Master Volume Bar color (see the help file to use more ; precise shades): vol_CBM = Red ; Wave Volume Bar color vol_CBW = Blue ; Background color vol_CW = Silver ; Bar's screen position. Use -1 to center the bar in that dimension: vol_PosX = -1 vol_PosY = -1 vol_Width = 150 ; width of bar vol_Thick = 12 ; thickness of bar ; If your keyboard has multimedia buttons for Volume, you can ; try changing the below hotkeys to use them by specifying ; Volume_Up, ^Volume_Up, Volume_Down, and ^Volume_Down: HotKey, #Up, vol_MasterUp ; Win+UpArrow HotKey, XButton1 & WheelUp, vol_MasterUp ; left-shoulder-click + scrollwheel HotKey, Volume_Up, vol_MasterUp HotKey, #Down, vol_MasterDown HotKey, XButton1 & WheelDown, vol_MasterDown ; left-shoulder-click + scrollwheel HotKey, Volume_Down, vol_MasterUp Hotkey, XButton1 & MButton, vol_Master_Toggle Hotkey, XButton2 & MButton, vol_Master_Toggle HotKey, +#Up, vol_WaveUp ; Shift+Win+UpArrow HotKey, XButton2 & WheelUp, vol_WaveUp ; right-shoulder-click + scrollwheel HotKey, +#Down, vol_WaveDown HotKey, XButton2 & WheelDown, vol_WaveDown ; right-shoulder-click + scrollwheel ;___________________________________________ ;_____Auto Execute Section__________________ ; DON'T CHANGE ANYTHING HERE (unless you know what you're doing). vol_BarOptionsMaster = 1:B ZH%vol_Thick% ZX0 ZY0 W%vol_Width% CB%vol_CBM% CW%vol_CW% vol_BarOptionsWave = 2:B ZH%vol_Thick% ZX0 ZY0 W%vol_Width% CB%vol_CBW% CW%vol_CW% ; If the X position has been specified, add it to the options. ; Otherwise, omit it to center the bar horizontally: if vol_PosX >= 0 { vol_BarOptionsMaster = %vol_BarOptionsMaster% X%vol_PosX% vol_BarOptionsWave = %vol_BarOptionsWave% X%vol_PosX% } ; If the Y position has been specified, add it to the options. ; Otherwise, omit it to have it calculated later: if vol_PosY >= 0 { vol_BarOptionsMaster = %vol_BarOptionsMaster% Y%vol_PosY% vol_PosY_wave = %vol_PosY% vol_PosY_wave += %vol_Thick% vol_BarOptionsWave = %vol_BarOptionsWave% Y%vol_PosY_wave% } SetBatchLines, 10ms Return ;___________________________________________ XButton1:: Click X1 XButton2:: Click X2 vol_WaveUp: SoundSet, +%vol_Step%, Wave SoundSet, off, Master, mute SoundSet, off, Wave, mute Gosub, vol_ShowBars return vol_WaveDown: SoundSet, -%vol_Step%, Wave SoundSet, off, Master, mute SoundSet, off, Wave, mute Gosub, vol_ShowBars return vol_MasterUp: SoundSet, +%vol_Step% SoundSet, off, Master, mute SoundSet, off, Wave, mute Gosub, vol_ShowBars return vol_MasterDown: SoundSet, -%vol_Step% SoundSet, off, Master, mute SoundSet, off, Wave, mute Gosub, vol_ShowBars return vol_Master_Toggle: SoundSet, +1, , mute ; Toggle the master mute (set it to the opposite state) SoundGet, vol_Master_mute, Master, mute ; set wave-mute to whatever the master is (don't let them be set to be opposites) if (vol_Master_mute == "On") SoundSet, 1, wave, mute else SoundSet, 0, wave, mute Gosub, vol_ShowBars return vol_ShowBars: ; To prevent the "flashing" effect, only create the bar window if it ; doesn't already exist: IfWinNotExist, vol_Wave Progress, %vol_BarOptionsWave%, , , vol_Wave IfWinNotExist, vol_Master { ; Calculate position here in case screen resolution changes while ; the script is running: if vol_PosY < 0 { ; Create the Wave bar just above the Master bar: WinGetPos, , vol_Wave_Posy, , , vol_Wave vol_Wave_Posy -= %vol_Thick% Progress, %vol_BarOptionsMaster% Y%vol_Wave_Posy%, , , vol_Master } else Progress, %vol_BarOptionsMaster%, , , vol_Master } ; Get both volumes in case the user or an external program changed them: SoundGet, vol_Master, Master SoundGet, vol_Master_mute, Master, mute SoundGet, vol_Wave, Wave SoundGet, vol_Wave_mute, Wave, mute Progress, 1:%vol_Master% Progress, 2:%vol_Wave% if (vol_Master_mute == "On") Progress, 1:0 if (vol_Wave_mute == "On") Progress, 2:0 SetTimer, vol_BarOff, %vol_DisplayTime% SetTimer, vol_MuteBlink, 50 return vol_MuteBlink: MuteToggle := !MuteToggle if (MuteToggle) { if (vol_Master_mute == "On") Progress, 1:0 if (vol_Wave_mute == "On") Progress, 2:0 } else { Progress, 1:%vol_Master% Progress, 2:%vol_Wave% } return vol_BarOff: SetTimer, vol_BarOff, off SetTimer, vol_MuteBlink, off Progress, 1:Off Progress, 2:Off return