我想使用AppleScript更改PowerPoint(2011 Mac)幻灯片中选定文本的西方和亚洲字体设置。根据this,类似下面的内容应该可以工作。但是,我甚至不能得到文本范围的选择,更不用说名称的字体。无法使用AppleScript在PowerPoint(Mac 2011)幻灯片中获取文本范围
tell application "Microsoft PowerPoint"
tell active window
set name of font of text range of selection to "Palatino"
set east asian name of font of text range of selection to "YuMincho"
end tell
end tell
这是结果。
error "Can’t get text range of selection." number -1728 from «class TObj» of «class SelO»
实际上,下列问题出现相同的错误。
tell application "Microsoft PowerPoint"
tell active window
get text range of selection
end tell
end tell
另一方面,以下简单的VBA代码工作正常。
Sub HiraginoSansW2HelveticaNeueLight()
With ActiveWindow.Selection.TextRange.Font
.Name = "Palatino"
.NameFarEast = "YuMincho"
End With
End Sub
从本质上讲,VBA我想要做什么,但它涉及到使宏观和.PPTM格式,而不是标准的.pptx节能等,这是不是AppleScript的,我可以从菜单栏中访问一样方便。
任何人都可以帮助我获得AppleScrit的工作吗?
现在我再次尝试它,它的工作!将'选择文本范围的字体的字体名称设置为'Arial'并且'将它的选择的文本范围的字体的东亚名称设置为'游明朝体'“都按预期工作。再次感谢! –