Adobe 27510753 Scripting Guide - Page 42

tell application Adobe InDesign CS2, set myParagraphAlignment to right align

Page 42 highlights

34 Getting Started with InDesign Scripting Adobe InDesign CS2 Scripting Guide tell myDialogColumn make static text with properties {static label:"Vertical Justification:"} end tell set myDialogColumn to make dialog column tell myDialogColumn set myVerticalJustificationMenu to make dropdown with properties ¬ {string list:{"Top", "Center", "Bottom"}, selected index:0} end tell end tell set myBorderPanel to make border panel tell myBorderPanel make static text with properties {static label:"Paragraph Alignment:"} set myParagraphAlignmentGroup to make radiobutton group tell myParagraphAlignmentGroup set myLeftRadioButton to make radiobutton control with properties ¬ {static label:"Left", checked state:true} set myCenterRadioButton to make radiobutton control with properties ¬ {static label:"Center"} set myRightRadioButton to make radiobutton control with properties ¬ {static label:"Right"} end tell end tell end tell show --Get the settings from the dialog box. --Get the point size from the point size field. set myPointSize to edit contents of myPointSizeField as real --Get the example text from the text edit field. set myString to edit contents of myTextEditField --Get the vertical justification setting from the pop-up menu. if selected index of myVerticalJustificationMenu is 0 then set myVerticalJustification to top align else if selected index of myVerticalJustificationMenu is 1 then set myVerticalJustification to center align else set myVerticalJustification to bottom align end if --Get the paragraph alignment setting from the radiobutton group. get properties of myParagraphAlignmentGroup if selected button of myParagraphAlignmentGroup is 0 then set myParagraphAlignment to left align else if selected button of myParagraphAlignmentGroup is 1 then set myParagraphAlignment to center align else set myParagraphAlignment to right align end if --Remove the dialog box from memory. destroy myDialog end tell tell page 1 of myDocument set myTextFrame to make text frame set geometric bounds of myTextFrame to my myGetBounds(myDocument, page 1 of myDocument) --Apply the settings from the dialog box to the text frame. set contents of myTextFrame to myString --Apply the vertical justification setting. set vertical justification of text frame preferences of myTextFrame to ¬ myVerticalJustification --Apply the paragraph alignment ("justification"). --"text 1 of myTextFrame" is all of the text in the text frame. set justification of text 1 of myTextFrame to myParagraphAlignment --Set the point size of the text in the text frame. set point size of text 1 of myTextFrame to myPointSize end tell end tell on myGetBounds(myDocument, myPage) tell application "Adobe InDesign CS2" set myPageHeight to page height of document preferences of myDocument set myPageWidth to page width of document preferences of myDocument

  • 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

34
Getting Started with InDesign Scripting
Adobe InDesign CS2 Scripting Guide
tell myDialogColumn
make static text with properties {static label:"Vertical Justification:"}
end tell
set myDialogColumn to make dialog column
tell myDialogColumn
set myVerticalJustificationMenu to make dropdown with properties
¬
{string list:{"Top", "Center", "Bottom"}, selected index:0}
end tell
end tell
set myBorderPanel to make border panel
tell myBorderPanel
make static text with properties {static label:"Paragraph Alignment:"}
set myParagraphAlignmentGroup to make radiobutton group
tell myParagraphAlignmentGroup
set myLeftRadioButton to make radiobutton control with properties
¬
{static label:"Left", checked state:true}
set myCenterRadioButton to make radiobutton control with properties
¬
{static label:"Center"}
set myRightRadioButton to make radiobutton control with properties
¬
{static label:"Right"}
end tell
end tell
end tell
show
--Get the settings from the dialog box.
--Get the point size from the point size field.
set myPointSize to edit contents of myPointSizeField as real
--Get the example text from the text edit field.
set myString to edit contents of myTextEditField
--Get the vertical justification setting from the pop-up menu.
if selected index of myVerticalJustificationMenu is 0 then
set myVerticalJustification to top align
else if selected index of myVerticalJustificationMenu is 1 then
set myVerticalJustification to center align
else
set myVerticalJustification to bottom align
end if
--Get the paragraph alignment setting from the radiobutton group.
get properties of myParagraphAlignmentGroup
if selected button of myParagraphAlignmentGroup is 0 then
set myParagraphAlignment to left align
else if selected button of myParagraphAlignmentGroup is 1 then
set myParagraphAlignment to center align
else
set myParagraphAlignment to right align
end if
--Remove the dialog box from memory.
destroy myDialog
end tell
tell page 1 of myDocument
set myTextFrame to make text frame
set geometric bounds of myTextFrame to my myGetBounds(myDocument, page 1 of myDocument)
--Apply the settings from the dialog box to the text frame.
set contents of myTextFrame to myString
--Apply the vertical justification setting.
set vertical justification of text frame preferences of myTextFrame to
¬
myVerticalJustification
--Apply the paragraph alignment ("justification").
--"text 1 of myTextFrame" is all of the text in the text frame.
set justification of text 1 of myTextFrame to myParagraphAlignment
--Set the point size of the text in the text frame.
set point size of text 1 of myTextFrame to myPointSize
end tell
end tell
on myGetBounds(myDocument, myPage)
tell application "Adobe InDesign CS2"
set myPageHeight to page height of document preferences of myDocument
set myPageWidth to page width of document preferences of myDocument