Adobe 27510753 Scripting Guide - Page 93
Changing measurement units and ruler, Defining and applying document presets
![]() |
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 93 highlights
Adobe InDesign CS2 Scripting Guide Working with Documents in AppleScript 85 Changing measurement units and ruler The example scripts so far used measurement strings (strings that force InDesign to use a specific measurement unit, "8.5i", for example, for 8.5 inches). They do this because you might be using a different measurement system when you run the script. To specify the measurement system used in a script, use the document's view preferences object. --ViewPreferences.as --An InDesign CS2 AppleScript --Sets the measurement units to points. --Assumes you have a document open. tell application "Adobe InDesign CS2" set myDocument to active document tell view preferences of myDocument --Measurement unit choices are: --picas, points, inches, inches decimal, millimeters, centimeters, or ciceros --Set horizontal and vertical measurement units to points. set horizontal measurement units to points set vertical measurement units to points end tell end tell If you're writing a script that needs to use a specific measurement system, you can change the measurement units at the beginning of the script and then restore the original measurement units at the end of the script, as shown in the following example: --ResetMeasurementUnits.as --An InDesign CS2 AppleScript --Sets measurement units, performs some actions, and then --resets measurement units to their original values. --Assumes you have a document open. tell application "Adobe InDesign CS2" set myDocument to active document tell view preferences of myDocument set myOldXUnits to horizontal measurement units set myOldYUnits to vertical measurement units set horizontal measurement units to points set vertical measurement units to points end tell --At this point, you can perform any series of script actions that depend on --the measurement units you've set. At the end of the script, reset --the measurement units to their original state. tell view preferences of myDocument set horizontal measurement units to myOldXUnits set vertical measurement units to myOldYUnits end tell end tell Defining and applying document presets InDesign document presets enable you to store and apply commonly used document setup information (page size, page margins, columns, and bleed and slug areas). When you create a new document, you can base the document on a document preset. Creating a preset by copying values To create a document preset using an existing document's settings as an example, open a document that has the document setup properties that you want to use in the document preset, then run the following script:
![](/manual_guide/products/adobe-27510753-scripting-guide-5f6265c/93.png)