XPreferences is an AppleScript Library to help saving and loading settings(preferences) of an AppleScript application.
Because AppleScript applications (droplets, applets and script files) can keep values in properties after the termination of the execution, properties can be used to store settings. But values of properties will be initialized when the script is recompiled to fix bugs or to implement new functions.
Therefore, even in the case of AppleScript, it is useful to save settings in an external file.
XPreferences help to load and save a user defined script object to store settings (preferences script object) into "~/Library/Preferences" folder.
Also XPreferences support to update the preferences script object. When your AppleScript application is updated and the specification of the preferences script object is changed, XPreferences help to move values from old preferences script object to new one. (see Update preferences script object )
To allow to update preference script object (e.g. adding new settings), the preference script object has a "version" property and "update" method.
If the default preferences script object passed to set_default_prefs has "version" property and its value is greather than the value of the "version" property of loaded preferences script object, preferences script object will be updated with following steps.
Set a default preferences as a script object.
Set a file name of a preference file.
Load saved prefereces script object.
Save the preferences script object stored in XPreferences into a file.
Save a script object as a preferences script object into a file.
Obtain current preferences script object stored in XPreferences.