The Choose Item scripting addition allows you to choose an AppleScript list item from a dialog box like the one illustrated below.STYL
<PARAPARA
]BtTEXT
.PARAPARA
hPARAPARA
]BpTEXT
"Figure 1. A Choose Item dialog boxSTYL
FORM
.PARAPARA
<PARAPARA
]BlTEXT
PARAPARA
]@xPICT
?373d
<PARAPARA
PARAPARA
jA scripting addition is a command that is added to the AppleScript language as an extension. To install Choose Item, copy the "Choose Item" file into the Scripting Additions folder, which is located in the Extensions folder in your System folder. For more information about Scripting Additions, refer to the "AppleScript Language Guide" from Apple Computer, Inc.STYL
<PARAPARA
LPARAPARA
SYNTAXSTYL
<PARAPARA
PARAPARA
7 choose item choiceList [ with prompt promptString ]
4FORM
PARAPARA
9 [ in order sortOrder ] [ default item defaultString ]
6FORM
<PARAPARA
PPARAPARA
PARAMETERSSTYL
<PARAPARA
\PARAPARA
choiceList
.PARAPARA
tPARAPARA
-The list of items to be proposed to the user.
RPARAPARA
Class: List of stringsSTYL
.PARAPARA
<PARAPARA
^PARAPARA
promptString
.PARAPARA
PARAPARA
The title that is displayed in the dialog box. If you omit the with
prompt parameter, the string "Choose an item:" is displayed.STYL
JFORM
.PARAPARA
JPARAPARA
Class: String
\PARAPARA
Default Value: "Choose an item:"STYL
.PARAPARA
<PARAPARA
ZPARAPARA
sortOrderSTYL
.PARAPARA
PARAPARA
The sorting order that is used to sort the items in the dialog box. If you omit the in
order parameter, the items are not sorted.
\FORM
PARAPARA
@Class: Enumerated. Possible values are Ascending and Descending.STYL
?FORM
VPARAPARA
Default Value: no sorting
.PARAPARA
<PARAPARA
]BXTEXT
^PARAPARA
]BTTEXT
defaultStringSTYL
.PARAPARA
PARAPARA
]BPTEXT
CThe item string that is first selected when the dialog box appears.
PARAPARA
]BDTEXT
BIf defaultString is not in choiceList, it is appended to the list.STYL
%FORM
JPARAPARA
]B@TEXT
Class: String.STYL
\PARAPARA
]B<TEXT
Default Value: no item selected
.PARAPARA
$PARAPARA
BPARAPARA
]B8TEXT
RESULTSTYL
<PARAPARA
vPARAPARA
9 The result is the text of the item selected by the user.
<PARAPARA
DPARAPARA
EXAMPLESSTYL
<PARAPARA
PARAPARA
T choose item {"Black","Yellow","Green","Blue","Red"} with prompt "Choose a color:"
fPARAPARA
) in order Ascending default item "Black"
\PARAPARA
set color of myObject to resultSTYL
<PARAPARA
BPARAPARA
ERRORSSTYL
<PARAPARA
nPARAPARA
]B\TEXT
2 -1700 "Can't change <expression> into a <class>."STYL
PARAPARA
A One of the choiceList items could not be displayed as a string.
pPARAPARA
3 -108 "Not enough memory to perform the operation."