# Talk to OBS through Python



## BeauWest (Feb 17, 2013)

Hey fellows! I'm working on a script to automate some of my tasks with streaming through OBS. I was wondering, is there any way to talk to OBS through Python, win32com etc.

Any help would be great! I can't find any documentation for the OBS API really, is there a place I can go to look at that other than the source code?


----------



## Warchamp7 (Feb 17, 2013)

The documentation for the API hasn't been written yet, for now you'll just have to use the source code as a reference


----------



## BeauWest (Feb 17, 2013)

How exactly does the API work, do you think I could access it through Python/win32com?


----------



## Jim (Feb 18, 2013)

It currently requires compiling a C++ DLL to access the API.  I hope to change that in the future though, or maybe someone else will before I get time to do it


----------



## BeauWest (Feb 18, 2013)

Awesome, that's what I needed to know, thank you sir!

All I'm trying to do is switch scenes, but having trouble finding an effective way to trigger keyboard shortcuts to change them.


----------



## R1CH (Feb 18, 2013)

Have you tried the built in hotkey support?


----------



## BeauWest (Feb 18, 2013)

R1CH, absolutely, that's the method I'm using now. I'm trying though to trigger the hotkeys (or switch the scene) through Python. Basically my script is set up to use Python's win32com to check the currently active window. If it matches one of my games set up in the config file (sc2.exe, bf3.exe, etc), it triggers the hotkeys that the config file says.

I think I have it working, I was hoping for a smoother, more reliable way to do it than just triggering the hotkeys though!


----------



## BeauWest (Feb 18, 2013)

And actually, it looks like what I'm using (SendKeysCtypes) doesn't work with certain applications. Not sure if the app is picking up the keystrokes or what.


----------



## BeauWest (Feb 18, 2013)

I'm starting to think that keystrokes may not be a good way to go regardless. For example, say I want to assign CTRL+NUMPAD8 to happen whenever I switch out of the game. However, I'm Alt-tabbing and looking for the correct window. So OBS sees it as CTRL+NUMPAD8+ALT+TAB and doesn't know what to do with it.

Back to the drawing board. ^_^


----------



## BeauWest (Feb 18, 2013)

I'm so dumb. There's a plugin to do exactly what I wanted. Haha. (viewtopic.php?f=11&t=1785)


----------



## Voxletum (Apr 28, 2013)

Someone should sit down and write out a full reply to this thing. I would laugh.


----------

