Home Forums General XMetaL Discussion Application can’t Shut Down – Unknown script Running. Reply To: Application can’t Shut Down – Unknown script Running.

Derek Read

Reply to: Application can’t Shut Down – Unknown script Running.

This issue is very likely intimately related to the customization you are loading for the documents in question. I would recommend attempting to debug any scripts that are loaded as a first step. Scripts that may be loaded will be in the following files (where < and > indicate variable values as described):

macrosxmetal.mcr
macrosmacros.mcr
macros.mcr
startup*.mcr.mcr.ctm
Rules.ctm

Or in the MCR or CTM file contained within the XAC file being loaded.

In most cases these types of errors will arise when you instantiate an ActiveX control and then fail to force it to “null” at the first possible logical point in your scripts or during XMetaL Author shutdown (in JScript you set the variable originally declared =null, in VBScript you set it =nothing.

In theory the Windows Script Host (the engine that drives JScript and VBScript) is supposed to do regular cleanup of these types of things (garbage collection). In actual practice the timing of this cleanup may not occur before a user attempts to shut down XMetaL Author, or it just might not be possible for the engine to know what to do. In either case any outstanding references to such objects are detected by XMetaL Author (it asks the scripting engine if stuff is still going on or not and basically just gets a yes or no reply and decides if it can shut down or not, hence the message). This may occur all the time for some users, or it may never occur, or it may appear to be random (this is the nature of the automatic cleanup being done by the particular engine, which might also be PerlScript, Python or anything else for which you have an engine installed).

Unfortunately, in my experience, it is often the case that unless you are conscious of this and write your code to always cleanup these things when they are no longer needed they are hard to detect later (in a project of any significant size) due to that strange quirk of Murphy's Law where bugs in script will tend to happen only after deployment when users (authors) are using your scripts and that they often tend to stay hidden for developers. So, first off, my recommendation is to hunt down every declaration of any ActiveX object in any of the files above and make sure your code also forcefully cleans them up.

Reply

Products
Downloads
Support