

As with the scripts you used with the Finder, note that this script is a tell statement containing the necessary two elements: a reference to the targeted objects (in this case the open browser windows) and the action to be performed (close).

Tell application "Safari" to close every windowĪny open browser windows in the Safari application are immediately closed. After it has finished starting up, enter, compile, and run the following script in a new script window in Script Editor. In a new Finder window, navigate to your Applications folder, and launch the Safari application. Let’s see whether that statement is indeed true. As stated earlier in this chapter, the principles used in those scripts apply to all scriptable applications, not just the Finder application. In learning to apply these principles, you wrote scripts to control the appearance of Finder windows in the Finder application by accessing and changing the values of their properties and by using standard verbs, such as close and open, to control their display. The values of the properties of scriptable objects can be read and sometimes altered.Scriptable objects can also contain other scriptable objects that also have properties with corresponding values.Scriptable objects have properties with corresponding values.These principles include the following essential concepts: In this chapter, you’ve been introduced to the fundamental principles and structures of the AppleScript language.
