Working With Units; Unit Values; Special Unit Value Types; Applescript Unit Considerations - Adobe 65048332 Manual

Scripting guide
Table of Contents

Advertisement

C
3: Scripting Photoshop
HAPTER

Working with Units

Photoshop provides two rulers for documents. Using properties on the
(
Preferences/Preferences
rulers are:
A graphics ruler used for most graphical layout measurements or operations on a document where
height, width, or position are specified.
You set measurement unit types for the graphics ruler using the
(RulerUnits/rulerUnits)
A type ruler, which is active when using the type tool.
You set measurement unit types for the type ruler using the
property.
N
: These settings correspond to those found in the Photoshop preference dialog under Photoshop >
OTE
Preferences > Units & Rulers on Mac OS or Edit > Preferences > Units & Rulers in Windows.

Unit values

All languages support plain numbers for unit values. These values are treated as being of the type
currently specified for the appropriate ruler.
For example, if the ruler units are currently set to inches and the following VBScript statement sets a
document's size to 3 inches by 3 inches:
docRef.ResizeImage 3,3
If the ruler units had been set to pixels, the document would be 3 pixels by 3 pixels. To ensure that your
scripts produce the expected results you should check and set the ruler units to the type appropriate for
your script. After executing a script the original values of the ruler settings should be restored if changed in
the script. See
Please refer to Photoshop Help for information about available unit value types.

Special unit value types

The unit values used by Photoshop are length units, representing values of linear measurement. Support is
also included for pixel and percent unit values. These two unit value types are not, strictly speaking, length
values but are included because they are used extensively by Photoshop for many operations and values.

AppleScript unit considerations

AppleScript provides an additional way of working with unit values. You can provide values with an
explicit unit type where unit values are used. When a typed value is provided its type overrides the ruler's
current setting.
For example, to create a document which is 4 inches wide by 5 inches high you would write:
make new document with properties {width:inches 4, ¬
height:inches 5}
) object, you can set the measurement units for the rulers in your script. The
property.
"Setting ruler and type units in a script" on page 59
Working with Units 56
settings-object
ruler units
type units (TypeUnits/typeUnits)
for directions on setting unit values.

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

65048599Photoshop cs5

Table of Contents