Making an AppleScript library
-
When you compile a handler or several handlers in an AppleScript terminal (by selecting them then pressing ⌘R) they get loaded into Smile's context: they become available to all the scripts running in Smile. A text document containing only handlers and declarations (properties, global variables) is what is called an AppleScript library or, in this context, a library.
-
After you bring some change to a library, compiling the modified handler(s) replaces the old version with the new one in Smile's context.
Installing an AppleScript library
-
Instead of compiling manually a library you can install it so that its handlers be automatically available: move the library into the Context additions folder, located at:
/Users/<login>/Library/Application Support/Smile/Class Scripts/Context additions
-
The libraries in Context additions get compiled and loaded when you launch Smile.
-
If Smile detects an error while compiling a library at launch time, it will display the error message in the Message floating window. If you see such a message, open the library and compile it manually to see where the error occurred. (In such case, you may want to visit the Troubleshooting page.)
Dynamically loading an AppleScript library
-
To compile and load a library by script, use add library.
add library the_library_file
This will make the handlers contained in the_library_file available, not only to the calling script, but also to any script running in Smile.
|