如何在macOS Big Sur上为OBS执行此PowerPoint宏?

问题描述

此PowerPoint宏(在Windows中)将通过将演示文稿笔记中的前四个字符解析为OBS的击键来允许在OBS中更改场景。例如。 OBS1将在OBS中击键Control + 1,从而根据热键设置更改场景。

此宏在Mac上的Office 365上不起作用,因为该宏似乎无权访问任何应用程序。我猜想该操作必须重写宏以包含AppleScript,否则我错了吗?

我该怎么办?

原始宏:

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)
AppActivate ("OBS")
SendKeys (sKey),1
AppActivate ("PowerPoint")
End If
End Sub

参考: 最初的想法:https://obsproject.com/forum/resources/powerpoint-macro-for-controlling-obs.1061/ 带有VB的AppleScript:https://docs.microsoft.com/en-us/office/vba/office-mac/applescripttask

解决方法

我写了 python 来实现 Scott Hanselman 是 doing。您可以找到我的 obsPPTXwithPython 存储库 here

这不是我避免使用的 VBA。您需要了解一些 Python 才能使用它,如果没有帮助,请见谅。