Read Me First
What's ModuleLoader ?
ModuleLoader is a system for managing and loading libraries(modules) of AppleScript.
In OS X 10.9, built-in support of libraries was introduced to AppleScript, which called as "AppleScript Libraries". ModuleLoader is a yet another library system, which has been developed from 2006 before release of OS X 10.9, and has been maintained without interruption until now.
ModuleLoader have similar functions to "AppleScript Libraries" as follows.
In OS X 10.9 or later, AppleScript Libraries will be first choice to work with libraries. "AppleScript Libraries" will be sufficient in usual tasks. But ModuleLoader can work with "AppleScript Libraries" and complement following missing functions of "AppleScript Libraries".
- All libraries can be loaded and embeded at compile time.
- Loading all libraries when compiling a script causes removing dependencies on libraries and ModuleLoader.osax. The script can works other computers in which the libraries and ModuleLoader.osax are not installed.
- Libraries can be forced to reload anytime.
- AppleScript text source file (.applescript) , applets and droplets can be libraries.
- Arbitrary locations can be added into locations to search for libraries.
- ModuleLoader has high flexibility to customize locations to search for libraries.
Requirements
System
- OS X 10.9 or later
- Developed and tested on macOS 10.14.6
How to Display Help
The manual consisted of the reference generated by AppleScriptDoc and sample code is stored in the bundle of "ModuleLoader.scptd". After installation of OpenHelpBook.scptd, run "ModuleLoader" from Script menu.
The detail manual of "ModuleLoader" should be displayed in Help Viewer.
Install
Copy ModuleLoader.scptd into either following locations.
Your Home/Library/Script Libraries/
or
/Library/Script Libraries/
History
- 4.0.5 -- 2020-04-26
- 4.0.4 -- 2020-04-23
- Fixed occasional crashes when a version specification for a library includes an inequality sign.
- 4.0.3 -- 2020-03-02
- 4.0.2 -- 2020-02-26
- 4.0.1 -- 2020-02-25
- Fixed : error when a script using AppleScripObjC loads a library using AppleScriptObjC.
- Support OSA_LIBRARY_PATH enviroment variable.
- 4.0 -- 2020-02-03
- Reimplemented as an AppleScript Library and a background application, because scripting additions don't work on macOS 10.4 or later.
- Syntaxes are changed :
- property ModuleName : module → property ModuleName : "@module"
- boot (module loader) for me → script "ModuleLoader"'s setup(me)
- See the manual for detailes.
- 3.0.2 -- 2017-04-19
- Fixed : incorrect library will be loaded.
- Library names are found by perfect matching instead of bacword matching.
- 3.0.1 -- 2016-12-16
- Fixed problems for woking with AppleScriptObjC.
- If the launched path of a local loader applet is under /private/var/folders/, an error will raise. Because it is considered that the local loader applet is affected by Gatekeeper Path Randomization.
- 3.0 -- 2016-08-23
- Added ability to interpolate with AppleScript Libraries.
- Added "Script Libraries" folders (~/Libraries/Script Libraries and /Libraries /Script Libraries) into the locations to search for libraries.
- ModuleLoader can interpret 'use LibName : script "LibName"' statement and load the library.
- If a library has "module loaded by" event handler, the handler must have a returned value. The returned value is treated as a loaded library.
- Modernized source code.
- Mac OS X 10.7 or later is required.
- Added code signing.
- 2.3.4 -- 2016-02-05
- Compiled with Garbage Collection support.
- Small fixes.
- 2.3.3 -- 2011-10-08
- 2.3.2 -- 2011-10-07
- 2.3.1 -- 2011-10-03
- Fixed : .applescript files can not be loaded.
- 2.3 -- 2011-09-13
- Function to specify the version of the module to be loaded.
- 2.2.4 -- 2011-03-05
- Fixed errors in osacompile of Mac OS X 10.6
- Added Local Loader options of "collecting modules" and "only local".
- 2.2.3 -- 2010-11-21
- Fixed errors on Mac OS X 10.4.
- 2.2.2 -- 2010-08-27
- 2.2.1 -- 2010-08-18
- Fixed an error of a local loader on Mac OS X 10.6 (Thanks to hiRaoka-san).
- Improved English manual (Thanks to Ed Stockly).
- 2.2 -- 2010-05-25
- .applescript files could be loaded as modules.
- Following handlers of loader object were added/documented.
- load
- set_additional_paths
- prepend_paths
- module_paths
- clear_cache
- 2.1.1 -- 2010-01-15
- Fixed a problem that a script file which does not have a type code can not be loaded.
- 2.1 -- 2010-01-12
- Introduced new module loading scheme.
- "make loader" command is renamed to "module loader".
- 2.0 -- 2009-11-25
- Reimplemented as a scripting addition.
- 1.3.3 -- 2009-03-11
- Fix an error when loading a module of which parent is a returned value of proxy().
- 1.3.2 -- 2007.09.15
- Performance is improved.
- HelpBook.osax is contained in own bundle. Additional install is not required .
- 1.3.1 -- 2007.05.14