Adobe 23101764 Scripting Guide - Page 63
Special unit value types
UPC - 718659340025
View all Adobe 23101764 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 63 highlights
Scripting Photoshop 3 Working with units 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 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. NOTE: In AppleScript you can get and set values as pixels or percent as you would any other unit value type. You cannot, however, convert a pixel or percent value to another length unit value as you can with other length value types. Trying to run the following script will result in an error. set pixelValue to pixels 72 -- Next line will result in a coercion error when run set inchValue to pixelValue as inches Photoshop CS Scripting Guide 59