Explicit ActiveXObject deletion
-
Wednesday, February 15, 2012 4:08 PM
Hi,
I'm writing a JScript that opens an xml document using an ActiveXObject Microsoft.XMLDOM. And as I understand it, JScript uses auto-garbage collection, so that all dynamically allocated objects are deleted on script exit. The thing is, I am running this JScript from the Windows Speech Recognition Macros (WSR Macros) application environment.
My code runs fine the first time, but when I rerun the WSR macro, it either tells me "The process cannot access the file because it is being used by another process", or if I run with a different request, the dom document keeps the previous request data.
I am thinking that this might be because WSR Macros application might not interface with the .NET JScript parser/engine correctly (I have a very limited understanding of the .NET framework). Possibly because it does not handle script exiting particularly well?
My question is, is there a way to explicitly delete (or reinitialise to null/empty) an ActiveXObject (dom object) in JScript.
<script language="JScript">
<![CDATA[
// Variables
var guard_xml_doc;
var load_ok;
Application.Speak("One moment");
// Create dom document, load and parse xml
guard_xml_doc = new ActiveXObject("Microsoft.XMLDOM");
guard_xml_doc.async = false;
load_ok = guard_xml_doc.load("C:\\Users\\Dr Mac\\Documents\\My
Apps\\guard_fp_tagout.xml");
if (load_ok != true)
{
Application.Speak("Load Failed");
Command.Exit();
}
]]>
</script>
Any help would be greatly appreciated, thnx, Bruce.
All Replies
-
Monday, March 12, 2012 6:29 AM
Hi,
Please check the following reference, hope could make some help,
http://stackoverflow.com/questions/3628424/freeing-javascripts-activexobject
Regards

