DekGenius.com
Team LiB   Previous Section   Next Section

Chapter 9. Script Objects and Libraries

A script object is a template or class from which you can create AppleScript objects. Objects are self-contained script code that can have their own properties, methods, and variables. See Chapter 1, for details on using objects in AppleScript.

When a script object is created in memory, that object is considered an instance (in object-oriented parlance) or copy of the template on which the object was based. The script object can be a collection of properties, a group of methods defined together (as a library, which is discussed in the section "Libraries"), or a bunch of properties, methods, and statements that comprise a single object. Script objects can inherit the properties and methods of a parent object simply by defining a parent property at the top of the script:

prop parent : MyParent

MyParent in this case is a variable that refers to another script object.

In summary, script objects represent a limited form of object-oriented programming in AppleScript. Considering that you can define objects and libraries on one machine, and create new instances of those objects or call methods in the library on another machine that shares a TCP/IP network, what you can achieve with AppleScript objects is limited only by the breadth of your imagination. This exciting new form of distributed computing on the Mac is called "program linking via IP".

    Team LiB   Previous Section   Next Section