Adobe 26001360 Scripting Guide - Page 42
Measurement units, Even if you change the current document ruler's units of measurement
UPC - 718659321840
View all Adobe 26001360 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 42 highlights
42 Scripting Illustrator ' Resize the TextFrameItem to match the document width sampleText.Width = documentWidth sampleText.Left = 0 End Sub 4. Save the form. 5. Open the original document you created using the "Hello World" script, then return to Visual Basic and run the script. 6. Click the button you created in Step 2. Measurement units Illustrator uses points as the unit of measurement for almost all distances, where one inch is equal to 72 points. The one exception is that for values for properties such as kerning, tracking, and the aki properties (used for Japanese text composition), em units are used. For an explanation of em units, see "Em Space Units" on page 43. Even if you change the current document ruler's units of measurement, Illustrator will still use points when communicating with your scripts. Your scripts will need to perform any unit conversions needed to represent your measurements as points. For example, to move the current selection to a position 2 inches to the right of, and 6 inches above, its current position, you'd use the following script in AppleScript: tell application "Adobe Illustrator CS" (* first, manually select the text frame item from the previous exercise or use AppleScript to make the selection *) set selection to text frame item 1 of current document (* There are 72 points per inch. To translate an item by 2 inches to the right and 6 inches to the left, multiply by 72 ) (translate selection delta x (2 * 72) delta y (6 * 72) *) end tell and this script for Visual Basic: Private Sub Command1_Click() Dim appRef As New Illustrator.Application Dim documentRef As Illustrator.Document Dim selectedObjects As Variant Dim objectRef As Variant Set documentRef = appRef.ActiveDocument selectedObjects = documentRef.Selection 12 Aug 03