OBS doesn't receive hotkey from python script

那年仲夏 提交于 2021-01-29 11:33:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!