I set up an #AutoHotKey macro to pause/resume #Audacity when recording audio. The pause/break key works wonderfully as a cough button.
```
#Requires AutoHotkey v2.0
#r:: { ; Windows+R: Record
if WinExist("ahk_exe audacity.exe") {
hwnd := WinExist("ahk_exe audacity.exe") ; Get the Audacity window handle
if hwnd {
PostMessage(0x100, 0x52, 0, , hwnd) ; WM_KEYDOWN message for Space key
PostMessage(0x101, 0x52, 0, , hwnd) ; WM_KEYUP message for Space key
}
}
}
#s:: { ; Windows+S: Stop/Play
if WinExist("ahk_exe audacity.exe") {
hwnd := WinExist("ahk_exe audacity.exe") ; Get the Audacity window handle
if hwnd {
PostMessage(0x100, 0x20, 0, , hwnd) ; WM_KEYDOWN message for Space key
PostMessage(0x101, 0x20, 0, , hwnd) ; WM_KEYUP message for Space key
}
}
}
#p::PauseResume() ; Windows+P
Pause::PauseResume() ; Pause/Break key
PauseResume() {
if WinExist("ahk_exe audacity.exe") {
hwnd := WinExist("ahk_exe audacity.exe") ; Get the Audacity window handle
if hwnd {
PostMessage(0x100, 0x50, 0, , hwnd) ; WM_KEYDOWN message for Space key
PostMessage(0x101, 0x50, 0, , hwnd) ; WM_KEYUP message for Space key
}
}
}
```