1

I have Keynote slides and I want automatically export them to images for further uploading to server using AppleScript. I've tried to manage it:

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

This script terminates with

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

Why?

J. S.
  • 425
  • 4
  • 13
  • Could replace the dummy placeholders with the actual paths you use for your file and folder ? It's not a security risk in any way. The format of your file paths, its location on your drive, or a character in the filename could provoke an error that is being misreported. This happens in _QuickTime_ very regularly, and wouldn't surprise me if it started to happen in other Apple-made software. – CJK Sep 16 '18 at 19:38
  • 1
    Have a look at: [AppleScript and Keynote: Exporting Documents](https://iworkautomation.com/keynote/document-export.html) - I tested the Export Slides to Images script with Keynote, version 8.1 (5683), on macOS High Sierra and it worked rather nicely. – user3439894 Sep 16 '18 at 20:50

1 Answers1

1

I had a closer look at 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 about it with a sample

set thePath to alias "Macintosh HD:Users:yourUserName:Desktop:"

So this one works properly:

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
J. S.
  • 425
  • 4
  • 13