Adobe photoshop cs 2.0 User Guide

Page of 91
Photoshop CS2
Adobe Photoshop CS2  Scripting Guide
 Scripting Photoshop CS2     62
Note:
This type of script corresponds to selecting Start Application in the Script Events Manager (File > 
Scripts > Script Events Manager
) in the Photoshop CS2 application. Please refer to Photoshop CS2 
Help for information on using the Script Events Manager. 
Using the PathItem Object
To add a 
PathItem
 object, you create an array of 
PathPointInfo
 objects, which specify the coordinates of 
the corners or anchor points of your path. Additionally, you can create an array of 
SubPathInfo
 objects to 
contain the 
PathPoint
 arrays. 
The following script creates a 
PathItem
 object that is a straight line. 
AS
--line #1--it’s a straight line so the coordinates for anchor, left, and 
--right for each point have the same coordinates
tell application "Adobe Photoshop CS2" 
set ruler units of settings to pixel units 
set type units of settings to pixel units 
set docRef to make new document with properties {height:700, width:500,¬
name:"Snow Cone"} 
set pathPointInfo1 to {class:path point info, kind:corner point,¬
anchor:{100, 100}, left direction:{100, 100}, right direction:{100, 100}} 
set pathPointInfo2 to {class:path point info, kind:corner point,¬
anchor:{150, 200}, left direction:{150, 200}, right direction:{150, 200}} 
set subPathInfo1 to {class:sub path info, entire sub path:{pathPointInfo1,¬
pathPointInfo2}, operation:shape xor, closed:false} 
set newPathItem to make new path item in docRef with properties {entire path:¬
{subPathInfo1, subPathInfo2} kind:normal} 
end tell 
VBS
'line #1--it’s a straight line so the coordinates for anchor, left, and 
'right for each point have the same coordinates
Set lineArray(1) = CreateObject("Photoshop.PathPointInfo")
lineArray(1).Kind = 2 ' for PsPointKind --> 2 (psCornerPoint)
lineArray(1).Anchor = Array(100, 100)
lineArray(1).LeftDirection = lineArray(1).Anchor
lineArray(1).RightDirection = lineArray(1).Anchor
Set lineArray(2) = CreateObject("Photoshop.PathPointInfo")
lineArray(2).Kind = 2
lineArray(2).Anchor = Array(150, 200)
lineArray(2).LeftDirection = lineArray(2).Anchor
lineArray(2).RightDirection = lineArray(2).Anchor
Set lineSubPathArray(1) = CreateObject("Photoshop.SubPathInfo")
lineSubPathArray(1).operation = 2 'for PsShapeOperation --> 2 (psShapeXOR)
lineSubPathArray(1).Closed = false
lineSubPathArray(1).entireSubPath = lineArray