Adobe photoshop cs 2.0 User Guide

Page of 91
Photoshop CS2
Adobe Photoshop CS2  Scripting Guide
 Scripting Photoshop CS2     48
JS: 
var fontstInstalled = app.fonts
The amount of unused memory available to Adobe Photoshop CS2.
The location of the Presets folder. 
Note:
See 
 for information on the Presets 
folder. 
Using the Document Object
The 
Document 
object can represent any open document in Photoshop CS2. You can think of a 
Document
 
object as a file; you can also think of it as a canvas. You work with the 
Document
 object to do the following:
Access script objects contained in the 
Document
 object, such as 
ArtLayer
 or 
Channel
 objects. See 
 fo
more information. 
Manipulate a specific 
Document
 object. For example, you could crop, rotate or flip the canvas, resize the 
image or canvas, and trim the image. See 
 for a 
demonstration. 
Get the active layer. See 
.
Save the current document. See 
Copy and paste within the active document or between different documents. See 
Manipulating a Document Object
The following examples demonstrate how to do the following:
Change the size of the image to 4 inches wide and 4 inches high.
Change the size of the document window (or canvas) to 5 inches high and 6 inches wide.
Trim the top and bottom of the image.
Crop the image.
Flip the entire window.
Note:
The following examples assume the ruler units have been set to inches. See 
 for information on ruler units. 
AS
--this script sample assumes the ruler units have been set to inches
resize image current document width 4 height 4
resize canvas current document width 4 height 4
trim current document basing trim on top left pixel ¬
with top trim and bottom trim without left trim and right trim
--the crop command uses unit values 
--change the ruler units to pixels
set ruler units of settings to pixel units
crop current document bounds {10, 20, 40, 50} angle 45 ¬
resolution 72 width 20 height 20
flip canvas current document direction horizontal