首页 > 解决方案 > 如何在 macOS Big Sur 上为 OBS 执行此 PowerPoint 宏?

问题描述

此 PowerPoint 宏(在 Windows 中)将允许在 OBS 中更改场景,方法是获取演示文稿注释中的前四个字符并将它们解析为 OBS 的击键。例如,OBS1 将在 OBS 中按键 Control+1,从而根据热键设置更改场景。

此宏不适用于 Office 365 for Mac,因为该宏似乎无权访问任何应用程序。我想必须重新编写宏以包含此操作的 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/ AppleScript 与 VB:https ://docs.microsoft.com/en-us/office/vba /office-mac/applescripttask

标签: vbaapplescriptpowerpointobs

解决方案


我已经编写了 python 来实现 Scott Hanselman 正在的事情。你可以在这里找到我的 obsPPTXwithPython 存储库。

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


推荐阅读