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. Anattribute 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 theattribute run
s of that paragraph would return two separate chunks of text in alist
(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 twoattribute run
s. The following example gets everyattribute run
of a document’s text (alist
containing threeattribute run
s). 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 separateattribute 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.