Adobe 0046100128056 Scripting Guide - Page 26
Guides and grids, Defining guides
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 26 highlights
CHAPTER 3: Documents Basic Page Layout 26 myDocument = app.documents.add(); with(myDocument.pasteboardPreferences){ //You can use either a number or a measurement string //to set the space above/below. minimumSpaceAboveAndBelow = "12p"; //You can set the preview background color to any of //the predefined UIColor enumerations... previewBackgroundColor = UIColors.gray; //...or you can specify an array of RGB values //(with values from 0 to 255) //previewBackgroundColor = [192, 192, 192]; } Guides and grids Guides and grids make it easy to position objects on your document pages. These are very useful items to add when you are creating templates for others to use. Defining guides Guides in InDesign give you an easy way to position objects on the pages of your document. The following script fragment shows how to use guides. (For the complete script, see Guides.) var myDocument = app.documents.add(); var myPageWidth = myDocument.documentPreferences.pageWidth; var myPageHeight = myDocument.documentPreferences.pageHeight; with(myDocument.pages.item(0)){ //Place guides at the margins of the page. guides.add(undefined, {orientation:HorizontalOrVertical.vertical, location:marginPreferences.left}); guides.add(undefined, {orientation:HorizontalOrVertical.vertical, location:(myPageWidth - marginPreferences.right)}); guides.add(undefined, {orientation:HorizontalOrVertical.horizontal, location:marginPreferences.top}); guides.add(undefined, {orientation:HorizontalOrVertical.horizontal, location:(myPageHeight - marginPreferences.bottom)}); //Place a guide at the vertical center of the page. guides.add(undefined, {orientation:HorizontalOrVertical.vertical, location:(myPageWidth/2)}); //Place a guide at the horizontal center of the page. guides.add(undefined, {orientation:HorizontalOrVertical.horizontal, location:(myPageHeight/2)}); } Horizontal guides can be limited to a given page or extend across all pages in a spread. From InDesign scripting, you can control this using the fitToPage property. This property is ignored by vertical guides. You can use scripting to change the layer, color, and visibility of guides, just as you can from the user interface, as shown in the following script fragment (from the GuideOptions tutorial script):