Statements

    Every script is a series of statements. Each statement consists of a command and may contain additional information needed to perform the command.

    Statements can be simple, such as this one-line command:

    tell application "Finder" to activate

    Statements are usually complex, containing more than one statement. The following example includes several statements.

    Show me a compound statement.

    When you run a script, each statement is executed in order. However, some statements can control the order in which statements are executed, as in the next example.

    Show me a control statement.

    This example includes two control statements:
    The Tell statement controls which object receives the other statements. In this case, the Finder application is the object.
    The If statement controls whether or not the second Set command is executed. It's only executed if it's true that the variable "item_comments" is empty.

 


Table of contents