View Single Post
Old 01-11-2013, 11:48 PM   PM User | #14
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Since this is for windows, there is a much easier way if you are willing to use MSIE only:
Code:
function findDriveThatIsPlaying( )
{
    var drives = "BDEFGHIJKLMNOPQRSTUVWXYZ";
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    for ( var d = 0; d < drives.length; ++d )
    {
        var driveletter = drives[d];
        if ( fso.FileExists( driveletter + ":\\drive.js" ) )
        {
            document.cookie="yourdrive="+driveletter+"; path=/";
            return driveletter;
        }
    }
    // if you get here, no "drive.js" found on any drive
    // what do you want to do???
    return null;
}
I think that *HAS* to be *MUCH* faster than trying to get JavaScript to load a file and run it.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.

Last edited by Old Pedant; 01-11-2013 at 11:52 PM..
Old Pedant is offline   Reply With Quote
Users who have thanked Old Pedant for this post:
tpeck (01-12-2013)