F11::
if (muting) {
SoundSet, %oldVolume%
muting := false
}
else {
SoundGet, oldVolume
SoundSet, 2
muting := true
}
return
Basically, you create a variable muting
so your script can recall which state it's in. When you hit F11, it checks if muting
is true or not. If it is, then it will set the system volume to oldVolume
, and then set muting
to false. If muting
is false, then it will save the current volume as oldVolume
, set the system volume to 2, and then set muting
to true.