Exporting Keynote 3 as PDF

| | Comments (0)

NOTE: This version runs on Keynote 3, bundled with iWork '08. If you have Keynote 2, you want my older version.

on run
  display dialog "Drag keynote documents on me to convert to PDF."
end run

on open draggeditems
  repeat with thisFile in draggeditems as list
    tell application "Finder" to reveal item thisFile
    set thisFile to thisFile as alias

    tell application "Keynote" to open thisFile

    tell application "System Events"
      tell application process "Keynote"
        set frontmost to true

        if menu item "Hide Inspector" of menu 1 of menu bar item "View" of menu bar 1 exists then
          keystroke "i" using {command down, option down}
        end if

        click menu item "Export…" of menu 1 of menu bar item "File" of menu bar 1

        repeat until sheet 1 of window 1 exists
        end repeat

        tell sheet 1 of window 1
          click button "PDF" of radio group 2
          click checkbox "Include slide numbers"
          click checkbox "Include date"
          click checkbox "Print each stage of builds"
          click button "Next…"
        end tell

        repeat until button "Export" of sheet 1 of window 1 exists
        end repeat

        tell sheet 1 of window 1
          click button "Export"
        end tell

        delay 3
        keystroke "w" using command down
      end tell
    end tell

  end repeat
end open

Leave a comment