Adobe 27510753 Scripting Guide - Page 131
Setting application text defaults, the text-formatting defaults for the application
![]() |
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 131 highlights
Adobe InDesign CS2 Scripting Guide Working with Documents in JavaScript 123 //Set up the right page (recto). with(pages.item(1)){ with(marginPreferences){ columnCount = 3; columnGutter = "1p"; bottom = "6p" //"left" means inside; "right" means outside. left = "6p" right = "4p" top = "4p" } //Add a simple footer with a section number and page number. with(textFrames.add()){ geometricBounds = ["61p", "6p", "62p", "47p"]; insertionPoints.item(0).contents = SpecialCharacters.autoPageNumber; insertionPoints.item(0).contents = SpecialCharacters.emSpace; insertionPoints.item(0).contents = SpecialCharacters.sectionMarker; paragraphs.item(0).justification = Justification.rightAlign; } } } To apply a master spread to a document page, use the appliedMaster property of the document page. //ApplyMaster.jsx //An InDesign CS2 JavaScript //Applies a master spread to a page. //Assumes that the active document has a master page named "B-Master" //and at least three pages--page 3 is pages.item(2) because JavaScript arrays are zero-based. app.activeDocument.pages.item(2).appliedMaster = app.activeDocument.masterSpreads.item("B-Master"); Use the same property to apply a master spread to a master spread page: //ApplyMasterToMaster.jsx //An InDesign CS2 JavaScript //Applies a master spread to a master page. //Assumes that the active document has master spread named "B-Master" //that is not the same as the first master spread in the document. app.activeDocument.masterSpreads.item(0).pages.item(0).appliedMaster = app.activeDocument. masterSpreads.item("B-Master"); Setting text-formatting defaults You can set the default text-formatting attributes for your application or for individual documents. If you set the text-formatting defaults for the application, they become the defaults for all new documents-existing documents remain unchanged. When you set the text-formatting defaults for a document, any new text that you put into the document uses those defaults, and any existing text remains unchanged. Setting application text defaults To set the text-formatting defaults for your application: //ApplicationTextDefaults.jsx //An InDesign CS2 JavaScript //Sets the application text defaults, which will become the text defaults for all //new documents. Existing documents will remain unchanged. with(app.textDefaults){ alignToBaseline = true; try{ appliedFont = app.fonts.item("Minion Pro"); } catch(e){}
![](/manual_guide/products/adobe-27510753-scripting-guide-5f6265c/131.png)