If you intend to write your own script code from scratch, you need to know how to use a script to select an object and do something to it. In the programming world, the rules by which you do that are known as the object model. The scripting object model for Photoshop is hierarchical, like the folders on Web sites and your hard drive. When you want to open a specific Web page, you specify a URL that digs through the Web site (as in www.example.com), a top-level folder (www.example.com/products/), and more specific folders until you get to the file you want to view (www.example.com/products/appliances/ovens.html). In Photoshop, your script must identify the application (Photoshop), the document, and the type of object you intend to change, such as a layer, a selection, or a history state.
A script can also define variables, placeholders that store a value that can change as the script runs. A variable can change because the script performs a calculation on it, or because Photoshop replaces the variable with values you enter or from an external file. For example, in the business card example at the beginning of this chapter, a Photoshop script could start with a blank business card document, duplicate the business card to fill a page, and populate each card with a different employee name read from a text file.
You can see more details about the Photoshop object model in the Adobe Photoshop CS2 Scripting Guide (see the section "Scripting Resources").