Adobe 27510753 Scripting Guide - Page 44
Test the script by double-clicking the script name in the InDesign Scripts palette
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 44 highlights
36 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide Set myTempDialogColumn = myBorderPanel.DialogColumns.Add Set myRadioButtonGroup = myTempDialogColumn.RadiobuttonGroups.Add Set myLeftRadioButton = myRadioButtonGroup.RadiobuttonControls.Add myLeftRadioButton.StaticLabel = "Left" myLeftRadioButton.CheckedState = True Set myCenterRadioButton = myRadioButtonGroup.RadiobuttonControls.Add myCenterRadioButton.StaticLabel = "Center" Set myRightRadioButton = myRadioButtonGroup.RadiobuttonControls.Add myRightRadioButton.StaticLabel = "Right" Rem If the user clicked OK, then create the example document. If myDialog.Show = True Then Rem Get the values from the dialog box controls. myString = myTextEditField.EditContents myPointSize = myPointSizeField.EditValue Rem Create a new document. Set myDocument = myInDesign.Documents.Add Set myTextFrame = myDocument.Pages.Item(1).TextFrames.Add Rem Resize the text frame to the "live" area of the page (using the function "myGetBounds"). myBounds = myGetBounds(myDocument, myDocument.Pages.Item(1)) myTextFrame.GeometricBounds = myBounds Rem Enter the text from the dialog box in the text frame. myTextFrame.Contents = myString Rem Set the size of the text to the size you entered in the dialog box. myTextFrame.Texts.Item(1).PointSize = myPointSize Rem Set the vertical justification of the text frame to the dialog menu choice. Select Case myVerticalJustificationMenu.SelectedIndex Case 0 myTextFrame.TextFramePreferences.VerticalJustification = idVerticalJustification.idTopAlign Case 1 myTextFrame.TextFramePreferences.VerticalJustification = ¬ idVerticalJustification.idCenterAlign Case Else myTextFrame.TextFramePreferences.VerticalJustification = idTopAlign.idBottomAlign End Select Rem set the paragraph alignment of the text to the dialog radio button choice. Select Case myRadioButtonGroup.SelectedButton Case 0 myTextFrame.Texts.Item(1).Justification = idJustification.idLeftAlign Case 1 myTextFrame.Texts.Item(1).Justification = idJustification.idCenterAlign Case Else myTextFrame.Texts.Item(1).Justification = idJustification.idRightAlign End Select Rem Remove the dialog box from memory. myDialog.Destroy End If Rem Function for getting the bounds of the "live area" Function myGetBounds(myDocument, myPage) myPageHeight = myDocument.DocumentPreferences.PageHeight myPageWidth = myDocument.DocumentPreferences.PageWidth myTop = myPage.MarginPreferences.Top myLeft = myPage.MarginPreferences.Left myRight = myPage.MarginPreferences.Right myBottom = myPage.MarginPreferences.Bottom myRight = myPageWidth - myRight myBottom = myPageHeight - myBottom myGetBounds = Array(myTop, myLeft, myBottom, myRight) End Function 2. Save the text as a plain text file with the file extension .vbs 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.