Advertisement
BourbonCrow

Mic Mute Script with Settings AutoHotkey2.0

Feb 28th, 2025 (edited)
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Requires AutoHotkey v2.0
  2. #SingleInstance force
  3. A_IconTip := "Microphone Status: Mic not Found"
  4. TraySetIcon "%systemroot%\System32\comres.dll", 11
  5.  
  6.  
  7. ;#### Settings Start ####
  8.  
  9. Hotkey "F1", MicMuteToggle
  10. Hotkey "F2", PushToMute
  11. MicName := "Microphone (2- BEACN Studio)" ;### Example on how to find your mic name: https://imgur.com/a/mic-name-example-mute-script-BWqvtQJ
  12. MouseTooltip := 1 ;Set this 0 for OFF and 1 for ON
  13.  
  14. ;#### Settings End ####
  15.  
  16.  
  17. ;### Setting Starting icon depending on mic status Red X for Muted and Green Check for Live
  18. if (SoundGetMute( , MicName) = 0) { ;### What to do if mic is Live
  19. A_IconTip := "Microphone Status: Live"
  20. TraySetIcon "%systemroot%\System32\comres.dll", 9 ;# Icon for Live Mic
  21.     }
  22.     else if (SoundGetMute( , MicName) = 1) { ;### What to do if mic is Muted
  23. A_IconTip := "Microphone Status: Muted"
  24. TraySetIcon "%systemroot%\System32\comres.dll", 11 ;# Icon for Muted Mic
  25. }
  26.  
  27.  
  28. MicMuteToggle(ThisHotkey)
  29. {
  30. SoundSetMute -1, , MicName ;###Toggles the mic Mute
  31.     if (SoundGetMute( , MicName) = 0) { ;### What todo if mic is Live
  32.         A_IconTip := "Microphone Status: Live"
  33.         if (MouseTooltip = 1) { ;### Makes a tooltip at mouse location for 1 sec if MouseTooltip = 1
  34.             ToolTip "Microphone Mute Off"
  35.             SetTimer () => ToolTip(), -1000
  36.         }
  37.         TraySetIcon "%systemroot%\System32\comres.dll", 9 ;# Icon for Live Mic
  38.     }
  39.     else if (SoundGetMute( , MicName) = 1) { ;### What to do if mic is Muted
  40.         A_IconTip := "Microphone Status: Muted"
  41.         if (MouseTooltip = 1) { ;### Makes a tooltip at mouse location for 1 sec if MouseTooltip = 1
  42.             ToolTip "Microphone Mute On"
  43.             SetTimer () => ToolTip(), -1000
  44.         }
  45.         TraySetIcon "%systemroot%\System32\comres.dll", 11 ;# Icon for Muted Mic
  46. }
  47. KeyWait ThisHotkey  ;### Wait for the key to be released.
  48. }
  49.  
  50.  
  51.  
  52. PushToMute(ThisHotkey)
  53. {
  54.     if (SoundGetMute( , MicName) = 0) { ;### What to do if mic is Live
  55.         SoundSetMute 1, , MicName
  56.         TraySetIcon "%systemroot%\System32\comres.dll", 11 ;# Icon for Muted Mic
  57.         KeyWait ThisHotkey  ;### Wait for the key to be released.
  58.         SoundSetMute 0, , MicName
  59.         TraySetIcon "%systemroot%\System32\comres.dll", 9 ;# Icon for Live Mic
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement