使用 AppleScript 将 Keynote 幻灯片导出为图像

Export Keynote slides to images with AppleScript

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

为什么?

我用样本 this exporting documents samples and ran into a problem with referencing a folder I want export my slides to. Then I've found 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