I’m relatively new to AppleScript but have decades of experience with other object-oriented languages. I’ve been trying to get more knowledgeable with script bundles in order to package my code, but wanting to automate the packaging I looked to osacompile, which can create a scptd file from the .applescript source files I specify. So far, so good.
I’ve run into the problem of how to refer to other scripts, in particular a “super class” that my other script objects would declare as a parent. I’m keen to keep each script definition in its own file. So the child or subclasses would need to, I think, have a ‘use script “ParentObject”’ statement at the top, before the “property parent: ParentObject” statement. It seems like osacompile doesn’t or can’t figure out my script object dependencies from a given list of files.
Today I saw something briefly on loading a script object. Not sure if that’s the way forward. Can anyone help me better understand how to go about bundling an hierarchical object-oriented code base as a scptd bundle, and the mechanics of getting the code to compile without manual intervention like, the sometimes suggested, “just drag-n-drop your scripts into the Script Editor resource drawer”.
One other related question, because there just seems to be almost no obvious official documentation on this, is how to use MyBundle.scptd/Contents/Resources/Scripts folder? Is it purely for drag n drop usage? osacompile just mashes all input files into a main.scpt.
Even if you can suggest somewhere I can find more info on using these features. Even books I see selling for £70+ don’t seem to approach this topic of a collection of single object .applescript files that implement inheritance between them, bundled using osacompile.