Adobe Smoke Alarm CS3 Manuale Utente

Pagina di 85
Photoshop CS3
Adobe Photoshop CS3  Scripting Guide
 Scripting Photoshop CS3     42
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 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, width:500}
set shapeRef to {{0, 0}, {0, 100}, {100, 100}, {100, 0}}
select current document region shapeRef
VBS
DocRef = appRef.Documents.Add
ShapeRef = Array(Array(0, 0), Array(0, 100), Array(100,100), Array(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)
Stroking the Selection Border
The following examples use the 
stroke (Stroke/stroke())
 command of the 
Selection
 object to 
stroke the boundaries around the current selection and set the stroke color and width.
Note:
The transparency parameter cannot be used for background layers.
AS
stroke selection of current document using color ¬
{class:CMYK color, cyan:20, magenta:50, yellow:30, black:0} ¬
width 5 location inside blend mode vivid light opacity 75 ¬
without preserving transparency
VBS
Set strokeColor = CreateObject ("Photoshop.SolidColor")
strokeColor.CMYK.Cyan = 20
strokeColor.CMYK.Magenta = 50
strokeColor.CMYK.Yellow = 30
strokeColor.CMYK.Black = 0
appRef.ActiveDocument.Selection.Stroke strokeColor, 5, 1, 15, 75, False