Audio_SetVol(pSetVol="") { If (pSetVol="") { curMute := (A_OSVersion = "WIN_VISTA") ? VA_GetMasterMute() : SoundGet("", "Mute") If (curMute = "On" or curMute = "Off") curMute := (curMute = "On") ? 1 : 0 pSetVol := curMute ? "u" : "m" } If (SubStr(pSetVol, 1, 1) = "m") { If (A_OSVersion = "WIN_VISTA") VA_SetMasterMute(1) Else SoundSet,% 1,, Mute return "Muted" } Else If (SubStr(pSetVol, 1, 1) = "u") { If (A_OSVersion = "WIN_VISTA") VA_SetMasterMute(0) Else SoundSet,% 0,, Mute return "Unmuted" } Else { curVol := Transform("Round", (A_OSVersion = "WIN_VISTA") ? VA_GetMasterVolume() : SoundGet()) If (SubStr(pSetVol, 1, 1) = "+") { newVol := ((curVol + SubStr(pSetVol, 2)) > 100) ? 100 : curVol + SubStr(pSetVol, 2) } Else If (SubStr(pSetVol, 1, 1) = "-") { newVol := ((curVol - SubStr(pSetVol, 2)) < 0) ? 0 : curVol - SubStr(pSetVol, 2) } Else If (pSetVol <= 100 and pSetVol >= 0){ newVol := pSetVol } Else Return "Error" If (A_OSVersion = "WIN_VISTA") VA_SetMasterVolume(newVol) Else SoundSet %newVol% Return newVol } }