Could not save changes to the script "xyz.app" (?!

I’ve got a compiled script application that runs great when run in script editor, and also when double-clicked. So far, so good.

In the double-click execution, as it’s ending it displays a dialog:

Could not save changes to the script “xyz.app” because of a scripting system (OSA) error. (-1750)

I checked, -1750 is a “General Error”
The user/group/chmod all look fine.
I tried copy/pasting the code to a new file.

Has anyone ever seen this before? Any idea what would trigger the save and/or prevent it from being successful?

Thanks.

Error number -1750 is a “Scripting component error.” on my machine.

When a script is run from a file, any properties, globals, or top level (run handler) variables it has are saved back into the file along with their values. The variables then have those values next time the script’s run.

It may be that when your script finishes, one or more of its variables has a very large value - such as a large chunk of text, or a huge list or record structure. Trying to save this back into the file will cause a problem if it occupies enough bytes.

If that’s what’s causing your error, you can get round it by making the variables local - either by explicitly declaring them as locals or putting that portion of the script into a handler. This way, they’re not saved back into the script. If they have to be global for some reason, you can have the script set them to something smaller just before it finishes:

set EncyclopaediaBritannica to ""
-- End of Script

If that doesn’t cure the problem, the only other thing I can think of is that the file may be locked or have the permission problems.

I explicitly cleared the globals and… problem solved!

Bless you Nigel!