Using library with multiple scripts

Just a yes/no question (I think):

Can a library be loaded by a script when it is already being loaded by another one?
Or will I get a ‘file is open’ error?

The scripts are being run by Hazel upon appearance of specific labels.
There’s a possibility for 2 of those labels to appear at the same time (as far as Hazel is concerned).
So Hazel will run the 2 scripts.

Does the one which “gets there first” get sole access to the library?
Will the other script wait, or fail?


I see no problems in this until you store the script. A loaded scripts properties wont be saved unless you explicitly do so with the store script command. Therefore your script library file is only open for a short moment, and that is during the time it is loaded into your script object. The file is then closed. But as it was open for reading, there will be no conflict between scripts/applets/applications that has the same script file (like any other file) open for reading at the same time.

When you are starting to having libraries open from several scripts at once, it would be timely to think about using a script server. Very useful information about these creatures can be found here. -And some of these principles can also be used to create a scriptable applet.

Best Regards