OBS Studio Python热键

问题描述

我目前正在尝试学习如何为OBS Studio编写python脚本。我正在尝试设置一个可以在OBS中选择/更改的热键,但是我找不到任何教程,也没有能够找到的脚本。 (带有该脚本的脚本可能已经存在,我只是无法找到任何脚本)

有人可以帮忙吗?

解决方法

对于 Python 可能会有帮助: OBS doesn't receive hotkey from python script

我无法帮助您使用 Python,但如果您使用的是 Mac,您可以使用 AppleScript 来控制它。

下面的脚本就是一个例子。

我在这里使用了一个外部 MIDI 控制器 (MPC),但也有带功能键的键盘。

on runme(message)

tell application "OBS"
    activate
end tell

#say item 2 of message

#PAD 1 = 37

if (item 2 of message = 37)
    tell application "System Events"
        keystroke "s" using control down
    end tell
end if

#PAD 2 = 36

if (item 2 of message = 36)
    tell application "System Events"
        keystroke "b" using control down
    end tell
end if

#PAD 3 = 42

if (item 2 of message = 42)
    tell application "System Events"
        keystroke "p" using control down
    end tell
end if

#4 = 54

if (item 2 of message = 54)
    tell application "System Events"
        keystroke "1" using control down
    end tell
end if

#5 = 40

if (item 2 of message = 40)
    tell application "System Events"
        keystroke "2" using control down
    end tell
end if

#6 = 38
#7 = 46
#8 = 44




end runme