Setting Ruler And Type Units In A Script - Adobe 65014912 Manual

Photoshop cs4 extended
Table of Contents

Advertisement

C
3: Scripting Photoshop
HAPTER
AppleScript
crop
(bounds, height, width)
resize canvas
(height, width)
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 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.
AS
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
VBS
In VBScript
Application
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
In JavaScript
the
Application
app.preferences.rulerUnits = Units.INCHES
app.preferences.typeUnits = TypeUnits.PIXELS
app.preferences.pointSize = PointType.POSTSCRIPT
N
: Remember to reset the unit settings back to the original values at the end of a script. See
OTE
with document preferences" on page 61
VBScript
Document.Crop
(Bounds, Height, Width)
Document.ResizeCanvas
(Height, Width)
Document.ResizeImage
(Height, Width)
Selection.Contract
(By)
Selection.Expand
(By)
Selection.Feather
(By)
Selection.SelectBorder
(Width)
Selection.Translate
(DeltaX, DeltaY)
Selection.TranslateBoundary
(DeltaX, DeltaY)
and
ruler units
type units
settings
and
RulerUnits
TypeUnits
object's
Preferences
and
rulerUnits
typeUnits
object's
preferences
are properties of the
property as shown below.
are properties of the
property as shown below.
are properties of the
property as shown below.
for an example of how to do this.
JavaScript
document.crop
(bounds, height, width)
document.resizeCanvas
(height, width)
document.resizeImage
(height, width)
selection.contract
(by)
selection.expand
(by)
selection.feather
(by)
selection.selectBorder
(width)
selection.translate
(deltaX, deltaY)
selection.translateBoundary
(deltaX, deltaY)
settings-object
object, accessed through the
Preferences
object, accessed through
Preferences
Working with Units 59
, accessed through
"Working

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents