Subroutine Call, Labeled Parameters
A subroutine call for a subroutine with labeled parameters lists parameters other than the direct parameter in any order, using the labels in the subroutine definition to identify the parameter values.SYNTAX
subroutineName å [ [ of | in ] directParameter ] å [ [ subroutineParamLabel parameterValue ] å | [ with labelForTrueParam [, labelForTrueParam ]...å [ ( and | or | , ) labelForTrueParam ] ] å | [ without labelForFalseParam [, labelForFalseParam ]...]å [ ( and | or | , ) labelForFalseParam ] ] å | [ given label:parameterValue å [, label:parameterValue ]...] ]...wheresubroutineName (an identifier) is the name of the subroutine.
directParameter is the direct parameter, if one is included in the subroutine definition. It can be any valid expression. As in application commands, the direct parameter must be first if it is included at all.
subroutineParamLabel is one of the following labels used in the definition of
the subroutine:above,against,apart from,around,aside from,at,below,beneath,beside,between,by,for,from,instead of,into,on,onto,out of,over,thru(orthrough),under.parameterValue is the value of a parameter, which can be any valid expression.
labelForTrueParam is the label for a Boolean parameter whose value is
true. You use this form in With clauses; because the valuetrueis implied by the word With, you provide only the label, not the value. (For an example of how to use a With clause, see page 233.) If you useoror a comma instead ofandwith the last parameter of awithclause, AppleScript changes theofor the comma toandduring compilation.labelForFalseParam is the label for a Boolean parameter whose value is
false. You use this form in Without clauses; because the valuefalseis implied
by the word Without, you provide only the label, not the value. If you useoror a comma instead ofandwith the last parameter of awithoutclause, AppleScript changes theoror the comma toandduring compilation.label is any parameter label used in the definition of the subroutine that is not among the labels for subroutineParamLabel. You must use the special label
givento specify these parameters. (For an example, see "Examples" later in this section.)If you use
oror a comma instead ofandwith the last parameter of awithclause, AppleScript changes theoror the comma toandduring compiling.NOTES
A subroutine call must include all the parameters specified in the subroutine definition. There is no way to specify optional parameters.When calling a subroutine, you can list any parameter-value pairs except
the direct parameter after the labelgiven, not just the parameters that were specified that way in the subroutine definition. For example, the following
two calls to thesearchFilessubroutine described in the next section are interchangeable.
searchFiles of {"March Expenses", "April Expenses"} for å "Le Chateau" searchFiles of {"March Expenses", "April Expenses"} å given for:"Le Chateau"With the exception of the direct parameter, which must directly follow the subroutine name, labeled parameters can appear in any order. This includes parameters listed in Given, With, and Without clauses. Furthermore, you can include any number of Given, With, and Without clauses in a subroutine call.
Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help