I have a large number of scripts I’ve written to perform creation of and delivery of commercial spots to TV stations. Most of these scripts I save as applications so I can dunmore that one of them at a time. After a period of time, the applications fail to run, crashing with a SIGSEVG error. Sometimes a reopen lets the script application run. Sometimes it doesn’t. When that happens, I open the source, and re-export the script as a run-only application.
Today, I tried to run one of these applications and it crashed immediately. So I opened the source, exported a Run Only application and tried to run it. It crashed immediately.
So what has happened that I can no longer save this script as an application?
It runs fine when executed within Script Debugger.
Just guessing. Do your scripts store ASObjC values in persistent variables? Do they build large lists in persistent variables and not clear them before quitting? (A persistent variable is a property, a global, or a variable set in a run handler without being explicitly declared local.)
Any variable in a run handler that’s not explicitly declared local is persistent. In the ordinary handlers above, cnt and Y are local by default and therefore non-persistent (unless declared global or as properties at the top of the script, of course). I don’t remember offhand what the situation is with open and idle handlers. Possibly the same as with run handlers.
I don’t think so. Only in scripts that are actually run.
Persistence itself isn’t necessarily a problem. Only if the variables contain huge list values or ASObjC pointers, which can’t be saved back to the script file. And I’m only guessing at this as a possible cause of the trouble you’re having.