Scripting reference
The AppleScript dictionary
Example script