2

I've created a template with several placeholders for images.

I'd like to do the following:

  • Create a duplicate of the template
  • Replace images in the template (from a csv or text file)
  • Export the presentation as a movie
  • Repeat for the next duplicate

Is there a way to do this with Applescript? Automator doesn't seem to have any Keynote actions that can achieve this.

  • Sorry to ask this, but can you please mark the question as answered? I want to put a bounty on a question I have and need the points. Thanks. – MBUST May 15 '18 at 10:27
0

Yes, there is. The bulk of the script would be this:

--ImageTemp would from your csv file in a repeat loop, but here's an image from the desktop for demonstration:
set ImageTemp to ((path to desktop as text) & "Screen Shot 2018-04-29 at 2.55.28 PM.png") as alias

tell application "Keynote"
    activate
    --Replace an image
    set SlidesCol to slides of document 1
    set SlidesColcount to (count of SlidesCol)
    (*Assuming here that you are going to replace an image in every slide of the presentation with the same image, ImageTemp, which is unlikely, but to not complicate matters:*)
    repeat with i from 1 to count of SlidesCol
        set slideItem to item i of SlidesCol
        set ImagesItem to image 1 of slideItem
        set file name of ImagesItem to ImageTemp
    end repeat


    --Finally, export File as a movie
    set ReceiveV to (path to desktop as text) & "ReceiverContainer.m4v" as string
    export document 1 as QuickTime movie to file ReceiveV
end tell

Of course you will need to edit to fit your presentation (here, for example, the script replaces the first image of each slide) and it assumes that the presentation is open, but you will need to open and close as you duplicate and repeat. But the rest of the script is much simpler: duplicate the file with the finder and put what you need in a repeat loop.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .