Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Access the Text Suite

The Text suite defines terminology that allows scripts to request or select textual elements at different levels of granularity: character, word, paragraph, or entire body of text. The NSTextStorage class, provided by the Application Kit, defines a corresponding set of methods for getting and setting scriptable properties of NSTextStorage objects.

To gain access to this text scripting support, use an NSTextStorage object as the content for one of your scriptable classes. The TextEdit sample code (available at <Xcode>/Examples/AppKit/TextEdit) demonstrates a scriptable application that supports text scripting, as well as scripting support for printing.

Note: The TextEdit sample does not use the sdef file format—it supplies its scriptability information using the older style script suite and script terminology files.

Table 3-2 lists Cocoa classes for working with text, along with attributes and relationships used by those classes.

Table 3-2  Text Suite Attributes and Relationships

Class

Attributes (script term, if different)

Relationships

NSTextStorage

font name (name), font size (size), foreground color (color)

attribute runs, characters, paragraphs, text, words



< Previous PageNext Page > Hide TOC


Last updated: 2008-03-11




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice