Sunday, September 20, 2020
Allow an OBS session to automatically control a second OBS
Make PowerPoint control other applications using VBA
Here's some code that will let you use PowerPoint to run .BAT files
The basis of this code comes from Michael Kordahi's original post on his Linkedin account and OBS scripts page. I found this very helpful and wanted to post how to do it, plus possible improvements. I'm using it to control scenes in PowerPoint, but I've modified the code to use websockets.
Original post:
https://obsproject.com/forum/resources/powerpoint-slide-window-navigation-using-obs-hotkey.938/
And Linkedin Post of an example:
I've modified Michael's code slightly from above, as I want it to call a .BAT. (his sent CTRL+ hotkey commands which also worked, but I needed to run power point from a different computer so i needed change it slightly)
In my case, I'm running PowerPoint, and as I advance slides, I want it to automatically send a command (via .BAT) to OBS Studio running on another computer, and I'm doing it in conjunction with WebSockets
https://obsproject.com/forum/resources/command-line-tool-for-obs-websocket-plugin-windows.615/
So here is what happens.
As the slides advance, based on the FIRST line of text on the "Notes Description" on the PowerPoint slide, that will trigger the execution of a .BAT file.
This bat file sends a command to the computer running OBS to switch to a specific scene.
Diagram, PowerPoint has "OBS3" for a description. Sends that to the OBS computer, which triggers a scene to automatically be displayed.
Now as I advance through PowerPoint, specific scenes will automatically occur. I use this in a house of worship situation where I want to reduce the load of the worship team.
Here's how to make it work.
First install the WebSockets app on your OBS computer. You'll also want to install it on PowerPoint computer (assuming they are different machines).
A suggest program to also install is NOOBS https://obsproject.com/forum/resources/nuttys-official-obs-commander-noobs-cmdr.1178/ which will greatly aid in the creation of the .BAT script for you.
4> Create or load a PowerPoint presentation.
5> Goto DEVELOPER -> MACROS
or
VIEW -> MACROS
6> in "macro name" call it OnSlideShowPageChange
Then click on "CREATE"
You'll see this:
Sub OnSlideShowPageChange()
End Sub
7> Make it look like this:
Sub OnSlideShowPageChange()
Dim i As Integer
Dim sNotes As String
Dim sKey As String
i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
s = Left(ActivePresentation.Slides(i).NotesPage.Shapes.Placeholders(2).TextFrame.TextRange.Text, 4)
If Left(s, 3) = "OBS" Then
sKey = Right(s, 1)
Shell ("CMD.EXE /c C:\OBSCommand\" & sKey & ".bat")
AppActivate ("PowerPoint")
End If
End Sub
8> Please note the C:\OBSCommand\ should reflect the path that you are storing your BAT files in for this.
9> Now in your presentation "NOTES" put OBS1 or OBS2 or OBS3 on the first line. This will correspond to the scenes.
In the example below, I have "OBS3" which, in the case of the example, the white screen on the left, when power point displays it, will call to run a bat file for "OBS3"
In this example, the script will check the first line for it to begin with OBS, then it will take the trailing number, which will be a "3"
10> now Launch NOOB
I've put in my server IP of my OBS box, I've put in the port and password. Now click on the left most button "Not Connected" to imitate a connection
If successful, you should be able to now click on "SCENE" and then in the box next to "Switch To" you should be able to see all available scenes.
Once you have selected a scene, you can run "TEST COMMAND" and, if everything is configured, your scene should change in OBS.
Now export that command, and save it with a value of 1-9, in my example I saved it as "3"
10> Now start your PP presentation (F5)
11> Make sure that OBS is running with your scenes, and change the slides in PowerPoint, you should see the images change in OBS