Adobe 65014912 Scripting Guide - Page 50
Set myPathItem = docRef.PathItems.AddA Line, lineSubPathArray, Set docRef = appRef.Documents.Add5000
UPC - 883919160382
View all Adobe 65014912 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 50 highlights
CHAPTER 3: Scripting Photoshop Working with the Photoshop Object Model 50 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) ' stroke it so we can see something myPathItem.StrokePath(2) 'for PsToolType --> 2 (psBrush) JS // 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 // First create the array of PathPointInfo objects. The line has two points, // so there are two PathPointInfo objects. var lineArray = new Array() lineArray[0] = new PathPointInfo lineArray[0].kind = PointKind.CORNERPOINT lineArray[0].anchor = Array(100, 100) lineArray[0].leftDirection = lineArray[0].anchor lineArray[0].rightDirection = lineArray[0].anchor lineArray[1] = new PathPointInfo lineArray[1].kind = PointKind.CORNERPOINT lineArray[1].anchor = Array(150, 200) lineArray[1].leftDirection = lineArray[1].anchor lineArray[1].rightDirection = lineArray[1].anchor