The theme class is a top-level element of the Keynote application. It contains no other elements, and has two properties. The choice of theme determines the overall look of a presentation, as well as the document dimensions, and selection of master pages.
The Keynote Suite Theme Class
theme n : A collection of master slides, with shared design intents and elements.
elements
contained by application.
properties
id (text, r/o) : The unique identifier for this application element.
name (text, r/o) : The name of the theme, as it is displayed in the application’s user interface.
The pages of this topic section detail how to access the properties of all installed themes, all application themes, and all user-created themes. Example scripts detail how to create documents using a specified theme.
The id property of a theme is a text string that uniquely identifies the theme to the Keynote application.
The following script retrieves the id of every theme:
IMPORTANT TIP: Learn how to save and run your favorite scripts using the system-wide Script Menu.
In Keynote, there are two kinds of themes: those that come with the application, and those created and saved by the user.
The id for an application theme begins with the term: “Application”
"Application/ModernPortfolio/Standard"
The id for a user-created theme begins with the term: “User”
"User/C34CF6EC-2BC4-4DE0-9A3B-35BA88F15B2C"
The design of theme ids allows for specialized searches, as shown later on this page.
The name property of a theme is a text string that is the name of the theme as it is displayed in the Keynote application interface.
The following script retrieves the name of every theme:
A script can use the unique design of the id property to retrieve only themes of a specific type.
The following script retrieves the name of every application theme:
The following script retrieves the name of every user theme:
Get the Name of All User Themes | ||
01 | tell application "Keynote" | |
02 | set userThemeNames to the name of every theme whose id of it begins with "User/" | |
03 | --> RETURNS: {"Sal Theme"} | |
04 | end tell |
A principle of good “defensive” script writing is to never assume anything, always check for resources. Here’s a script that checks to make sure a specific theme is intalled: