Adobe 27510753 Scripting Guide - Page 46
your InDesign folder., Set the vertical justification of the text frame.
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 46 highlights
38 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide if(myVerticalJustificationMenu.selectedIndex == 0){ myVerticalJustification = VerticalJustification.topAlign; } else if(myVerticalJustificationMenu.selectedIndex == 1){ myVerticalJustification = VerticalJustification.centerAlign; } else{ myVerticalJustification = VerticalJustification.bottomAlign; } //Get the paragraph alignment setting from the radiobutton group. if(myRadioButtonGroup.selectedButton == 0){ myParagraphAlignment = Justification.leftAlign; } else if(myRadioButtonGroup.selectedButton == 1){ myParagraphAlignment = Justification.centerAlign; } else{ myParagraphAlignment = Justification.rightAlign; } myDialog.destroy(); //Now create the document and apply the properties to the text. var myDocument = app.documents.add(); with(myDocument){ var myPage = pages[0]; with(myPage){ //Create a text frame. var myTextFrame = pages.item(0).textFrames.add(); with(myTextFrame){ //Set the geometric bounds of the frame using the "myGetBounds" function. geometricBounds = myGetBounds(myDocument, myPage); //Set the contents of the frame to the string you entered in the dialog box. contents = myString; //Set the alignment of the paragraph. texts.item(0).justification = myParagraphAlignment; //Set the point size of the text. texts.item(0).pointSize = myPointSize; //Set the vertical justification of the text frame. textFramePreferences.verticalJustification = myVerticalJustification; } } } } else{ myDialog.destroy() } //Utility function for getting the bounds of the "live area" of a page. function myGetBounds(myDocument, myPage){ with(myDocument.documentPreferences){ var myPageHeight = pageHeight; var myPageWidth = pageWidth; } with(myPage.marginPreferences){ var myTop = top; var myLeft = left; var myRight = right; var myBottom = bottom; } myRight = myPageWidth - myRight; myBottom = myPageHeight- myBottom; return [myTop, myLeft, myBottom, myRight]; } 2. Save the text as a plain text file with the file extension .jsx in the Scripts folder inside the Presets folder in your InDesign folder. 3. Test the script by double-clicking the script name in the InDesign Scripts palette.