applescript - 使用 AppleScript 将 Keynote 幻灯片导出到图像
问题描述
我有 Keynote 幻灯片,我想自动将它们导出为图像,以便使用 AppleScript 进一步上传到服务器。我试图管理它:
tell application "Keynote"
set doc to open "full-path-to-.key"
save doc -- this line didn't help
export doc to file "full-path-to-folder" as slide images
end tell
该脚本以
error "Keynote got an error: The document “...” could not be exported as “full-path-to-folder”. Your most recent changes might be lost." number 6
为什么?
解决方案
我仔细查看了此导出文档示例,并在引用我要将幻灯片导出到的文件夹时遇到了问题。然后我用一个样本找到了关于它的东西
set thePath to alias "Macintosh HD:Users:yourUserName:Desktop:"
所以这个工作正常:
tell application "Keynote"
set doc to open "/absolute/path/to/slides.key"
export doc to alias "Macintosh HD:Users:myUserName:further:path" as slide images with properties {image format:PNG}
end tell
推荐阅读
- java - Java 的 jar:如何从特定的文件列表创建 .jar 文件并使用 -C 选项?
- javascript - 努力更新对象数组中的列表
- python - 无法使用 pip 更新 chardet
- c# - 如何包含列表中包含的类型的派生属性
- python - 在 PyCharm 中运行结束时启动脚本
- flutter - Flutter Scaffold Appbar 不显示后退按钮
- c# - 包含自动生成日期的 ASP.NET 模型
- c# - helperclass 中的 Blazor httpcontext 为空
- google-apps-script - 如果单元格值 = x,则有效地将行复制并粘贴到另一个工作表
- class - 我创建这个类的方式有问题吗?