Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting Photoshop CS2 56
●
In the
Adobe Photoshop CS2 Visual Basic Scripting Reference
and the
Adobe Photoshop CS2 JavaScript
Scripting Reference
, look up selection in the Properties table for the
Document
object. Also, look up the
select
in the Methods table for the
Selection
object.
Creating and Defining a Selection
To create a selection, you use the
select/Select/select()
command/method of the
Selection
object.
You define a
Selection
object by specifying the coordinates on the screen that describe the selection’s
corners. Since your document is a 2-dimensional object, you specify coordinates using the x-and y-axes as
follows:
●
You use the x-axis to specify the horizontal position on the canvas.
●
You use the y-axis to specify the vertical position on the canvas.
The origin point in Photoshop CS2, that is, x-axis = 0 and y-axis = 0, is the upper left corner of the screen.
The opposite corner, the lower right, is the extreme point of the canvas. For example, if your canvas is 1000
x 1000 pixels, then the coordinate for the lower right corner is x-axis = 1000 and y-axis = 1000.
You specify coordinate points that describe the shape you want to select as an array, which then becomes
the argument or parameter value for the
select/Select/select()
command/method.
➤
The following examples assume that the ruler units have been set to pixels and create a selection
by:
1. Creating a variable to hold a new document that is 500 x 500 pixels in size.
2. Creating a variable to hold the coordinates that describe the selected area (that is, the
Selection
object).
3. Adding an array as the selection variable’s value.
4. Using the
Document
object’s
selection
property, and the
Selection
object’s
select
command/method to select an area. The area’s coordinates are the selection variable’s values.
AS
set docRef to make new document with properties {height: 500 pixels, width:500
pixels}
set shapeRef to select current document region {{ 0, 0}, {0, 100}, ¬
{ 100, 100}, { 100, 0}}
select current document region shapeRef
VBS
DocRef = Documents.Add
ShapeRef = Array((0, 0), (0, 100), (100,100), (100,0))
docRef.Selection.Select ShapeRef
JS
var docRef = app.documents.add(500, 500)
var shapeRef = [
[0,0],
[0,100],
[100,100],
[100,0]
]
docRef.selection.select(shapeRef)
Содержание PHOTOSHOP CS 2.0 - SCRIPTING GUIDE
Страница 1: ...bbc Adobe Photoshop cs 2 Scripting Guide ...