Bad script crashes Animate Pro on startup

If you create a script and declare a variable such as:

var path = scene.currentProjectPathRemapped();

outside of a class or function, it will prevent Animate from opening any scene at all because it crashes with an error similar to:

The following error occurred in line 1 of test while executing the script:
Error. Use of undefined variable 'scene’

It can be fixed by deleting C:\Users[USER]\AppData\Roaming\Toon Boom Animation\Toon Boom Animate Pro\790-scripts\script.qsa but none of the scripts that you created will be available. Trying to open script.qsa in notepad++ shows NUL for every other character so retrieving scripts is very difficult.

It was a custom script. A good way to demonstrate it is to create a script with only

var path = scene.currentProjectPathRemapped();

in it. The script error message will pop up and Animate will crash before it can load the scene. I’ve tried it with Pro and PLE, opening the executable directly and with the launcer, on a couple computers and the result is the same. The only way to make Animate load again is to delete script.qsa and start over.

That’s too bad. I guess it’s a good idea to backup our custom scripts once in a while by exporting them as text files.

I wonder if you could change the name of the bad script.qsa and then open AP to reload the default ones and then do an import script. You would go and get that bad script.qsa and fix it. It’s worth a try I guess.

I hadn’t thought of that actually but it wouldn’t surprise me if you could. I will have to give that a try.

Did you just create a new script or did you edit one of the existing scripts? There are some scripts that are used during scene preparation, to create default networks and the such. If you edit these scripts, then something like this could happen.

If you just create your own script with an undefined variable, though, usually it will let you open your scene, but it will pop a warning letting you know that you have to go take a look at that script. It shouldn’t interfere with you being able to open the scene and work with it.