【问题标题】:Export Keynote slides to images with AppleScript使用 AppleScript 将 Keynote 幻灯片导出到图像
【发布时间】:2019-02-20 18:12:58
【问题描述】:

我有 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

为什么?

【问题讨论】:

  • 可以用您用于文件和文件夹的实际路径替换虚拟占位符吗?无论如何,这都不是安全风险。文件路径的格式、其在驱动器上的位置或文件名中的字符可能会引发误报的错误。这在 QuickTime 中经常发生,如果它开始在其他 Apple 制造的软件中发生,我不会感到惊讶。

标签: applescript keynote


【解决方案1】:

我仔细查看了this exporting documents samples,在引用我想将幻灯片导出到的文件夹时遇到了问题。然后我用样本找到了that thing

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-09-12
    • 2023-01-31
    • 1970-01-01
    • 1970-01-01
    • 2016-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多