SD8: Script Libraries

Script libraries, introduced partly as an alternative when the ability to use third-party scripting additions was removed, have since grown in popularity. They’re convenient and easy to use, and a also a great way to break up code.

For more widespread use, the convenience is greatest when libraries include their own dictionaries. Script Debugger has displayed these dictionaries like any other, and when you open a script bundle file, it looks to see if it has a dictionary, in which case it gives you the choice of opening either the script or the dictionary.

Script Debugger 8 takes this support further. Along with the Running, Recent and Favorites sections in the Dictionary window sidebar, Dictionary Explorer, and related submenus such as Paste Tell, there is now also a Libraries section. (The All section has been renamed All Apps, to make the distinction clear.)

The Libraries section will list script libraries with terminology dictionaries found in ~/Library/Script Libraries and /Library/Script Libraries, and within application bundles in /Applications, ~/Applications, and ~/Library/Script Libraries. The libraries will be shown with icons that reflect their location, similar to those used in the Manifest window.

The entries will also appear in the Recent section after being viewed, and can be added to Favorites. The list will be updated instantly as libraries are added, deleted, or edited.

When a script library is selected in the Dictionary window, the Paste Tell toolbar item will change its name to Paste Code. Clicking it will insert a use statement for the library. The contextual menu will also differ from that of applications: there will be options to paste a use statement, and to open the file as a script for editing.

Control-clicking on a command in a script library’s dictionary will allow you to paste a command prototype, plus a use statement if required.

For extra convenience, script library version numbers will appear in the Dictionary window’s title.

In the Dictionary inspector in the Inspector’s tab, you can explore and search script library dictionaries just like application dictionaries. The search options include a Used Libraries category, which will search any libraries used by the script, including any embedded within the document’s bundle.

The library picker, which displays a list of available script libraries if you press escape while the cursor is within the name in a use script statement, is also now more context aware: if the use statement declares no property name for the library, only libraries with terminology will appear in the list.

Also, the Build & Exports dialog lets you specify that any used script libraries found in ~/Library/Script Libraries should be copied into the bundle of an exported applet, and converted to run-only if you require. So you can develop with script libraries in your Library folder, and have them automatically added to applets at the last minute.

1 Like