Language Guide

CHAPTER 7
Control Statements
If Statements 193
If (Compound Statement) 7
A compound If statement contains one or more Boolean expressions and
groups of statements to be executed if the value of the corresponding Boolean
expression is true.
SYNTAX
if Boolean [ then ]
[ statement ]...
[ else if Boolean [ then ]
[ statement ]...]...
[ else
[ statement ]...]
end [ if ]
where
Boolean is an expression whose value is true or false.
statement is any AppleScript statement.
EXAMPLE
In the following If statement, the statements that copy an individual’s status
report to the end of a department status report are executed only if the date is
March 1, 1993.
if Current Date = "March 1, 1993"
tell application "Scriptable Text Editor"
open file "Status Report"
set myStatus to text from paragraph 1 to
paragraph 10 of document"Status Report"
close document "Status Report"
open file "Department Status"
copy myStatus to end of document "Department Status"
close document "Department Status"
end tell
end if