Skip to content

Instantly share code, notes, and snippets.

@pa-0
Forked from natekford/ToggleMuteMicrophone.ahk
Created October 12, 2025 01:12
Show Gist options
  • Save pa-0/98ce5e67cf00738b4dadfc14024f0887 to your computer and use it in GitHub Desktop.
Save pa-0/98ce5e67cf00738b4dadfc14024f0887 to your computer and use it in GitHub Desktop.
Toggle mute via Windows for a microphone using AHK v2.
#Requires AutoHotkey v2+
#SingleInstance Force
global MIC := "FIFINE T669"
Notify(false)
SetTimer(CheckExes, 1000)
*F24::
{
SoundSetMute(-1, , MIC)
Notify(true)
}
Notify(makeNoise)
{
isMuted := SoundGetMute(, MIC)
; 12 = not filled in W10 microphone, 13 = filled in W10 microphone
TraySetIcon("sndvolsso.dll", isMuted ? 12 : 13)
if (makeNoise)
{
SoundPlay(isMuted ? "C:\Windows\Media\Speech Off.wav" : "C:\Windows\Media\Speech On.wav")
ToolTip(isMuted ? "MUTED" : "UNMUTED")
SetTimer(() => ToolTip(), -1000)
}
}
CheckExes()
{
; some games interfere with hotkeys until the script is restarted
static ahk_start := A_TickCount
static exes := Map("RDR2", false)
for exe, isRunning in exes
{
; exe currently running
; if it's been running before the script, that's fine
; only restart if the exe is started after the script
if (WinExist("ahk_exe " . exe . ".exe"))
{
if (!isRunning && A_TickCount > ahk_start + 5000)
{
Reload()
}
else
{
exes[exe] := true
}
}
; exe not running anymore, set back to false
else
{
exes[exe] := false
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment