12.8. Summary

In this chapter, you learned how to work with script objects. In particular, the following key points were covered:

  • A script object is defined by encapsulating one or more statements within a compound script statement.

  • When the script object is defined, any properties defined within the script object are initialized.

  • A script?s properties are only initialized once when the script is defined and not when it is run.

  • Your entire program is a script object, and thus it can define its own properties at the topmost level. Those properties are initialized once and are only reinitialized if the program is modified and recompiled.

  • A script that has been saved as an application stores it properties within the application. Those property values persist through repeated executions of the program.

  • Scripts behave like lists and records when they are assigned or passed as arguments to handlers. The set command just makes a new reference to a scrip object; the copy command makes a new copy of the current script object.

  • A handler can define and return a script object.

  • A script object can contain handler definitions.

  • A script can inherit properties and handlers from its parent; it can also override properties and handlers inherited from the parent script.

  • A script can be stored in a file using the store script command. A script stored in a file can be run using the run script command and loaded into your program using the load script command.

  • A handler or property defined in a parent can be ...

Get Beginning AppleScript® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.