No Disk error & MountedDisks
Jay Madren
JaysLists at triad.rr.com
Tue Sep 21 12:14:58 EDT 2004
Using the dir command from the command prompt (shell) will not cause a popup
error, it will only return an error message in the command window. So you
could build a list of valid drives with something like this:
set the hideConsoleWindows to true
put empty into fld ValidDrives
repeat for each char x in "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
put shell("dir " & x & ":\") into output
if output contains "The device is not ready" \
or output contains "The system cannot find the path" \
or output contains "path was not found" then
next repeat
else
put x & ":" & return after fld ValidDrives
end if
end repeat
Note that if you have a lot of mapped drives or other drives that are slow
to respond, this may take more than a couple of seconds. Of course, you
could limit which drives you are going to test. For instance, the usually
floppy drives A: and B: will take the longest.
Also note that this, as written, only works on NT/2K/XP. Win9x also returns
a command-prompt-only error, but it's a different error and it waits for a
response (Abort, Retry, etc.). So you'll probably have to use process
instead of shell so you can respond to the error, or maybe just kill the
process. I have access to a Win98 machine if you need the error messages,
or to test some code, but it'll have to be a standalone because Rev is not
installed on that machine.
Hope this helps,
Jay Madren
-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com]On Behalf Of
FlexibleLearning at aol.com
Sent: Tuesday, September 21, 2004 08:36
To: use-revolution at lists.runrev.com
Subject: RE: No Disk error & MountedDisks
Thank you, Xavier. This returns my two mounted hard disks, but not
removables.
Any other pointers?
/H
> Alternatively, has anyone got a 'MountedDisks' function for
> Windows that would return the equivalent list as 'the
> volumes' on a Mac?
Shell("Net share") or "net use" will list all mounted shares.
Also "subst" can be used. Very practical for ultra long paths.
To list the drives (physical) you have to use srvinfo from the
Reskit...
Cheers
Xavier
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list