O'Reilly logo

AppleScript in a Nutshell by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required