Sample Workflow Automation Javascripts - Adobe PHOTOSHOP CS 2.0 - SCRIPTING GUIDE Manual

Table of Contents

Advertisement

Adobe Photoshop CS2 Scripting Guide
AppleScript
resize image
(height, width)
contract
(by)
expand
(by)
feather
(by)
select border
(width)
translate
(delta x, delta y)
translate boundary
(delta x, delta y)
Setting Ruler And Type Units in a Script
The unit type settings of the two Photoshop CS2 rulers control how numbers are interpreted when dealing
with properties and parameters that support unit values. Be sure to set the ruler units as needed at the
beginning of your scripts and save and restore the original ruler settings when your script has completed.
In AppleScript
the Application object's
set ruler units of settings to inch units
set type units of settings to pixel units
set point size of settings to postscript size
In VBScript and JavaScript
through the
VBS
appRef.Preferences.RulerUnits = 2 'for PsUnits --> 1 (psInches)
appRef.Preferences.TypeUnits = 1 'for PsTypeUnits --> 1 (psPixels)
appRef.Preferences.PointSize = 2
'2 indicates psPointType --> 2 (PsPostScriptPoints)
JS
app.preferences.rulerUnits = Units.INCHES
app.preferences.typeUnits = TypeUnits.PIXELS
app.preferences.pointSize = PointType.POSTSCRIPT
Note:
Remember to reset the unit settings back to the original values at the end of a script. See
with Document Preferences' on page 72

Sample Workflow Automation JavaScripts

The following sample workflow automation JavaScripts are provided with Photoshop CS2 and
demonstrate various kinds of scripting usage. The scripts are located in the
VBScript
Document.ResizeImage
(Height, Width)
Selection.Contract
(By)
Selection.Expand
(By)
Selection.Feather
(By)
Selection.SelectBorder
(Width)
Selection.Translate
(DeltaX, DeltaY)
Selection.TranslateBoun
dary
(DeltaX, DeltaY)
and
ruler units
type units
settings
ruler units
object's preferences property as shown below.
Application
Photoshop CS2
are properties of the
property as shown below.
and
are properties of the
type units
for an example of how to do this.
Scripting Photoshop CS2
JavaScript (Continued)
document.resizeImage
(height, width)
selection.contract
(by)
selection.expand
(by)
selection.feather
(by)
selection.selectBorder
(width)
selection.translate
(deltaX, deltaY)
selection.translateBou
ndary
(deltaX, deltaY)
settings-object
Preferences
Presets/Scripts
71
, accessed through
, accessed
'Working
folder in

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs2

Table of Contents