Adobe 23102480 - Photoshop CS3 - PC Programming Manual page 49

Scripting guide
Table of Contents

Advertisement

Adobe Photoshop CS3 Scripting Guide
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 CS3"
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, ¬
set pathPointInfo1 to {class:path point info, kind:corner point, ¬
set pathPointInfo2 to {class:path point info, kind:corner point, ¬
set subPathInfo1 to ¬
set newPathItem to make new path item in docRef with properties ¬
end tell
VBS
Dim appRef, docRef
Dim lineArray(1), lineArray2(1), lineSubPathArray(0), myPathItem
Set appRef = CreateObject("Photoshop.Application")
' create a document to work with
Set docRef = appRef.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
'First create the array of PathPointInfo objects. The line has two points,
'so there are two PathPointInfo objects.
Set lineArray(0) = CreateObject("Photoshop.PathPointInfo")
lineArray(0).Kind = 2 ' for PsPointKind --> 2 (psCornerPoint)
lineArray(0).Anchor = Array(100, 100)
lineArray(0).LeftDirection = lineArray(0).Anchor
lineArray(0).RightDirection = lineArray(0).Anchor
Set lineArray(1) = CreateObject("Photoshop.PathPointInfo")
lineArray(1).Kind = 2
lineArray(1).Anchor = Array(150, 200)
lineArray(1).LeftDirection = lineArray(1).Anchor
lineArray(1).RightDirection = lineArray(1).Anchor
'Next create a SubPathInfo object, which will hold the line array
'in its EntireSubPath property.
Set lineSubPathArray(0) = CreateObject("Photoshop.SubPathInfo")
lineSubPathArray(0).Operation = 2 'for PsShapeOperation --> 2 (psShapeXOR)
lineSubPathArray(0).Closed = false
lineSubPathArray(0).EntireSubPath = lineArray
'create the PathItem object using Add. This method takes the SubPathInfo object
'and returns a PathItem object, which is added to the pathItems collection
'for the document.
Set myPathItem = docRef.PathItems.Add("A Line", lineSubPathArray)
name:"Snow Cone"}
anchor:{100, 100}, left direction:{100, 100}, right direction:{100, 100}}
anchor:{150, 200}, left direction:{150, 200}, right direction:{150, 200}}
{class:sub path info, ¬
entire sub path:{pathPointInfo1, pathPointInfo2}, ¬
operation:shape xor, closed:false}
{entire path:{subPathInfo1}, name:"Line", kind:normal}
Photoshop CS3
Scripting Photoshop CS3
49

Advertisement

Table of Contents
loading

This manual is also suitable for:

13102498 - photoshop cs3 - macPhotoshop cs3

Table of Contents