Pages Templates

The template class is a top-level element of the Pages application. It contains no other elements, and has two properties. The choice of template determines the overall look of a document.

The Pages Suite Template Class

template : A styled document layout.

elements

contained by application.

properties

id (text, r/o) : The unique identifier for this application element.

name (text, r/o) : The name of the template, 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 templates, all application templates, and all user-created templates. Example scripts detail how to create documents using a specified template.

The Template ID Property

The id property of a template is a text string that uniquely identifies the template to the Pages application.

The following script retrieves the id of every template:

IMPORTANT TIP: Learn how to save and run your favorite scripts using the system-wide Script Menu.

In Pages, there are two kinds of templates: those that come with the application, and those created and saved by the user.

The id for an application template begins with the term: “Application”

"Application/Blank/Traditional"

The id for a user-created template begins with the term: “User”

"User/C34CF6EC-2BC4-4DE0-9A3B-35BA88F15B2C"

The design of template ids allows for specialized searches, as shown later on this page.

The Template Name Property

The name property of a template is a text string that is the name of the template as it is displayed in the Pages application interface.

The following script retrieves the name of every template, including user-created templates:

Application|User Templates

A script can use the unique design of the id property to retrieve only templates of a specific type.

The following script retrieves the name of every application template:

The following script retrieves the name of every user template:

Check for Template

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 template is intalled:

TOP | CONTINUE