Creating a More Complex User Interface. Adobe CS5 InDesign
Διαφήμιση
Διαφήμιση
C
HAPTER
7: User Interfaces
Creating a More Complex User Interface 121 on myMakeDocument(myPointSize, myString) tell application "Adobe InDesign CS5" set myDocument to make document tell view preferences of myDocument end tell tell page 1 of myDocument
--Create a text frame.
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
--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 end myMakeDocument
Creating a More Complex User Interface
In the next example, we add more controls and different types of controls to the sample dialog box. The example creates a dialog box that resembles the following:
For the complete script, see ComplexUI.
set myDialog to make dialog
--This example dialog box uses border panels and dialog columns to
--separate and organize the user interface items in the dialog.
tell myDialog set name to "User Interface Example Script" set myDialogColumn to make dialog column tell myDialogColumn set myBorderPanel to make border panel tell myBorderPanel set myDialogColumn to make dialog column tell myDialogColumn make static text with properties {static label:"Message:"} end tell set myDialogColumn to make dialog column tell myDialogColumn set myTextEditField to make text editbox with properties
{edit contents:"Hello World!", min width:180} end tell end tell set myBorderPanel to make border panel tell myBorderPanel set myDialogColumn to make dialog column
C
HAPTER
7: User Interfaces
Creating a More Complex User Interface 122 tell myDialogColumn make static text with properties {static label:"Point Size:"} end tell set myDialogColumn to make dialog column tell myDialogColumn set myPointSizeField to make measurement editbox with properties {edit value:72, edit units:points} end tell end tell set myBorderPanel to make border panel tell myBorderPanel set myDialogColumn to make dialog column 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 end tell set myResult to show myDialog if myResult is true then
--Get the settings from the dialog box.
--Get the point size from the point size field.
set myPointSize to edit value of myPointSizeField
--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
Λήψη
Διαφήμιση