JavaScript Scripting Reference
Method
makeClippingPath
([flatness])
makeSelection
([feather]
[, antiAlias]
[, operation])
remove
()
select
()
strokePath
([tool]
[, simulatePressure])
Sample Script
The following creates a path in three segments: two diagonal lines that form a V, and a curved line above
the V that makes it look like a 2D ice cream cone.
Paths.jsx
// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
var startDisplayDialogs = app.displayDialogs
// Set Adobe Photoshop CS3 to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
// first close all the open documents
while (app.documents.length) {
app.activeDocument.close()
}
// create a document to work with
var docRef = app.documents.add(5000, 7000, 72, "Simple Line")
//line 1--it's a straight line so the coordinates for anchor, left, and right
//for each point have the same coordinates
var lineArray = new Array()
lineArray[0] = new PathPointInfo
lineArray[0].kind = PointKind.CORNERPOINT
Adobe Photoshop CS3
Parameter Type
number (double)
number (double)
boolean
SelectionType
ToolType
boolean
JavaScript Object Reference
Returns
What it does (Continued)
Makes this
the clipping path for this
document; the optional
parameter tells the PostScript
printer how to approximate
curves in the path (0.2 - 100).
Makes a
selection
whose border is the path, from
this
pathItem
0.0 - 250.0 in pixels).
Note:
See Selection.
Deletes this
Makes this
the active or selected
object.
pathItem
Strokes the path with the
specified information.
140
object
pathItem
object,
object (
:
feather
object.
pathItem
object
pathItem