Adobe 23102480 Scripting Guide - Page 7

Photoshop CS3 Scripting Basics, Scripting Overview, Why use scripts instead of actions? - photoshop part number

Page 7 highlights

2 Photoshop CS3 Scripting Basics This chapter provides an overview of scripting for Photoshop, describes scripting support for the scripting languages AppleScript, VBScript, and JavaScript, how to execute scripts, and covers the Photoshop CS3 object model. It provides a simple example of how to write your first Photoshop CS3 script. If you are familiar with scripting or programming languages, you most likely will want to skip much of this chapter. Use the following list to locate information that is most relevant to you. ● For more information on the Photoshop CS3 object model, see 'Photoshop CS3 Object Model' on page 9. ● For information on selecting a scripting language, refer to the Introduction to Scripting guide. ● For examples of scripts created specifically for use with Photoshop CS3, see Chapter 3, 'Scripting Photoshop CS3' on page 19. ● For detailed information on Photoshop CS3 objects and commands, please use the reference information in the three reference manuals provided with this installation: Adobe Photoshop CS3 AppleScript Scripting Reference, Adobe Photoshop CS3 Visual Basic Scripting Reference, and Adobe Photoshop CS3 JavaScript Scripting Reference. Note: You can also view information about the Photoshop CS3 objects and commands through the object browsers for each of the three scripting languages. See 'Viewing Photoshop CS3 Objects, Commands, and Methods' on page 19. Scripting Overview A script is a series of commands that tells Photoshop CS3 to perform a set of specified actions, such as applying different filters to selections in an open document. These actions can be simple and affect only a single object, or they can be complex and affect many objects in a Photoshop CS3 document. The actions can call Photoshop CS3 alone or invoke other applications. Scripts automate repetitive tasks and are often used as a creative tool to streamline tasks that might be too time consuming to do manually. For example, you could write a script to generate a number of localized versions of a particular image or to gather information about the various color profiles used by a collection of images. If you are new to scripting, you should acquaint yourself with the basic scripting information provided in the Introduction to Scripting manual. Why use scripts instead of actions? If you've used Photoshop CS3 Actions, you're already familiar with the enormous benefits of automating repetitive tasks. Scripting allows you to extend those benefits by allowing you to add functionality that is not available for Photoshop CS3 Actions. For example, you can do the following with scripts and not with actions: ● You can add conditional logic, so that the script automatically makes "decisions" based on the current situation. For example, you could write a script that decides which color border to add depending on the size of the selected area in an image: "If the selected area is smaller than 2 x 4 inches, add a green border; otherwise add a red border." 7

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85

7
2
Photoshop CS3
Scripting Basics
This chapter provides an overview of scripting for Photoshop, describes scripting support for the scripting
languages AppleScript, VBScript, and JavaScript, how to execute scripts, and covers the Photoshop CS3
object model. It provides a simple example of how to write your first Photoshop CS3 script.
If you are familiar with scripting or programming languages, you most likely will want to skip much of this
chapter. Use the following list to locate information that is most relevant to you.
For more information on the Photoshop CS3 object model, see
‘Photoshop CS3 Object Model’ on
page 9
.
For information on selecting a scripting language, refer to the
Introduction to Scripting
guide.
For examples of scripts created specifically for use with Photoshop CS3, see Chapter 3,
‘Scripting
Photoshop CS3’ on page 19
.
For detailed information on Photoshop CS3 objects and commands, please use the reference
information in the three reference manuals provided with this installation:
Adobe Photoshop CS3
AppleScript Scripting Reference
,
Adobe Photoshop CS3 Visual Basic Scripting Reference
, and
Adobe
Photoshop CS3 JavaScript Scripting Reference
.
Note:
You can also view information about the Photoshop CS3 objects and commands through the object
browsers for each of the three scripting languages. See
‘Viewing Photoshop CS3 Objects,
Commands, and Methods’ on page 19
.
Scripting Overview
A script is a series of commands that tells Photoshop CS3 to perform a set of specified actions, such as
applying different filters to selections in an open document. These actions can be simple and affect only a
single object, or they can be complex and affect many objects in a Photoshop CS3 document. The actions
can call Photoshop CS3 alone or invoke other applications.
Scripts automate repetitive tasks and are often used as a creative tool to streamline tasks that might be too
time consuming to do manually. For example, you could write a script to generate a number of localized
versions of a particular image or to gather information about the various color profiles used by a collection
of images.
If you are new to scripting, you should acquaint yourself with the basic scripting information provided in
the
Introduction to Scripting
manual.
Why use scripts instead of actions?
If you’ve used Photoshop CS3 Actions, you’re already familiar with the enormous benefits of automating
repetitive tasks. Scripting allows you to extend those benefits by allowing you to add functionality that is
not available for Photoshop CS3 Actions. For example, you can do the following with scripts and not with
actions:
You can add
conditional logic
, so that the script automatically makes “decisions” based on the current
situation. For example, you could write a script that decides which color border to add depending on
the size of the selected area in an image: “If the selected area is smaller than 2 x 4 inches, add a green
border; otherwise add a red border.”