Adobe 23101335 - Photoshop - PC Manual page 45

Scripting guide
Hide thumbs Also See for 23101335 - Photoshop - PC:
Table of Contents

Advertisement

The values returned for a Photoshop property which used units will be returned as a value of
the current ruler type. Getting the height of the document created above:
set docHeight to height of current document
would return a value of 5.0, which represents 5 inches based on the current ruler settings.
In AppleScript, you can optionally ask for a property value as a particular type.
set docHeight to height of current document as points
This would return a value of 360 (5 inches x 72 points per inch).
IMPO R TAN T:
The length unit value types available AppleScript use are listed below:
T
ABLE
inches
feet
yards
miles
points
traditional points
ciceros
The points and picas unit value types are PostScript points, with 72 points per inch. The
traditional points and traditional picas unit value types are based on classical
type setting values, with 72.27 points per inch.
When working with unit values, it is possible to convert, or coerce, a unit value from one value
type to another. For example, the following script will convert a point value to an inch value.
set pointValue to points 72
set inchValue to pointValue as inches
When this script is run the variable inchValue will contain inches 1 , which is 72 points
converted to inches. This conversion ability is built in to the AppleScript language.
To use a unit value in a calculation it is necessary to first convert the value to a number (unit
value cannot be used directly in calculations). To multiply an inch value write:
set newValue to (inchValue as number) * someValue
Photoshop 7.0 Scripting Guide
Because Photoshop is a pixel-oriented application you may not always get
back the same value as you pass in when setting a value. For example, if Ruler
Units is set to mm units, and you create a document that is 30 x 30, the value
returned for the height or width will be 30.056 if your document resolution is
set to 72 ppi. The scripting interface assumes settings are measured by ppi.
3.1
AppleScript Length Unit Values
millimeters
centimeters
meters
kilometers
picas
traditional picas
Scripting Photoshop
Working with units
3
45

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop 7.0

Table of Contents