Although my script works fine when run from a SCPT file within Script Debugger, when I save it as a .app file and try to run it on other “El Capitan”-equipped Macs. I get error
"Can’t get script “Number_functions_lib2”
which is the first library defined by Use statement in the script.
I can run the .app version on my development computer.
My understanding is that the library code is supposed to be embedded in the .app file.
However, it looks like the .app I created in Script Debugger 6.01 is expecting to see the library files on other hosts, which is not practical
If you want to embed a script library in an applet, you need to embed it yourself. Go to the Resources Pane and control-click in the Resources area, and choose New Folder. Rename the folder Script Libraries. Now drag your library file to this folder.
If you go to Script Debugger’s Help menu and choose Show AppleScript Language Guide, you can look up the section Script Libraries for details of how AppleScript searches for script libraries.
The Resources Pane did permit one to add embedded libraries - but that was in Script Debugger 5.
In Script Debugger 6, “this feature is superseded by AppleScript’s own library scripts”, according to the “Where are the libraries?” Script Debugger Help entry.
I have been struggling to rewrite my script with “Use” and “Property” statements to tell the compiler where my libraries are located. The problem is still as stated. When I create an .app file, it does not appear to know where my libraries reside.
In a previous post, I described how I set the environment variable OSA_LIBRARY_PATH in an environment.plist file. This variable permits storing libraries in non-default locations and tells the compiler where to look.
This can all be done from within the Script Debugger UI. You can create the Script Libraries folder by right-clicking in an empty area of the Resources table, and select New Folder from the resulting contextual menu. Name the new folder Script Libraries. You can then drag libraries from the Finder into the the Script Libraries folder you’ve created in Script Debugger.
Or, you can do as you describe, and reveal the contents of the script app and manipulate the Resources folder using the Finder.
I added to this thread because we solved the problem in APP but something has changed so that it does not recognize libraries in SCPT.
When I loaded the original SCPT file in Script Debugger 6.0.3, any attempt to compile results in
"AppleScript Compile Error - Can’t get script “Number_functions_lib2”
When I look in the Resources window, it is empty. If I load the last APP version of the file, I see all the Libraries referenced properly in the Resources Window.
How do I get the SCPT to recognize the libraries? When I right-click on the empty Resources pane, the menu shows:
Paste, Font, Spelling and Grammar, Substitutions, Transformation, Speech and Layout Orientation.
What is does not show is “New Folder”
This problem has brought my development to a halt.
I don’t want to embed the library scripts; i just want them recognized so I can write, run and edit the script.
Apparently the Applescript compiler or the version Script Debugger 6 uses ignores OSA_LIBRARY_PATH no matter if it is installed in the environment,plist using lauchctl setenv. That was the technique that worked before, even though it required disabling SIP. I hate to use a standard location because I use revision control which cannot reach those folders, I’ve moved them to ~/library/Script Libraries for the time being, just to prove they still work. However,.this means that I cannot restore my files set to a previous point, which is one of the primary advantages of revision control.