Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting existing file with VBscript and HTML Document.write

Status
Not open for further replies.

boonsp

Programmer
Jul 17, 2005
4
BE
Detecting existing file with VBscript and HTML Document.write

I am doing something wrong, but I think it's possible. It's about detecting EWH32.API from adobe so I can detect the webbrowser plugin.

Code
-----

function detectEWH32(DriveID,name) {
//
// By Peter Boons - Belgium
// ------------------------
// C:\Program Files\Adobe\Acrobat 6.0\Reader\plug_ins ------ // C:\Program Files\Adobe\Acrobat 7.0\Reader\plug_ins ------ Test 16 July 2005 Virtual PC Mac Windows 2000 SP4 Rollup 1
//
// Detect vanaf Version 6.0 betekent dat PDF geopend wordt in Browser window bij Internet Explorer.
//
result = false;
document.write('<script language=\"VBScript\"\>\n');
document.write('On Error Resume Next\n');
document.write('dim filesys\n');
document.write('Set filesys = CreateObject("Scripting.FileSystemObject")\n');
document.write('If filesys.FileExists("' + DriveID + ':\\Program Files\\Adobe\\Acrobat 7.0\\Reader\\plug_ins\\ewh32.api") then result=true\n');
document.write('</script\>\n');
if (result) return name+','; else return '';
}

I think my problems has todo with the '\'-backslash ...
Can somebody help

Peter
 
Seems you have a JavaScript function (detectEWH32) that write some VBScript code without execute it ...
Why not using the fso directly in your JS code ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
You mean such a script ? I don't know what you say by " that write some VBScript code without execute it ..." ? What I'm missing there ?

So this is a Javascript one, schould work ... ? Only by calling this function, the main function who's detecting other plugins (what normally work) crashes, means nothing was detected at all.

function detectEWH32(DriveID,name) {
var result = false;
var fso = new ActiveXObject("Scripting.FileSystemObject");
if (fso.FileExists(DriveID+":\\Program Files\\Adobe\\Acrobat 7.0\\Reader\\plug_ins\\ewh32.api")) result = true;
if (result) return name+','; else return '';
}

When remarking everything out (except begin and ending of functions with results). And step by step un-remarking, The new ActiveXObject will blok other functions ... I don't know why ?

Peter
 
The new ActiveXObject will blok other functions ... I don't know why ?
A security issue ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
var fso;
fso = Server.CreateObject("Scripting.FileSystemObject")
//For JavaScript or JScript.
var fso;
fso = new ActiveXObject("Scripting.FileSystemObject")
//For JavaScript or JScript.

What's the difference between both above: Server.CreateObject and Active X
 
Server.CreateObject
It's asp server side.
fso = new ActiveXObject("Scripting.FileSystemObject")
It's client side.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
>>>>>> The new ActiveXObject will blok other functions ... I don't know why ? A security issue ?

IE blocked ActiveXObject calls. So I can turn it of.
BUt how can I detect it's on or Off, so it won't block my whole script/webpage ? Cause the subscript (aka function()) returns nothing.

Is there a Try command in Javascript, so it jumps through an error machnisme ?

Peter

Note: The code works fine.
 
Sure there is.
[tt]
try {
//instructions
} catch (e) {
//some other instruction if error occurred
}
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top