PDA

View Full Version : conflict between ActiveX Objects


steevy
09-30-2002, 07:48 PM
Hi,

I've got an HTA file, in which I have to insert some illustrations in vectorial format CGM.
To this purpose, I use controleActiveX like this (IE):
<P ALIGN=center>
<OBJECT WIDTH="500" HEIGHT="400"
CODETYPE = "image/cgm"
CLASSID="CLSID:F5D98C43-DB16-11CF-8ECA-0000C0FD59C7">
<PARAM NAME="FileName" VALUE="T1-1.cgm">
</OBJECT>

I've got also a script linked to this page loaded via function window.onload() that must scan the current repertory and make some thing (build an XML file with the name of each of them), like this:
function window.onload() {
var fs = new ActiveXObject("Scripting.FileSystemObject");
var folder = fs.getFolder("nomenclature");
var xmlDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
var e, fileObject, fileElement, title, nom, text;
var folderElement = xmlDoc.createElement("repertoire");
xmlDoc.appendChild(folderElement);
e = new Enumerator(folder.files);

for (;!e.atEnd();e.moveNext())
...

Problem: the second lign (var fs= new ActiveXObject("Scripting.fileSystemObject") generates the following error:
Can't Access File Adress
When I don't load the first controle ActiveX, this second ActiveX Object runs well.

So what can I do so that they can't enter in conflict ?

Thanks a lot for your answer,
Steevy.

glenngv
10-01-2002, 10:32 AM
you must specify full path

window.onload() = function(){
var fs = new ActiveXObject("Scripting.FileSystemObject");
var folder = fs.getFolder("c:\\nomenclature");
var xmlDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
var e, fileObject, fileElement, title, nom, text;
var folderElement = xmlDoc.createElement("repertoire");
xmlDoc.appendChild(folderElement);
e = new Enumerator(folder.files);

//...

}

function window.onload() works with IE though this is not the proper way. anyway since it's an HTA app it supposed to work with IE only. But I still prefer the right way :)