Retrieving drive letters and paths on a CD using client side VBScript 
Author Message
 Retrieving drive letters and paths on a CD using client side VBScript

I'm posting this in the hope that someone finds this useful - if you
do, please email me with any comments / suggestions...

I recently had a problem where I needed to access a database on a CD
using just client side VBScript, but I needed the full path to the
database for ADO to find it.  I find a solution by using the following
code....

function GetDriveLetter(byval dURL)
        dim x
        x = instr(1,lcase(dURL),"file:///")
        if x > 0 then
                dURL = replace(lcase(dURL),"file:///","")   'remove file part of line
                GetDriveLetter = left(dURL,2)
        end if
end function

function GetPath(byval pURL)
        dim x
        x = instr(1,lcase(pURL),"file:///")
        if x > 0 then
                pURL = replace(lcase(pURL),"file:///","")   'remove file part of line
                x = instrrev(pURL,"/")
                GetPath = left(pURL,x)
        end if
end function

The functions will return the full path (or just the drive letter) of
the current page, and are designed with file urls in mind.  If a
normal HTTP url is entered, they will return nothing.  The idea should
also work in JavaScript, and if you'd like the same examples in
Javascript, let me know.

Shaun



Tue, 03 Aug 2004 18:13:36 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Retrieving drive letter for user's cd-rom drive

2. How to retrieve the CD DRIVE Letter

3. How to retrieve the CD DRIVE Letter

4. Getting UNC path using drive letter

5. Retrieving client side date settings using toLocalestring function

6. Newby: Determine CD-ROM drive letter

7. Change CD-ROM Drive Letter

8. Set/Change CD-ROM drive letter with VBS

9. CD-Rom Drive Letter

10. Change CD-ROM Drive Letter

11. Cannot retrieve form values from client-side vbscript

12. App.Path command in VBScript Client Side

 

 
Powered by phpBB® Forum Software