Exporting Keynote documents is done using the export command from the Keynote Suite.
exportv : Export a presentation to another file(s).
exportdocument : The presentation to export.
to (file ) : A reference to the file (folder) to be created. When exporting images or HTML, a new folder, containing the exported items, is created instead of a file.
as ( HTML / QuickTime movie / PDF / slide images / Microsoft PowerPoint / Keynote 09 ) : The format in which the document is to be exported.
[ with properties (export options ) ] : An AppleScript record containing property:value pairings for the initial values for properties of the exported object.
export optionsn : The export options for the Keynoteexport command.
properties
all stages ( boolean ) : Include each stage of the builds.
borders ( boolean ) : Add borders around the slides.
compression factor ( real ) : Compressed image quality, ranging from 0.0 (maximum compression, lowest quality) to 1.0 (lossless compression, highest quality). This option only pertains to JPEG format images.
date ( boolean ) : Include the current date.
export style ( IndividualSlides / SlideWithNotes / Outline / Handouts ) : Indicate whether to include notes, etc. (applies only to printing)
image format ( JPEG / PNG / TIFF ) : The format to use for the resulting images.
movie format ( small / medium / large ) : The desired size for exported movie: 360P, 540P, 720P
password ( text ) : The password to use when the exported PDF is encrypted.
password hint ( text ) : The password hint.
PDF image quality ( good/better/best ) : (Keynote 6.6) The quality of the images in the exported PDF file.
rawKPF ( boolean ) : Should the document be exported in raw KPF?
skipped slides ( boolean ) : Should the exported document include skipped slides?
slide numbers ( boolean ) : Should the exported document include slide numbers?
NOTE: The Keynote version 6.6 scripting dictionary includes options for indicating the quality of images used when the presentation is exported as a PDF file.
This script exports the frontmost Keynote presentation to a folder containing all the HTML materials for a self-contained website.
TIP: Using the following Export to HTML script, a presentation containing audio clips, like the one created by the Render Presenter Notes script on this website, can be exported to HTML content, and placed on a server to become an online presentation! See it for yourself!
Export to HTML Content
01
-- THE DESTINATION FOLDER
02
-- (see the "path" to command in the Standard Additions dictionary for other locations, such as pictures folder, movies folder, sites folder, desktop folder)
03
set thedefaultDestinationFolderto (path todocuments folder)
04
05
tellapplication "Keynote"
06
activate
07
try
08
ifplayingistruethen tell the frontdocumenttostop
09
10
if not (existsdocument 1) then errornumber -128
11
12
-- DERIVE NAME FOR NEW FOLDER FROM NAME OF THE FRONT DOCUMENT
13
setdocumentNameto thenameof the frontdocument
14
ifdocumentNameends with ".key" then ¬
15
setdocumentNametotext 1 thru -5 ofdocumentName
16
17
-- CREATE AN EXPORT DESTINATION FOLDER
18
-- IMPORTANT: IT’S ADVISED TO ALWAYS CREATE a NEW DESTINATION FOLDER, AS THE CONTENTS OF ANY TARGETED FOLDER WILL BE OVERWRITTEN
19
tellapplication "Finder"
20
setnewFolderNametodocumentName
21
setincrementIndexto 1
22
repeat until not (existsfoldernewFolderNameofdefaultDestinationFolder)
This version of the export script will export the front Keynote presentation to a Microsoft PowerPoint file. Presentations containing media, such as movies and/or audio files, must be exported to the newer file format (PPTX), while presentations without media can be exported to the Microsoft PowerPoint 1997-2003 compatible format (PPT).
Export to Microsoft PowerPoint
01
-- Export the presentation as a MSPowerPoint 1997-2003 compatible file?
02
propertyattemptCompatibleExport : true
03
04
-- THE DESTINATION FOLDER
05
-- (see the "path to" command in the Standard Additions dictionary for other locations, such as movies folder, pictures folder, desktop folder)
06
set thedefaultDestinationFolderto (path todocuments folder)
This script exports the frontmost Keynote presentation to a PDF file. Set the boolean value of the useEncryptionDefaultValue property to either true or false to determine whether you will be prompted for the password to use in encrypting the PDF file.
Export to PDF
01
propertyexportFileExtension : "pdf"
02
propertyuseEncryptionDefaultValue : true
03
04
-- THE DESTINATION FOLDER
05
-- (see the "path" to command in the Standard Additions dictionary for other locations, such as movies folder, pictures folder, desktop folder)
06
set thedefaultDestinationFolderto (path todocuments folder)
07
08
setusePDFEncryptiontouseEncryptionDefaultValue
09
tellapplication "Keynote"
10
activate
11
try
12
ifplayingistruethen tell the frontdocumenttostop
13
14
if not (existsdocument 1) then errornumber -128
15
16
ifusePDFEncryptionistruethen
17
-- PROMPT FOR PASSWORD (OPTIONAL)
18
repeat
19
display dialog "Enter a password for the PDF file:" default answer ¬
20
"" buttons {"Cancel", "No Password", "OK"} ¬
21
default button 3 withhidden answer
22
copy theresultto ¬
23
{button returned:buttonPressed, text returned:firstPassword}
24
ifbuttonPressedis "No Password" then
25
setusePDFEncryptiontofalse
26
exit repeat
27
else
28
display dialog "Enter the password again:" default answer ¬
29
"" buttons {"Cancel", "No Password", "OK"} ¬
30
default button 3 withhidden answer
31
copy theresultto ¬
32
{button returned:buttonPressed, text returned:secondPassword}
Mention of third-party websites and products is for informational purposes only and constitutes neither an endorsement nor a recommendation. MACOSXAUTOMATION.COM assumes no responsibility with regard to the selection, performance or use of information or products found at third-party websites. MACOSXAUTOMATION.COM provides this only as a convenience to our users. MACOSXAUTOMATION.COM has not tested the information found on these sites and makes no representations regarding its accuracy or reliability. There are risks inherent in the use of any information or products found on the Internet, and MACOSXAUTOMATION.COM assumes no responsibility in this regard. Please understand that a third-party site is independent from MACOSXAUTOMATION.COM and that MACOSXAUTOMATION.COM has no control over the content on that website. Please contact the vendor for additional information.