Documents created by any of the iWork applications, Pages, Numbers, or Numbers, can incorporate a common set of elements, including images, shapes, lines, tables, charts, movies, audio clips, and text items. To AppleScript and the built-in scripting support of the iWork applications, these elements are considered iWork Items, and share a common set of properties, detailed in the iWork Item class from the iWork Suite:
The iWork Suite iWork item Class
iWork item n [inh. iWork item ] : An item which supports formatting.
elements
contained by slides, document.
properties
height ( integer ) : The height of the iWork item.
locked ( boolean ) : Whether the object is locked.
parent ( iWork container r/o ) : The iWork container containing this iWork item.
position ( point ) : The horizontal and vertical coordinates of the top left point of the iWork item.
width ( integer ) : The width of the iWork item.
responds to
delete, exists
The properties in the iWork item class can be accessed and changed for any of the common iWork elements. For example, a script can get or set the position of a text item, or image, or shape, or any of the common elements.
In addition to sharing a common set of properties with the other iWork elements, each iWork element has its own set of properties, particular to that element. For example, the element-specific properties of a text item are detailed in its dictionary listing, found in the iWork Suite: (⬇ see below )
The iWork Suite text item Class
text item n [inh. iWork item ] : An text container.
elements
contained by slides, document.
properties
background fill type ( no fill/color fill/gradient fill/advanced gradient fill/image fill/advanced image fill, r/o ) : The background, if any, for the text item. NOTE: The value of this property is currently read-only and cannot be changed by a script.
object text ( rich text ) : The text contained within the text item.
opacity ( integer ) : The opacity of the text item container, in percent (0 to 100).
reflection showing ( boolean ) : Is the text item displaying a reflection?
reflection value ( integer ) : The percentage of reflection of the text item, from 0 (none) to 100 (full).
rotation ( integer ) : The rotation of the text item item, in degrees from 0 to 359.
responds to
delete, exists, make
The object text property is used to control the contents of a text item, and will be covered in detail in this section.
NOTE: A text alignment property is not yet implemented in the current scripting dictionary.
In the iWork applications, there are two container types for text items:
An example script that creates a title and subtitle text items centered on the document page: