OBS Studio python hotkey

492 views Asked by At

I'm currently trying to learn how to write python scripts for OBS Studio. I'm trying to setup a hotkey you can select/change within OBS, but I haven't been able to find any tutorials nor already-existing scripts that have this. (Scripts with this may already exist, I just haven't been able to find any)

Can someone help?

1

There are 1 answers

1
Julian On

For Python maybe that will help: OBS doesn't receive hotkey from python script

I can't help you with python, but if you are using a Mac you can control it with AppleScript.

An example would be the following script.

I had an external midi controller flying around here (MPC) that I use for this, but there are also keyboards with function keys.

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