Photoshop CS2
Adobe Photoshop CS2 Scripting Guide
Scripting Photoshop CS2 71
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
ruler units
and
type units
are properties of the
settings-object
, accessed through
the Application object's
settings
property as shown below.
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
ruler units
and
type units
are properties of the
Preferences
, accessed
through the
Application
object's preferences property as shown below.
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
‘Working
with Document Preferences’ on page 72
for an example of how to do this.
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
Presets/Scripts
folder in
resize image
(height, width)
Document.ResizeImage
(Height, Width)
document.resizeImage
(height, width)
contract
(by)
Selection.Contract
(By)
selection.contract
(by)
expand
(by)
Selection.Expand
(By)
selection.expand
(by)
feather
(by)
Selection.Feather
(By)
selection.feather
(by)
select border
(width)
Selection.SelectBorder
(Width)
selection.selectBorder
(width)
translate
(delta x, delta y)
Selection.Translate
(DeltaX, DeltaY)
selection.translate
(deltaX, deltaY)
translate boundary
(delta x, delta y)
Selection.TranslateBoun
dary
(DeltaX, DeltaY)
selection.translateBou
ndary
(deltaX, deltaY)
AppleScript VBScript
JavaScript
(Continued)
Содержание PHOTOSHOP CS 2.0 - SCRIPTING GUIDE
Страница 1: ...bbc Adobe Photoshop cs 2 Scripting Guide ...