check for a CD
Derek Bump
runrev at dreamscapesoftware.com
Thu Jan 24 14:35:13 EST 2008
Hello Chris,
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.
I 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/
Chris Sheffield wrote:
> I would think this has to be a common problem, so I'm wondering how the
> rest of you have gotten around it.
>
> The single-user version of our software comes with media content on a
> series of CDs. Things have been working pretty well, except in a case
> where a user might have more than one CD drive (we're talking Windows
> only here). I have written a routine that scans through each available
> drive looking for our CD. The problem is, if there is no CD in the
> drive(s) at all, a "no disk" error, generated by Windows, pops up. This
> error will appear for each drive that does not have a CD in it. My
> question is, is there some way to suppress this error? I'm simply using
> a "if there is a file" type of check to determine if our CD is in one of
> the drives. Is there some other method available to me? A command line
> utility perhaps?
>
> Any suggestions would be appreciated.
>
> Thanks,
> Chris
>
>
> --
> Chris Sheffield
> Read Naturally, Inc.
> www.readnaturally.com
>
> _______________________________________________
> 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