; ; Current volume of full-screen application ; Value between 0 (muted) and 1 (100%) ; currentAppVolume := 1 ; ; Toggle full-screen app volume ; $NumpadMult:: if (isActiveWindowFullScreen()) { if (currentAppVolume < 1) { setAppVolume(1) } else { setAppVolume(0.3) } } else { Send {NumpadMult down} } return ; ; Increase full-screen app volume ; $NumpadAdd:: if (isActiveWindowFullScreen()) { setAppVolume(currentAppVolume + 0.1) } else { Send {NumpadAdd down} } return ; ; Decrease full-screen app volume ; $NumpadSub:: if (isActiveWindowFullScreen()) { setAppVolume(currentAppVolume - 0.1) } else { Send {NumpadSub down} } return ; ; Set volume of focused application ; setAppVolume(volume) { global currentAppVolume if (volume > 1) { volume := 1 } else if (volume < 0) { volume := 0 } else { volume := Round(volume, 2) + 0 } Run, nircmd.exe setappvolume focused %volume% currentAppVolume := volume return } ; ; Checks if active window is in full-screen ; isActiveWindowFullScreen() { winID := WinExist("A") If (!winID) return false WinGet style, Style, ahk_id %winID% WinGetPos ,,,winW,winH, "A" ; 0x800000 is WS_BORDER. ; 0x20000000 is WS_MINIMIZE. ; no border and not minimized return ((style & 0x20800000) or winH < A_ScreenHeight or winW < A_ScreenWidth) ? false : true }
使用方法自己专研吧!新手就免了,新手自己好好学学教程!
?
可以再写一段,调节当前激活窗口的音量吗,不是总音量