
Photoshop CS3
Adobe Photoshop CS3 Scripting Guide Scripting Photoshop CS3 43
JS
strokeColor = new solidColor
strokeColor.cmyk.cyan = 20
strokeColor.cmyk.magenta = 50
strokeColor.cmyk.yellow = 30
strokeColor.cmyk.black = 0
app.activeDocument.selection.stroke (strokeColor, 2,
StrokeLocation.OUTSIDE, ColorBlendMode.VIVIDLIGHT, 75,
false)
Inverting Selections
You can use the invert (Invert/invert()) command 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
VBSselRef.Invert
JSselRef.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 CS3 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 ‘Setting Application Preferences’ on page 30
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 selRef
Set selRef = appRef.ActiveDocument.Selection
selRef.Expand 5
selRef.Contract 5
selRef.Feather 5
JS
var selRef = app.activeDocument.selection
selRef.expand( 5 )
selRef.contract( 5 )
selRef.feather( 5 )
Filling a Selection
You can fill a selection either with a color or a history state.
To fill with a color: