使用AppleScript

时间:2018-09-16 18:34:59

标签: 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

为什么?

1 个答案:

答案 0 :(得分:0)

我仔细查看了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