Use Script Libraries in App Bundles

My understanding was that, if a script library could not be found in ~/Library/Script Libraries/, or /Library/Script Libraries/, or some other similar paths (not necessarily in that order), that it would eventually (perhaps as a last resort) look to see if the script library is in any of the app bundles in the user’s Applications folder. But this doesn’t seem to be working for me.

I have a machine separate from my development machine that I keep free of dev stuff and use for testing. It’s the machine that I use for my day job but I also deliberately keep it free of dev stuff so that it is a good proxy for what my users’ first run experience will be like and so I use it for testing pre-release builds.

But I’ve run into an issue with some compiled scrips that use a script library that is bundled with one or more applets that I have installed in the Applications folder on the test machine. The scripts won’t compile or run and throw an error that the script library can’t be found. Any reason why that might be happening? It’s not expected behaviour, right?

I don’t have any libraries in ~/Library/Script Libraries/ on the test machine so that, as mentioned, it better approximates an average user’s machine. The compiled scripts I’m trying to run on the test machine are usually just for some kind of testing or one off type purpose.

Why not deploy a script bundle you ask? I’ve actually had an issue (possibly related, possibly unrelated) with a script bundle that also had a similar issue, but I plan to address that in a separate post as it’s been a while since I’ve tested that aspect and it might be a separate issue. For now just assume that I don’t want to use a script bundle if I can get away with just using the version of the script library that is already bundled with another applet.

Have you launched the app containing the libs on the target Mac at some stage?

Yes, I have. Sorry, should have mentioned that.

What is the path to the library in the app’s container?

The applet was created with Script Debugger 8 with the automatically add used script libraries feature, so it’s /Contents/Resources/Script Libraries/LIBRARY_NAME.scpt.

It is in more than one applet in my Applications folder, if that makes a difference. It’s also run only as I have the setting enabled to export used libraries as run only.

That’s the path you use to make a script library available to the app itself. To make it available system-wide, it needs to be in /Contents/Library/Script Libraries/. You will have to add that folder yourself, and add the library manually.

Ahh, makes sense. Thanks for pointing that out – I had missed that important bit.

Would it work if I made /Contents/Library/Script Libraries/ an alias to /Contents/Resources/Script Libraries/ or vice-verser? And by “alias” I mean sim link.

You tell me. (Only trying it will answer the question for sure.)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.