Images

When it comes to making convincing documents, the old adage of “A picture is worth a thousand words” is sacrosanct. Nothing gets the point across like a compelling image. Not to worry, the AppleScript support in Numbers provides ample controls for creating unforgettable documents.

Scripting Terminology for Images

Documents created by any of the iWork applications, Pages, Numbers, or Keynote, can incorporate a common set of elements, including images, shapes, lines, tables, charts, movies, and audio clips. 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  [inh. iWork item ] : An item which supports formatting.

elements

contained by slides, document.

properties

heightinteger ) : The height of the iWork item.

lockedboolean ) : Whether the object is locked.

parentiWork container r/o ) : The iWork container containing this iWork item.

positionpoint ) : The horizontal and vertical coordinates of the top left point of the iWork item.

widthinteger ) : 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 movie, 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 an image are detailed in its dictionary listing, found in the iWork Suite:  (⬇ see below ) 

The iWork Suite image Class

image  [inh. iWork item ] : An image container.

elements

contained by slides, document.

properties

descriptiontext ) : Text associated with the image, can be read aloud by VoiceOver.

filefile , r/o) : The image file. This property is a required parameter when used with the make command to create a new image item on a slide. Use the file name property to retrieve the name of the image, or to replace the currently displayed image.

file nametext or file ) : When used with the get command, the value of this property is the file name of the image file currently displayed in the image container. When this property is used with the set command, the value of the property is a file reference (in HFS alias format) to the image file to be used to replace the currently displayed image.

opacityinteger ) : The opacity of the image, in percent (0 to 100).

reflection showingboolean ) : Is the image displaying a reflection?

reflection valueinteger ) : The percentage of reflection of the image, from 0 (none) to 100 (full).

rotationinteger ) : The rotation of the image item, in degrees from 0 to 359.

responds to

delete, exists, make

Here’s an example script that creates a new document with a new table overlaid on a decorative background image. It incorporates the use of many of the image properties, as well as those for text items.

beach-layout

TOP | CONTINUE