This script is similar to PowerPoint macro for controlling OBS. They both send hotkeys from PowerPoint to OBS.
The difference here is the hotkey commands are stored in the section name.
For Example a section name is set to 'hotkey=%{F5}" (Alt + F5). When a slide in this section is displayed "Alt+F5" is sent to OBS. Having PowerPoint handle scene transitions can be useful for live presentations.
This is a Video Guide to configure PowerPoint to send hotkeys to OBS
To Use this script
This has been tested in Windows 10, OBS 26 and PowerPoint 365.
The key code table can be found here.
https://docs.microsoft.com/en-us/office/vba/api/excel.application.sendkeys
The difference here is the hotkey commands are stored in the section name.
For Example a section name is set to 'hotkey=%{F5}" (Alt + F5). When a slide in this section is displayed "Alt+F5" is sent to OBS. Having PowerPoint handle scene transitions can be useful for live presentations.
This is a Video Guide to configure PowerPoint to send hotkeys to OBS
To Use this script
- Set Hotkeys in OBS
- Set PowerPoint section names
- add the macro to PowerPoint
- Alt+F11 to open VBA editor
- Insert-->Module
- Save PowerPoint as macro-enabled .PPTM
Code:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub OBSHotKeys(Keys As String)
AppActivate "OBS ", True
SendKeys Keys, True
'pause for the hotkeys to arrive
Sleep 100
'AppActivate "PowerPoint Slide Show "
AppActivate "PowerPoint"
End Sub
Sub OnSlideShowPageChange()
Dim Slide_ID As Integer
Dim Section_ID As Integer
Dim Section_Name As String
'get current slide number
Slide_ID = ActivePresentation.SlideShowWindow.View.CurrentShowPosition
'get Section index
Section_ID = ActivePresentation.Slides(Slide_ID).sectionIndex
'get Section name
Section_Name = ActivePresentation.SectionProperties.Name(Section_ID)
'if section starts with "hotkey="
If Left(Section_Name, 7) = "hotkey=" Then
OBSHotKeys (Mid(Section_Name, 8))
End If
End Sub
This has been tested in Windows 10, OBS 26 and PowerPoint 365.
The key code table can be found here.
https://docs.microsoft.com/en-us/office/vba/api/excel.application.sendkeys