Posted on 20 August 2008 at 7:57
Scripting Pages
So far, we’ve dumped the output from our scripts into Microsoft Word. In this post, we’ll briefly look at Apple’s Pages application, which comes bundled with its iWork ‘08 suite. Apple really improved their AppleScript support in this latest iteration of Pages.
When you want to manipulate a Pages document, you should get the document class of your document:
set doc to document 1
You can now tell doc to change the properties and elements of your document. One of the main properties of the document class is body text. Body text is the main flow of your text document. If you extract data from your database and copy that data to the clipboard, you use AppleScript to paste that data to the body text of your Pages document.
set body text of doc to the clipboard
A Pages document is also comprised of pages, sections, and paragraphs, which you can access through AppleScript.
Because Pages also acts as a page layout application, you can create and access text boxes, shapes, graphics, and images.
We’ll look at Pages more as we go forward, but you should know that Pages has an excellent AppleScript dictionary and can be used in your workflows.