Finding a specific Windows volume

Derek Bump runrev at dreamscapesoftware.com
Mon Feb 4 13:17:45 CST 2008


Richard,

It sounds to me like you are running into the same basic problems that 
another user was a while back.  I posted the following solution which 
avoids the errors with locating files on Windows while avoiding disk 
errors and system dialogs...

-- Snip --

My solution to the same problem is to check for a volume serial number 
first, then if there is one, check for the file I'm looking for.  You 
can do this with the following function...

function GetVolumeSN pDiskLetter
   local volumeSerialNumber
   -- Supports both "C", "C:" and "C:\" styles
   put char 1 of pDiskLetter & ":" into pDisk
   set the hideConsoleWindows to true
   put shell("dir " & pDisk) into tDirData
   get matchText(tDirData,"Volume Serial Number is 
(.*)\n",volumeSerialNumber)
   if it is true then
     return volumeSerialNumber
   else
     return empty
   end if
end GetVolumeSN

If the function returns a Serial Number, I know a disk is located at 
that drive letter.  I then do my "if there is a file..." stuff.  If the 
function returns nothing (empty) then I know there is no disk in the 
drive and I don't check it.

This seems to avoid the whole "no disc" error in Windows XP SP2.  I 
don't know about other versions... you'll have to test it out.

-- End Snip --

This function was confirmed to work on Vista.  But unless you can 
specify what errors you are getting, there's not much else I can 
suggest.  Hope that helps.


Derek Bump
Dreamscape Software
http://www.dreamscapesoftware.com

___________________________________________________________________
Compress your photos quickly and easily with JPEGCompress 2.9!
http://www.dreamscapesoftware.com/products/jpegcompress/


Richard Miller wrote:
> I'm looking for suggestions on how to find out if a specific USB 
> camcorder is attached to a users computer (Windows only), and if it is, 
> which volume identifies it. If the camcorder is attached, there will be 
> a specific directory on it which I can use to help identify it.
> 
> Let's say I am looking for a folder called "DCIM" on an attached USB 
> drive. Doing this on Windows Vista causes all kinds of problems.
> 
> repeat with i = number of lines of the volumes down to 1
>    if there is a folder (line i of the volumes & "/DCIM) then
>       put true into foundit
>       exit repeat
>    end if
> end repeat
> 
> I'm looking for a better solution.
> 
> Thanks.
> Richard Miller
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 



More information about the use-livecode mailing list