When it comes to lists, AppleScript really shines when you mix it with other programs. That's because other programs deal with their own unique kinds of information—graphics, formatted text, and sound, for example—which you simply can't create in AppleScript alone.
When commanding programs from AppleScript, you'll find yourself using the every keyword all the time. In this chapter alone, for example, you'll use every to get a list of all the words in a text document (see the next page), a list of all the open documents in a single program (Section 22.214.171.124), and even a list of synonyms for a particular word (see the next page). So don't get listless—you're about to go on a wild list-making ride!
Figure 6-7. Top: Enter every item you want into the dialog box. If you'd like, you can copy some text from another program, and paste it here using -V. Bottom: When you click OK, the script converts your text into a list. In this layout, it's a lot easier to browse.
When you're scripting TextEdit, lists can come in quite handy for breaking your text into smaller chunks. For instance, you can easily get a list of all the words in the frontmost TextEdit document with this script:
tell application "TextEdit" set wordList to (every word of the front document) ...