Creating A Preset Using New Values - Adobe 27510753 - InDesign CS2 - PC Manual

Scripting guide
Hide thumbs Also See for 27510753 - InDesign CS2 - PC:
Table of Contents

Advertisement

Adobe InDesign CS2 Scripting Guide
try {
var myPresetName = myDocumentPreset.name;
}
catch (myError){
myDocumentPreset = app.documentPresets.add({name:"myDocumentPreset"});
}
//Set the application default measurement units to match the document
//measurement units.
app.viewPreferences.horizontalMeasurementUnits = myDocument.viewPreferences.horizontalMeasurement
Units;
app.viewPreferences.verticalMeasurementUnits = myDocument.viewPreferences.verticalMeasurementUnit
s;
//Fill in the properties of the document preset with the corresponding
//properties of the active document.
with(myDocumentPreset){
//Note that the following gets the page margins from the margin preferences
//of the document; to get the margin preferences from the active page,
//replace "app.activeDocument" with "app.activeWindow.activePage" in the
//following line (assuming the active window is a layout window).
var myMarginPreferences = app.activeDocument.marginPreferences;
left = myMarginPreferences.left;
right = myMarginPreferences.right;
top = myMarginPreferences.top;
bottom = myMarginPreferences.bottom;
columnCount = myMarginPreferences.columnCount;
columnGutter = myMarginPreferences.columnGutter;
documentBleedBottom = app.activeDocument.documentPreferences.documentBleedBottomOffset;
documentBleedTop = app.activeDocument.documentPreferences.documentBleedTopOffset;
documentBleedLeft = app.activeDocument.documentPreferences.documentBleedInsideOrLeftOffset;
documentBleedRight = app.activeDocument.documentPreferences.documentBleedOutsideOrRightOffset;
facingPages = app.activeDocument.documentPreferences.facingPages;
pageHeight = app.activeDocument.documentPreferences.pageHeight;
pageWidth = app.activeDocument.documentPreferences.pageWidth;
pageOrientation = app.activeDocument.documentPreferences.pageOrientation;
pagesPerDocument = app.activeDocument.documentPreferences.pagesPerDocument;
slugBottomOffset = app.activeDocument.documentPreferences.slugBottomOffset;
slugTopOffset = app.activeDocument.documentPreferences.slugTopOffset;
slugInsideOrLeftOffset = app.activeDocument.documentPreferences.slugInsideOrLeftOffset;
slugRightOrOutsideOffset = app.activeDocument.documentPreferences.slugRightOrOutsideOffset;
}
}

Creating a preset using new values

To create a document preset using explicit values, run the following script:
//DocumentPreset.jsx
//An InDesign CS2 JavaScript
//Creates a new document preset.
var myDocumentPreset;
//If the document preset "myDocumentPreset" does not already exist, create it.
myDocumentPreset = app.documentPresets.item("myDocumentPreset");
try {
var myPresetName = myDocumentPreset.name;
}
catch (myError){
myDocumentPreset = app.documentPresets.add({name:"myDocumentPreset"});
}
//Fill in the properties of the document preset.
with(myDocumentPreset){
pageHeight = "9i";
pageWidth = "7i";
left = "4p";
right = "6p";
top = "4p";
bottom = "9p";
Working with Documents in JavaScript
121

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs2

Table of Contents