전체 프로그램이 아닌 특정 프로그램의 볼륨을 제어하고 싶습니다.Autohotkey - 특정 프로그램의 볼륨 만 조정하는 방법?
볼륨 믹서의 Windows Media Player 볼륨 만 제어하는 코드가있는 THIS 스레드가 있습니다.
이 전체 스크립트입니다
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 #32770
{
Run, "%A_WinDir%\System32\SndVol.exe" -r 88888888
WinWait, ahk_class #32770
SndVolWasStarted = 1
}
ToolbarWindowNumber = 322
msctls_trackbarNumber = 321
Loop {
ControlGetText, ControlName, ToolbarWindow%ToolbarWindowNumber%, ahk_class #32770
If ControlName = Mute for Windows Media Player
{
ControlSend, msctls_trackbar%msctls_trackbarNumber%, {Down}, ahk_class #32770 ; Use {Down 2} to change sound level faster
Break
} Else {
If ToolbarWindowNumber < 328
{
ToolbarWindowNumber := ToolbarWindowNumber + 2
msctls_trackbarNumber := msctls_trackbarNumber + 1
} Else {
If ToolbarWindowNumber = 328
{
ToolbarWindowNumber =
msctls_trackbarNumber := msctls_trackbarNumber + 1
} Else {
If ToolbarWindowNumber < 3242
{
ToolbarWindowNumber := ToolbarWindowNumber + 2
msctls_trackbarNumber := msctls_trackbarNumber + 1
} Else {
MsgBox, 16, AutoHotkey, ERROR: Application's volume control was not found!`nThis could occur if the Volume Mixer has more than 20 opened applications
Break
}
}
}
}
}
}
Return
;Hotkey to increase volume
F2::
IfWinExist, Windows Media Player
{
IfWinNotExist, ahk_class #32770
{
Run, "%A_WinDir%\System32\SndVol.exe" -r 88888888
WinWait, ahk_class #32770
SndVolWasStarted = 1
}
ToolbarWindowNumber = 322
msctls_trackbarNumber = 321
Loop {
ControlGetText, ControlName, ToolbarWindow%ToolbarWindowNumber%, ahk_class #32770
If ControlName = Mute for Windows Media Player
{
ControlSend, msctls_trackbar%msctls_trackbarNumber%, {Up}, ahk_class #32770 ; Use {Up 2} to change sound level faster
Break
} Else {
If ToolbarWindowNumber < 328
{
ToolbarWindowNumber := ToolbarWindowNumber + 2
msctls_trackbarNumber := msctls_trackbarNumber + 1
} Else {
If ToolbarWindowNumber = 328
{
ToolbarWindowNumber =
msctls_trackbarNumber := msctls_trackbarNumber + 1
} Else {
If ToolbarWindowNumber < 3242
{
ToolbarWindowNumber := ToolbarWindowNumber + 2
msctls_trackbarNumber := msctls_trackbarNumber + 1
} Else {
MsgBox, 16, AutoHotkey, ERROR: Application's volume control was not found!`nThis could occur if the Volume Mixer has more than 20 opened applications
Break
}
}
}
}
}
}
Return
나는 그것을 시도하고 윈도우 미디어 플레이어와 함께 작동하지만 난 그게 구글 크롬에서 작동 할 수 없습니다.
코드 일부를 IfWinExist, Windows Media Player
으로 변경하고 IfWinExist, Google Chrome
으로 변경했지만 Chrome의 볼륨을 조정하지 않았습니다. 내가 교체 모든 IfWinExist, Windows Media Player
IfWinExist ahk_class Chrome_WidgetWin_1
답변이 도움이 되었습니까? 그렇다면 답변을 수락하십시오. – vasili111