Adobe photoshop cs 2.0 User Guide

Page of 91
Photoshop CS2
Adobe Photoshop CS2  Scripting Guide
 Scripting Photoshop CS2     57
Stroking the Selection Border
The following examples use the 
stroke (Stroke/stroke())
 command/method 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
selRef.Stroke strokeColor, 5, 1, 15, 75, False
JS
app.activeDocument.selection.stroke (strokeColor, 2,
StrokeLocation.OUTSIDE, ColorBlendMode.VIVIDLIGHT, 75, 
false)
Inverting Selections
You can use the i
nvert/Invert/invert()
 command/method of the Selection object to a selection so you 
can work on the rest of the document, layer or channel while protecting the selection. 
AS
invert selection of current document
VBS
selRef.Invert
JS
selRef.invert()
Expanding, Contracting and Feathering Selections
You can change the size of a selected area using the expand, contract, and feather commands. 
The values are passed in the ruler units stored in Photoshop CS2 preferences and can be changed by your 
scripts. If your ruler units are set to pixels, then the following examples will expand, contract and feather by 
five pixels. See section 
 for examples of how to 
change ruler units.
AS
expand selection of current document by pixels 5
contract selection of current document by pixels 5
feather selection of current document by pixels 5
VBS
Dim appRef 
Set appRef = CreateObject("Photoshop.Application")
Dim selRef 
Set selRef = appRef.ActiveDocument.Selection
selRef.Expand 5