Changing Measurement Units And Ruler - Adobe 0046100128056 - InDesign - Mac Manual

Javascript
Table of Contents

Advertisement

C
3: Documents
HAPTER
Snapping to guides and grids
All snap settings for a document's grids and guides are in the properties of the
gridPreferences
properties. (For the complete script, see GuideGridPreferences.)
var myDocument = app.activeDocument;
with(myDocument.guidePreferences){
guidesInBack = true;
guidesLocked = false;
guidesShown = true;
guidesSnapTo = true;
}
with(myDocument.gridPreferences){
documentGridShown = false;
documentGridSnapTo = true;
//Objects "snap" to the baseline grid when
//guidePreferences.guideSnapTo is set to true.
baselineGridShown = true;
}

Changing measurement units and ruler

Thus far, the sample scripts used measurement strings, strings that force InDesign to use a specific
measurement unit (for example, "8.5i" 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
shown in the following script fragment (from the ViewPreferences tutorial script):
var myDocument = app.activeDocument;
with(myDocument.viewPreferences){
//Measurement unit choices are:
//* MeasurementUnits.agates
//* MeasurementUnits.picas
//* MeasurementUnits.points
//* MeasurementUnits.inches
//* MeasurementUnits.inchesDecimal
//* MeasurementUnits.millimeters
//* MeasurementUnits.centimeters
//* MeasurementUnits.ciceros
//Set horizontal and vertical measurement units to points.
horizontalMeasurementUnits = MeasurementUnits.points;
verticalMeasurementUnits = MeasurementUnits.points;
}
If you are writing a script that needs to use a specific measurement system, you can change the
measurement units at the beginning of the script, then restore the original measurement units at the end
of the script. This is shown in the following script fragment (from the ResetMeasurementUnits tutorial
script):
objects. The following script fragment shows how to set guide and grid snap
Basic Page Layout 28
guidePreferences
object, as
viewPreferences
and

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs5

Table of Contents