1

Trying to toggle Mute/Unmute for my microphone on the latest windows 10 build but its not working

what I'm trying to do below in the code is toggle the mic and each time I do toggle the mic a notification should popup with the current state of the mic but its not working

F8::
    Run nircmd.exe mutesysvolume 2 microphone
    SoundGet, microphone_mute, Microphone, mute
    if (microphone_mute = "Off"){
        TrayTip MicState, ON
    } else(
        TrayTip MicState, OFF
    )
    Return

1 Answers1

0

Just keep track of what you muted with a variable:

is_muted := 0

SC03A:: ;CAPS LOCK button is my chosen hotkey

if (is_muted = 0) { Run nircmd.exe mutesysvolume 1 default_record is_muted := 1 } else { Run nircmd.exe mutesysvolume 2 default_record if (is_muted = 1) { is_muted := 2 } else { is_muted := 1 } ToolTip, % (is_muted == 1 ? "Mic muted" : "Mic on") SetTimer, RemoveMuteMicTooltip, 700

}

Return

RemoveMuteMicTooltip: SetTimer, RemoveMuteMicTooltip, Off ToolTip return