66
Using ExtendScript Tools and Features
This figure shows confirmation dialogs with a title value specified.
Specifying measurement values
ExtendScript provides the UnitValue object to represent measurement values. The properties and methods
of the UnitValue object make it easy to change the value, the unit, or both, or to perform conversions from
one unit to another.
UnitValue object
Represents measurement values that contain both the numeric magnitude and the unit of measurement.
UnitValue object constructor
The UnitValue constructor creates a new UnitValue object. The keyword new is optional:
myVal = new UnitValue (
myVal = new UnitValue ("
myVal = new UnitValue (
The value is a number, and the unit is specified with a string in abbreviated, singular, or plural form, as shown
in the following table.
Abbreviation
in
ft
yd
mi
mm
cm
m
km
pt
pc
tpt
value
unit
,
);
value unit
");
value
unit
, "
");
Singular
Plural
inch
inches
foot
feet
yard
yards
mile
miles
millimeter
millimeters
centimeter
centimeters
meter
meters
kilometer
kilometers
point
points
pica
picas
traditional point
traditional points
Adobe InDesign CS2 Scripting Guide
Comments
2.54 cm
30.48 cm
91.44 cm
1609.344 m
inches / 72
points * 12
inches / 72.27