Language Guide
CHAPTER 7
Control Statements
216 Considering and Ignoring Statements
ignoring punctuation
if "this !,:book" = "this book" then
(* additional statements *)
end if
end ignoring
NOTES
The case, white space, diacriticals, hyphens, expansion, and
punctuation considerations apply only to comparisons performed by
AppleScript. Comparisons are performed by AppleScript if the first operand
in the comparison is a value in a script; if the first operand is a reference
to an application or system object, the comparison is performed by the
application or operating system.
In contrast, the application responses consideration applies only to
application commands. AppleScript commands, scripting additions, and
AppleScript expressions are not affected.
As with all other control statements, you can nest Considering and Ignoring
statements. If the same attribute appears in both an outer and inner statement,
the attribute specified in the inner statement takes precedence. For example, in
the following statement, the first comparison is true, because case attribute is
ignored (as specified in the Ignoring statement), while the second comparison
is false, because the case attribute is once again considered (as specified in
the inner Considering statement).
ignoring case and punctuation
if "This" = "this" then beep 1 --true
considering case
if "This" = "this" then beep 2 --false
end considering
end considering
When attributes in an inner Considering or Ignoring statement are different
from those in outer statements, they are added to the attributes to be
considered and ignored. For example, in the following statement, the
first comparison is false, because only case is ignored, while the second
comparison is true, because both case and white space are ignored.