Adobe 27510753 Scripting Guide - Page 169
Adobe, InDesign CS2 Scripting Guide, If Err.Number <> 0 Then
UPC - 718659445294
View all Adobe 27510753 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 169 highlights
Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 161 Rem Creates a document template, including master pages, layers, Rem a color, paragraph and character styles, guides, and XMP information. Set myInDesign = CreateObject("InDesign.Application.CS2") Rem Set the application measurement unit defaults to points. myInDesign.ViewPreferences.HorizontalMeasurementUnits = idMeasurementUnits.idPoints myInDesign.ViewPreferences.VerticalMeasurementUnits = idMeasurementUnits.idPoints Rem Set the application default margin preferences. With myInDesign.MarginPreferences Rem Save the current application default margin preferences. myY1 = .Top myX1 = .Left myY2 = .Bottom myX2 = .Right Rem Set the application default margin preferences. Rem Document baseline grid will be based on 14 points, and Rem all margins are set in increments of 14 points. .Top = 14 * 4 .Left = 14 * 4 .Bottom = 74 .Right = 14 * 5 End With Rem Make a new document. Set myDocument = myInDesign.Documents.Add myDocument.DocumentPreferences.PageWidth = "7i" myDocument.DocumentPreferences.PageHeight = "9i" myDocument.DocumentPreferences.PageOrientation = idPageOrientation.idPortrait Rem At this point, we can reset the application default margins Rem to their original state. With myInDesign.MarginPreferences .Top = myY1 .Left = myX1 .Bottom = myY2 .Right = myX2 End With Rem Set up the bleed and slug areas. With myDocument.DocumentPreferences Rem Bleed .DocumentBleedBottomOffset = "3p" .DocumentBleedTopOffset = "3p" .DocumentBleedInsideOrLeftOffset = "3p" .DocumentBleedOutsideOrRightOffset = "3p" Rem Slug .SlugBottomOffset = "18p" .SlugTopOffset = "3p" .SlugInsideOrLeftOffset = "3p" .SlugRightOrOutsideOffset = "3p" End With Rem Create a color. Err.Clear On Error Resume Next Rem If the color does not already exist, InDesign will generate an error. Set myColor = myDocument.Colors.Item("PageNumberRed") If Err.Number 0 Then Set myColor = myDocument.Colors.Add myColor.Name = "PageNumberRed" myColor.colorModel = idColorModel.idProcess myColor.ColorValue = Array(20, 100, 80, 10) Err.Clear End If Rem restore normal error handling On Error GoTo 0 Rem Next, set up some default styles. Rem Create up a character style for the page numbers. Err.Clear On Error Resume Next Rem If the character style does not already exist, InDesign will generate an error. Set myCharacterStyle = myDocument.CharacterStyles.Item("page_number") If Err.Number 0 Then