Adobe 27510753 Scripting Guide - Page 164

To apply a master spread to a document use the, property of the document AppliedMaster

Page 164 highlights

156 Working with Documents in VBScript Adobe InDesign CS2 Scripting Guide Rem Set up the first master spread in a new document. Set myDocument = myInDesign.Documents.Add Rem Set up the document. With myDocument.DocumentPreferences .PageHeight = "11i" .PageWidth = "8.5i" .FacingPages = True .PageOrientation = idPageOrientation.idPortrait End With Rem Set the document's ruler origin to page origin. This is very important Rem --if you don't do this, getting objects to the correct position on the Rem page is much more difficult. myDocument.ViewPreferences.RulerOrigin = idRulerOrigin.idPageOrigin With myDocument.MasterSpreads.Item(1) Rem Set up the left page (verso). With .Pages.Item(1) With .MarginPreferences .ColumnCount = 3 .ColumnGutter = "1p" .Bottom = "6p" Rem "left" means inside "right" means outside. .Left = "6p" .Right = "4p" .Top = "4p" End With Rem Add a simple footer with a section number and page number. With .TextFrames.Add .GeometricBounds = Array("61p", "4p", "62p", "45p") .InsertionPoints.Item(1).Contents = idSpecialCharacters.idSectionMarker .InsertionPoints.Item(1).Contents = idSpecialCharacters.idEmSpace .InsertionPoints.Item(1).Contents = idSpecialCharacters.idAutoPageNumber .Paragraphs.Item(1).Justification = idJustification.idLeftAlign End With End With Rem Set up the right page (recto). With .Pages.Item(2) With .MarginPreferences .ColumnCount = 3 .ColumnGutter = "1p" .Bottom = "6p" Rem "left" means inside "right" means outside. .Left = "6p" .Right = "4p" .Top = "4p" End With Rem Add a simple footer with a section number and page number. With .TextFrames.Add .GeometricBounds = Array("61p", "6p", "62p", "47p") .InsertionPoints.Item(1).Contents = idSpecialCharacters.idAutoPageNumber .InsertionPoints.Item(1).Contents = idSpecialCharacters.idEmSpace .InsertionPoints.Item(1).Contents = idSpecialCharacters.idSectionMarker .Paragraphs.Item(1).Justification = idJustification.idRightAlign End With End With End With To apply a master spread to a document page, use the AppliedMaster property of the document page: Rem ApplyMaster.vbs Rem An InDesign CS2 VBScript Rem Applies a master spread to a page. Set myInDesign = CreateObject("InDesign.Application.CS2") Rem Assumes that the active document has a master page named "B-Master" Rem and at least two pages. myInDesign.ActiveDocument.Pages.Item(2).AppliedMaster = myInDesign.ActiveDocument.MasterSpreads. Item("B-Master")

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184

156
Working with Documents in VBScript
Adobe InDesign CS2 Scripting Guide
Rem Set up the first master spread in a new document.
Set myDocument = myInDesign.Documents.Add
Rem Set up the document.
With myDocument.DocumentPreferences
.PageHeight = "11i"
.PageWidth = "8.5i"
.FacingPages = True
.PageOrientation = idPageOrientation.idPortrait
End With
Rem Set the document’s ruler origin to page origin. This is very important
Rem --if you don’t do this, getting objects to the correct position on the
Rem page is much more difficult.
myDocument.ViewPreferences.RulerOrigin = idRulerOrigin.idPageOrigin
With myDocument.MasterSpreads.Item(1)
Rem Set up the left page (verso).
With .Pages.Item(1)
With .MarginPreferences
.ColumnCount = 3
.ColumnGutter = "1p"
.Bottom = "6p"
Rem "left" means inside "right" means outside.
.Left = "6p"
.Right = "4p"
.Top = "4p"
End With
Rem Add a simple footer with a section number and page number.
With .TextFrames.Add
.GeometricBounds = Array("61p", "4p", "62p", "45p")
.InsertionPoints.Item(1).Contents = idSpecialCharacters.idSectionMarker
.InsertionPoints.Item(1).Contents = idSpecialCharacters.idEmSpace
.InsertionPoints.Item(1).Contents = idSpecialCharacters.idAutoPageNumber
.Paragraphs.Item(1).Justification = idJustification.idLeftAlign
End With
End With
Rem Set up the right page (recto).
With .Pages.Item(2)
With .MarginPreferences
.ColumnCount = 3
.ColumnGutter = "1p"
.Bottom = "6p"
Rem "left" means inside "right" means outside.
.Left = "6p"
.Right = "4p"
.Top = "4p"
End With
Rem Add a simple footer with a section number and page number.
With .TextFrames.Add
.GeometricBounds = Array("61p", "6p", "62p", "47p")
.InsertionPoints.Item(1).Contents = idSpecialCharacters.idAutoPageNumber
.InsertionPoints.Item(1).Contents = idSpecialCharacters.idEmSpace
.InsertionPoints.Item(1).Contents = idSpecialCharacters.idSectionMarker
.Paragraphs.Item(1).Justification = idJustification.idRightAlign
End With
End With
End With
To apply a master spread to a document page, use the
AppliedMaster
property of the document page:
Rem ApplyMaster.vbs
Rem An InDesign CS2 VBScript
Rem Applies a master spread to a page.
Set myInDesign = CreateObject("InDesign.Application.CS2")
Rem Assumes that the active document has a master page named "B-Master"
Rem and at least two pages.
myInDesign.ActiveDocument.Pages.Item(2).AppliedMaster = myInDesign.ActiveDocument.MasterSpreads.
Item("B-Master")