我要控制特定程序的音量,而不是整个主音量。
我发现此线程具有用于仅从Volume Mixer控制Windows Media Player音量的代码。
这是整个脚本:
SetTitleMatchMode, 3
SndVolWasStarted = 0
;Turn off SndVol after 1 second
Loop {
Sleep, 10
If SndVolWasStarted = 1
{
GetKeyState, StateF1, F1
GetKeyState, StateF2, F2
If (StateF1 = "D" or StateF2 = "D")
SndVolStartTime = %A_Now%
Else {
If ((A_Now - SndVolStartTime > 1) and WinExist("ahk_class #32770"))
WinClose, ahk_class #32770
}
IfWinNotExist, ahk_class #32770
SndVolWasStarted = 0
}
}
;Hotkey to decrease volume
F1::
IfWinExist, Windows Media Player
{
IfWinNotExist, ahk_class …Run Code Online (Sandbox Code Playgroud) autohotkey ×1