问题
I am trying to do automatic scene changer in OBS by having a python script search for a specific image on screen. When the image is detected, the python script will send the hotkey, which should be picked by OBS (Same hotkey added in program).
However, I tried this in various applications like chrome/notepad/some games/etc and the hotkeys DO get "transmitted", but OBS doesn't pick them up. I don't know why, any help ?
回答1:
From this thread: Key Presses in Python
It seems like you need to install pywin32 module. With that you can send key presses to other applications:
import win32com.client as comclt
wsh= comclt.Dispatch("WScript.Shell")
wsh.AppActivate("Notepad") # select another application
wsh.SendKeys("a") # send the keys you want
来源:https://stackoverflow.com/questions/54328793/obs-doesnt-receive-hotkey-from-python-script