B.7. Compound Statements

A compound statement is one that encloses a block of statements and is terminated by an end statement. In the case of the if and tell, you can also use one-line versions of these statements.

B.7.1. considering

General Format

considering attributeList
    programStatements
end considering

attributeList consists of one or more attributes from the following table. Multiple attributes are comma- separated, with the last one preceded by and, as in considering case, diacriticals, and expansion. You can also add a but ignoring clause.

AttributeMeaningDefault
caseupper and lower case lettersIgnored
diacriticalsdiacritical (accent) marksConsidered
expansionligatures (æ, Æ, œ, Œ)Considered
hyphensA hyphen (dash) characterConsidered
punctuationThe characters . , ? : ; ! \ ' " `Considered
white spacespace, tab, return and newline characterConsidered

A considering application responses block can be used inside an ignoring application responses block to wait for events sent to applications to respond.

B.7.2. if

General Format 1

if booleanExpression then programStatement

General Format 2

if booleanExpression then
    programStatements
end if

General Format 3

if booleanExpression then
    programStatements
else
    programStatements
end if

General Format 4

if booleanExpression  then
    programStatements
else if booleanExpression then
    programStatements
   ...
else if booleanExpression then
    programStatements
else
    programStatements
end if

B.7.3. ignoring

General Format 1

ignorimg attributeList
    

Get Beginning AppleScript® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.