【发布时间】:2019-08-09 05:44:18
【问题描述】:
我想使用 AppleScript 将 MS Word 文档 (docx) 转换为 PDF。
我用脚本编辑器尝试了下面的代码。 (预先打开 MS Word 文档。)
tell application "Microsoft Word"
activate
set outpath to "Documents/test.pdf"
set activeDoc to active document
save as activeDoc file name outpath file format format PDF
end tell
并因错误而失败:
The active document doesn't understand "save as" message.
number -1708 from active document
版本
- macOS Mojave 10.14.4
- Microsoft Word for Mac 16.27 (19071500)
- 脚本编辑器 2.11 (203.1)、Apple 脚本 2.7
使用 PowerPoint
下面的代码有效。成功将test.pdf保存在~/Library/Containers/com.microsoft.Powerpoint/Data/Documents下。
set outpath to "Documents/test.pdf"
tell application "Microsoft PowerPoint"
activate
save active presentation in outpath as save as PDF
end tell
【问题讨论】:
标签: ms-word applescript