Adobe 27510753 Scripting Guide - Page 165

you put into the document uses those defaults, and any existing text remains unchanged.

Page 165 highlights

Adobe InDesign CS2 Scripting Guide Working with Documents in VBScript 157 Use the same property to apply a master spread to a master spread page: Rem ApplyMasterToMaster.vbs Rem An InDesign CS2 VBScript Rem Applies a master page to a master page. Rem Assumes that the default master spread name is "A-Master". Set myInDesign = CreateObject("InDesign.Application.CS2") Set myDocument = myInDesign.Documents.Add Rem Create a new master spread. Set myBMaster = myDocument.MasterSpreads.Add myBMaster.NamePrefix = "B" myBMaster.BaseName = "Master" Rem Apply master spread "A" to the first page of the new master spread. myInDesign.ActiveDocument.MasterSpreads.Item("B-Master").Pages.Item(1).AppliedMaster = myInDesign. ActiveDocument.MasterSpreads.Item("A-Master") Setting text-formatting defaults You can set the default text-formatting attributes for your application or for individual documents. If you set the text-formatting defaults for the application, they become the defaults for all new documents-existing documents remain unchanged. When you set the text-formatting defaults for a document, any new text that you put into the document uses those defaults, and any existing text remains unchanged. Setting application text defaults To set the text-formatting defaults for your application: Rem ApplicationTextDefaults.vbs Rem An InDesign CS2 VBScript Rem Sets the application text defaults, which will become the text formatting Rem defaults for all new documents. Existing documents will remain unchanged. Set myInDesign = CreateObject("InDesign.Application.CS2") With myInDesign.TextDefaults .AlignToBaseline = True Rem The following settings have a chance of generating Rem errors when the specific fonts, font styles, and/or Rem languages are not installed on your system. Disable Rem error handling to skip any errors. On Error Resume Next .AppliedFont = myInDesign.Fonts.Item("Minion Pro") .FontStyle = "Normal" .AppliedLanguage = "English: USA" Rem Reinstate normal error handling. On Error GoTo 0 .AutoLeading = 100 .BalanceRaggedLines = False .BaselineShift = 0 .Capitalization = idCapitalization.idNormal .Composer = "Adobe Paragraph Composer" .DesiredGlyphScaling = 100 .DesiredLetterSpacing = 0 .DesiredWordSpacing = 100 .DropCapCharacters = 0 Rem If DropCapCharacters = 0, then trying to set the DropCapLines Rem property will generate an error. If .DropCapCharacters 0 Then .DropCapLines = 3 Rem Assumes that the application has a default Rem character style named "myDropCap" .DropCapStyle = myInDesign.CharacterStyles.Item("myDropCap") End If .FillColor = myInDesign.Colors.Item("Black") .FillTint = 100

  • 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

Adobe
InDesign CS2 Scripting Guide
Working with Documents in VBScript
157
Use the same property to apply a master spread to a master spread page:
Rem ApplyMasterToMaster.vbs
Rem An InDesign CS2 VBScript
Rem Applies a master page to a master page.
Rem Assumes that the default master spread name is "A-Master".
Set myInDesign = CreateObject("InDesign.Application.CS2")
Set myDocument = myInDesign.Documents.Add
Rem Create a new master spread.
Set myBMaster = myDocument.MasterSpreads.Add
myBMaster.NamePrefix = "B"
myBMaster.BaseName = "Master"
Rem Apply master spread "A" to the first page of the new master spread.
myInDesign.ActiveDocument.MasterSpreads.Item("B-Master").Pages.Item(1).AppliedMaster = myInDesign.
ActiveDocument.MasterSpreads.Item("A-Master")
Setting text-formatting defaults
You can set the default text-formatting attributes for your application or for individual documents. If you set
the text-formatting defaults for the application, they become the defaults for all new documents—existing
documents remain unchanged. When you set the text-formatting defaults for a document, any new text that
you put into the document uses those defaults, and any existing text remains unchanged.
Setting application text defaults
To set the text-formatting defaults for your application:
Rem ApplicationTextDefaults.vbs
Rem An InDesign CS2 VBScript
Rem Sets the application text defaults, which will become the text formatting
Rem defaults for all new documents. Existing documents will remain unchanged.
Set myInDesign = CreateObject("InDesign.Application.CS2")
With myInDesign.TextDefaults
.AlignToBaseline = True
Rem The following settings have a chance of generating
Rem errors when the specific fonts, font styles, and/or
Rem languages are not installed on your system. Disable
Rem error handling to skip any errors.
On Error Resume Next
.AppliedFont = myInDesign.Fonts.Item("Minion Pro")
.FontStyle = "Normal"
.AppliedLanguage = "English: USA"
Rem Reinstate normal error handling.
On Error GoTo 0
.AutoLeading = 100
.BalanceRaggedLines = False
.BaselineShift = 0
.Capitalization = idCapitalization.idNormal
.Composer = "Adobe Paragraph Composer"
.DesiredGlyphScaling = 100
.DesiredLetterSpacing = 0
.DesiredWordSpacing = 100
.DropCapCharacters = 0
Rem If DropCapCharacters = 0, then trying to set the DropCapLines
Rem property will generate an error.
If .DropCapCharacters <> 0 Then
.DropCapLines = 3
Rem Assumes that the application has a default
Rem character style named "myDropCap"
.DropCapStyle = myInDesign.CharacterStyles.Item("myDropCap")
End If
.FillColor = myInDesign.Colors.Item("Black")
.FillTint = 100