image

Library

image

Script Debugger allows parts of a script to be kept in a separate, secondary compiled script file called a library. With a library, your scripts can easily make use of common code. If the code in the library changes, scripts that use the library inherit the changed code automatically when they are compiled.

Working With Libraries

To work with libraries:

The libraries pane appears at the right of the script window.

image

To add a library file to your script:

To remove a library file from your script:

To determine the reference style for locating a library file in future:

The way a file is listed to show its path in the libraries pane changes depending on your choice in the Relative To pop-up.

To examine or edit a library file:

Technical Facts About Libraries

The Script Debugger Libraries mechanism may remind you of the AppleScript load script command, but it has several advantages over load script:

Here is some further technical discussion about how the Libraries feature works.

Flattening

A script that uses Script Debugger’s library feature will run in other contexts — the library resources are invisibly merged into the script when the script is saved, in a way that AppleScript understands — but it cannot be edited except by Script Debugger.

In order to distribute to others a script which uses libraries, in a form that can be edited with any script editor application, you will want to flatten the script. This means that the contents of all library files on which the script depends are visibly incorporated into the contents of the script itself.

To flatten a script:

Further Details:
  Technical Details About Libraries


image
Description Manifest
image