I can't save my main script library as .scpt

My main library script (not posting script as it’s rather large, currently 7,270 lines) stopped saving as a .scpt or .scptd. (or .app) It compiles fine, it saves fine as a .applescript.

I copied and pasted all the code into a new document. Then trying to save from Script Debugger as .scptd, I get the error:

Trying the same thing from Script Editor, I get:

Trying to save it as .scpt from Script Debugger, I got the exact same thing, except the error number at the end is -2147450879.

I’m trying to review to see what has been changed since the last time it did save successfully.

In the meantime, any ideas here about what could cause something like this?

I faced such behavior some years ago and its was a problem of size of the package.
May you try to split your library into two packages ?

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 7 février 2020 21:20:59

That occured to me, but our biggest script is 512 KB and 9051 lines, this one’s 7,270 lines and only 323 KB. But maybe the limit here isn’t based on lines or KB, but some limit on the number of certain types of commands or something.

I chopped it around the middle and made it two scripts, and each saved successfully.

So either you’re correct that it’s simply gotten too big, or else the problem is something that involves a combination of elements, not a single line or command or something.

We’ve been meaning to divide up the library anyway because it’s too big, it’s just that that’s a PITA project, changing all the references to the commands we pull out into another library.

Thanks Yvan,

t.spoon

Of course, the count of lines isn’t the unique parameter.
The length of lines matters too as well as the number of characters.

Recently Shane Stanley urged me to make a deep cleaning upon a library which is only 1454 lines long and a total of 55830 characters.
Given its experience with such tools, I will do the job as soon as I can.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 7 février 2020 21:48:53

It certainly isn’t based on lines or KB – although lines can be used as a very rough metric.

You might find the discussion here useful:

https://forum.latenightsw.com/t/commenting-in-sd-dash-marks-vs/2211/10

Thanks, Shane. That’s an interesting thread.

We’ll have to pare it down, move functions to other libraries.

Ugh. I can’t decide if it’s worth the headache to write a script that will find and change all the references in all the other scripts, or just do a search and go through them all by hand. For each function we move.