Here’s what you learned in this Chapter:
AppleScript makes applications perform tasks by sending them Apple event messages.
AppleScript is a programming language designed with everyday users in mind, but with enough power for advanced users and programmers.
Many AppleScript terms come from the applications it controls. AppleScript terms also come from files called scripting additions.
Use the Script Editor application to create, edit, and run AppleScript scripts. Script Editor can also make scripts into applications.
Script Editor can display the AppleScript dictionary of an application to see what commands an application or scripting addition understands and what objects the commands work with.
You can save a script in any of three formats: text, compiled script, or Application.
You type AppleScript statements into a new Script Editor window, check the syntax for errors using the compile button, and run the script to test it. Your script can use a copy statement to set the value of a variable. To start controlling an application, you use a tell application statement. A matching end tell statement stops controlling the application. With if statements, you can have AppleScript perform some operations only when specified conditions are met. Repeat loops execute a group of statements over and over. To make a drag-and-drop script application, you include an on open statement and a matching end open statement.
Apple has developed a number of scripts that you can use as starting points or models for your own scripts.
You can use Script Runner or Script Menu to run compiled scripts no matter what application is currently active.
AppleScript can control applications over a network or the Internet on computers that are set to allow remote Apple events.