Adobe photoshop cs 2.0 User Guide

Page of 91
Photoshop CS2
Adobe Photoshop CS2  Scripting Guide
 Scripting Photoshop CS2     49
VBS
'this script sample assumes the ruler units have been set to inches
docRef.ResizeImage 4,4
docRef.ResizeCanvas 4,4
docRef.Trim Type:=psTopLeftPixel, Top:=True, Left:=False, _
Bottom:=True, Right:=False
'the crop command uses unit values 
'change the ruler units to pixels
app.Preferences.RulerUnits = Photoshop.PsUnits.psPixels
docRef.Crop Array(10,20,40,50), Angle:=45, Width:=20, _
Height:=20, Resolution:=72
docRef.FlipCanvas psHorizontal
JS
//this sample script assumes the ruler units have been set to inches
docRef.resizeImage( 4,4 )
docRef.resizeCanvas( 4,4 )
docRef.trim(TrimType.TOPLEFT, true, false, true, false)
//the crop command uses unit values 
//change the ruler units to pixels
app.preferences.rulerUnits =Units.PIXELS
docRef.crop (new Array(10,20,40,50), 45, 20, 20, 72)
docRef.flipCanvas(Direction.HORIZONTAL)
Working with Layer Objects
The Photoshop CS2 object model contains two types of layer objects: 
ArtLayer
 objects, which can contain image contents and are basically equivalent to Layers in the 
Photoshop CS2 application. 
Note:
An 
ArtLayer
 object can also contain text if you use the 
kind
 property to set the 
ArtLayer
 
object’s type to text layer.
Layer Set
 objects, which can contain zero or more 
ArtLayer
 objects. 
When you create a layer you must specify whether you are creating an 
ArtLayer
 or a 
Layer Set
Note:
Both the 
ArtLayer
 and 
LayerSet
 objects have corresponding collection objects, 
ArtLayers
 and 
LayerSets
, which have an 
add/Add/add()
 command/method.You can reference, but not add, 
ArtLayer
 and 
LayerSet
 objects using the 
Layers
 collection object, because, unlike other 
collection objects, it does not have an 
add/Add/add()
 command/method.