Name

TextEdit

Synopsis

The rest of this chapter describes each text-related TextEdit class and gives examples of how to use them in your scripts. As always, to keep up-to-date about any scriptable program on your computer, use Script Editor’s Open Dictionary... menu item to view the software’s dictionary of commands and classes. Chapter 2 , describes application dictionaries.

Dictionary classes

attribute run

A subdivision of a block of text, an attribute run is a group of characters that all have the same attributes, such as font or size. An attribute run is just a different way of abstracting or grouping parts of a text block. For example, if the first paragraph of a document’s text has some characters that are 12 points in size and others that are 18 points, then getting the attribute runs of that paragraph would return two separate chunks of text in a list (one group would be 12 points in size and the other would be 18 points). However, getting paragraph 1 of that text would return one chunk of characters of different sizes. In other words, the paragraph would contain the two attribute runs. The following example gets every attribute run of a document’s text (a list containing three attribute runs). The first line of the text contains the characters “hi here is some more text k,” but the last “k” character is in a different font and size than the sentence’s other characters. Consequently, the “k” and its following carriage return character is considered a separate attribute run ...

Get AppleScript in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.