在AutoHotkey代码中添加以下代码来使其在离焦状态下与OBS协同工作:
SetTitleMatchMode, 2 Loop { IfWinExist, ahk_exe obs64.exe ;replace obs64.exe with the exact name of your OBS executable file { WinActivate ;activate the OBS window Send, {shift down} ;hold down the Shift key Send, {space} ;press the Space key Send, {shift up} ;release the Shift key } Sleep, 1000 ;wait 1 second before checking again }
这段代码会不断地检查OBS窗口是否存在,如果存在则会将其激活(activate),之后按下Shift和Space键来切换录制/停止录制。这样,即使OBS窗口不是当前窗口,也可以通过AutoHotkey来控制它。请注意,在代码中需要将“obs64.exe”替换为您的OBS可执行文件的确切名称。