Hi,

I have this little code to check if a drive exist yes or no,
but it fails on a pentablet. I get an error specifying "Drives does not
exist".
This pentablet has a drive (the server) only when it is docked (and
connected to a lan).
And this is just exactly what I want to prevent and checked if it is docked
or not
to perform some syncronisation with tables on the server.

function checkdrive
lparameters chkdrive_
o = Create('Scripting.FileSystemObject')
lreturnvalue = o.Drives(chkdrive_).IsReady
release o
return lreturnvalue

Anybody a workaround
to check when a drive exist (and is ready) ?

thanks in advance
regards
christophe
--

Re: check if drive exist by Carsten

Carsten
Mon May 09 05:13:48 CDT 2005

Christophe,

VFP has some functions looking for info on a certain media.
On my system Drive F: does not exist. These functions all returns values
without crashing:

? drivetype("F:")
? adir(laFiles, "F:\*.*" )
? directory( "F:\SomeFolder" )


Another approach could be to catch the error inside a TRY-CATCH-ENDTRY
block:

function checkdrive
lparameters chkdrive_
o = Create('Scripting.FileSystemObject')
lreturnvalue= .T.
TRY
lreturnvalue = o.Drives(chkdrive_).IsReady
CATCH
lreturnvalue= .F.
ENDTRY
release o
return

--
Cheers
Carsten
_______________________________

"christophe" <irs.znospamforme@skynet.be> schrieb im Newsbeitrag
news:O3IxuJHVFHA.2420@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I have this little code to check if a drive exist yes or no,
> but it fails on a pentablet. I get an error specifying "Drives does not
> exist".
> This pentablet has a drive (the server) only when it is docked (and
> connected to a lan).
> And this is just exactly what I want to prevent and checked if it is
docked
> or not
> to perform some syncronisation with tables on the server.
>
> function checkdrive
> lparameters chkdrive_
> o = Create('Scripting.FileSystemObject')
> lreturnvalue = o.Drives(chkdrive_).IsReady
> release o
> return lreturnvalue
>
> Anybody a workaround
> to check when a drive exist (and is ready) ?
>
> thanks in advance
> regards
> christophe
> --
>
>



Re: check if drive exist by christophe

christophe
Mon May 09 05:37:19 CDT 2005

Carsten Bonde,

Those functions looks promissing.
I will give it a try.

thanks so far
regards
christophe


--
\|||/
(o o)
----ooO-(_)-Ooo-------------


"Carsten Bonde" <bonde AT real-inkasso DOT de> schreef in bericht
news:%23kFKH$HVFHA.3280@TK2MSFTNGP09.phx.gbl...
> Christophe,
>
> VFP has some functions looking for info on a certain media.
> On my system Drive F: does not exist. These functions all returns values
> without crashing:
>
> ? drivetype("F:")
> ? adir(laFiles, "F:\*.*" )
> ? directory( "F:\SomeFolder" )
>
>
> Another approach could be to catch the error inside a TRY-CATCH-ENDTRY
> block:
>
> function checkdrive
> lparameters chkdrive_
> o = Create('Scripting.FileSystemObject')
> lreturnvalue= .T.
> TRY
> lreturnvalue = o.Drives(chkdrive_).IsReady
> CATCH
> lreturnvalue= .F.
> ENDTRY
> release o
> return
>
> --
> Cheers
> Carsten
> _______________________________
>
> "christophe" <irs.znospamforme@skynet.be> schrieb im Newsbeitrag
> news:O3IxuJHVFHA.2420@TK2MSFTNGP12.phx.gbl...
>> Hi,
>>
>> I have this little code to check if a drive exist yes or no,
>> but it fails on a pentablet. I get an error specifying "Drives does not
>> exist".
>> This pentablet has a drive (the server) only when it is docked (and
>> connected to a lan).
>> And this is just exactly what I want to prevent and checked if it is
> docked
>> or not
>> to perform some syncronisation with tables on the server.
>>
>> function checkdrive
>> lparameters chkdrive_
>> o = Create('Scripting.FileSystemObject')
>> lreturnvalue = o.Drives(chkdrive_).IsReady
>> release o
>> return lreturnvalue
>>
>> Anybody a workaround
>> to check when a drive exist (and is ready) ?
>>
>> thanks in advance
>> regards
>> christophe
>> --
>>
>>
>
>



Re: check if drive exist by Anders

Anders
Mon May 09 05:04:47 CDT 2005

DISKSPACE(cDriveLetter)
returns -1 if the drive doesn't exist or isn't ready. DiskSpace('A') will
show a messagebox if the drive is empty.
-Anders

"christophe" <irs.znospamforme@skynet.be> wrote in message
news:O3IxuJHVFHA.2420@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> I have this little code to check if a drive exist yes or no,
> but it fails on a pentablet. I get an error specifying "Drives does not
> exist".
> This pentablet has a drive (the server) only when it is docked (and
> connected to a lan).
> And this is just exactly what I want to prevent and checked if it is
docked
> or not
> to perform some syncronisation with tables on the server.
>
> function checkdrive
> lparameters chkdrive_
> o = Create('Scripting.FileSystemObject')
> lreturnvalue = o.Drives(chkdrive_).IsReady
> release o
> return lreturnvalue
>
> Anybody a workaround
> to check when a drive exist (and is ready) ?
>
> thanks in advance
> regards
> christophe
> --
>
>


Re: check if drive exist by christophe

christophe
Mon May 09 07:37:04 CDT 2005

Dag Anders,

thanks a lot
but for your information :
It worked but it's a lot slower than ADir()
when there is no connection.

regards
christophe
--
\|||/
(o o)
----ooO-(_)-Ooo-------------


"Anders Altberg" <x_pragma@telia.com> schreef in bericht
news:%23D5FcUIVFHA.2984@tk2msftngp13.phx.gbl...
> DISKSPACE(cDriveLetter)
> returns -1 if the drive doesn't exist or isn't ready. DiskSpace('A') will
> show a messagebox if the drive is empty.
> -Anders
>
> "christophe" <irs.znospamforme@skynet.be> wrote in message
> news:O3IxuJHVFHA.2420@TK2MSFTNGP12.phx.gbl...
>> Hi,
>>
>> I have this little code to check if a drive exist yes or no,
>> but it fails on a pentablet. I get an error specifying "Drives does not
>> exist".
>> This pentablet has a drive (the server) only when it is docked (and
>> connected to a lan).
>> And this is just exactly what I want to prevent and checked if it is
> docked
>> or not
>> to perform some syncronisation with tables on the server.
>>
>> function checkdrive
>> lparameters chkdrive_
>> o = Create('Scripting.FileSystemObject')
>> lreturnvalue = o.Drives(chkdrive_).IsReady
>> release o
>> return lreturnvalue
>>
>> Anybody a workaround
>> to check when a drive exist (and is ready) ?
>>
>> thanks in advance
>> regards
>> christophe
>> --
>>
>>
>



Re: check if drive exist by christophe

christophe
Mon May 09 07:47:07 CDT 2005

Just for the record...

I did some testing and came to this conclusion
ADir() : is the best and fasted
DISKSPACE(cDriveLetter) : is to slow when there is no connnection.
Drivetype() : is not reliable especially when there is a driveletter mapped
but the Lan is disconnected.
directory() : I don't like and did not test because I have to hardcode a
"somefolder".

regards
christophe
--
\|||/
(o o)
----ooO-(_)-Ooo-------------


"Carsten Bonde" <bonde AT real-inkasso DOT de> schreef in bericht
news:%23kFKH$HVFHA.3280@TK2MSFTNGP09.phx.gbl...
> Christophe,
>
> VFP has some functions looking for info on a certain media.
> On my system Drive F: does not exist. These functions all returns values
> without crashing:
>
> ? drivetype("F:")
> ? adir(laFiles, "F:\*.*" )
> ? directory( "F:\SomeFolder" )
>
>
> Another approach could be to catch the error inside a TRY-CATCH-ENDTRY
> block:
>
> function checkdrive
> lparameters chkdrive_
> o = Create('Scripting.FileSystemObject')
> lreturnvalue= .T.
> TRY
> lreturnvalue = o.Drives(chkdrive_).IsReady
> CATCH
> lreturnvalue= .F.
> ENDTRY
> release o
> return
>
> --
> Cheers
> Carsten
> _______________________________
>
> "christophe" <irs.znospamforme@skynet.be> schrieb im Newsbeitrag
> news:O3IxuJHVFHA.2420@TK2MSFTNGP12.phx.gbl...
>> Hi,
>>
>> I have this little code to check if a drive exist yes or no,
>> but it fails on a pentablet. I get an error specifying "Drives does not
>> exist".
>> This pentablet has a drive (the server) only when it is docked (and
>> connected to a lan).
>> And this is just exactly what I want to prevent and checked if it is
> docked
>> or not
>> to perform some syncronisation with tables on the server.
>>
>> function checkdrive
>> lparameters chkdrive_
>> o = Create('Scripting.FileSystemObject')
>> lreturnvalue = o.Drives(chkdrive_).IsReady
>> release o
>> return lreturnvalue
>>
>> Anybody a workaround
>> to check when a drive exist (and is ready) ?
>>
>> thanks in advance
>> regards
>> christophe
>> --
>>
>>
>
>



Re: check if drive exist by Fred

Fred
Mon May 09 10:22:37 CDT 2005

So DIRECTORY("X:\") doesn't work for you? I'd think can be pretty sure if
that one exists, the drive exists. ;)

--
Fred
Microsoft Visual FoxPro MVP


"christophe" <irs.znospamforme@skynet.be> wrote in message
news:eHiHYVJVFHA.1384@TK2MSFTNGP09.phx.gbl...
> Just for the record...
>
> I did some testing and came to this conclusion
> ADir() : is the best and fasted
> DISKSPACE(cDriveLetter) : is to slow when there is no connnection.
> Drivetype() : is not reliable especially when there is a driveletter
> mapped but the Lan is disconnected.
> directory() : I don't like and did not test because I have to hardcode a
> "somefolder".
>
> regards
> christophe
> --
> \|||/
> (o o)
> ----ooO-(_)-Ooo-------------
>
>
> "Carsten Bonde" <bonde AT real-inkasso DOT de> schreef in bericht
> news:%23kFKH$HVFHA.3280@TK2MSFTNGP09.phx.gbl...
>> Christophe,
>>
>> VFP has some functions looking for info on a certain media.
>> On my system Drive F: does not exist. These functions all returns values
>> without crashing:
>>
>> ? drivetype("F:")
>> ? adir(laFiles, "F:\*.*" )
>> ? directory( "F:\SomeFolder" )
>>
>>
>> Another approach could be to catch the error inside a TRY-CATCH-ENDTRY
>> block:
>>
>> function checkdrive
>> lparameters chkdrive_
>> o = Create('Scripting.FileSystemObject')
>> lreturnvalue= .T.
>> TRY
>> lreturnvalue = o.Drives(chkdrive_).IsReady
>> CATCH
>> lreturnvalue= .F.
>> ENDTRY
>> release o
>> return
>>
>> --
>> Cheers
>> Carsten
>> _______________________________
>>
>> "christophe" <irs.znospamforme@skynet.be> schrieb im Newsbeitrag
>> news:O3IxuJHVFHA.2420@TK2MSFTNGP12.phx.gbl...
>>> Hi,
>>>
>>> I have this little code to check if a drive exist yes or no,
>>> but it fails on a pentablet. I get an error specifying "Drives does not
>>> exist".
>>> This pentablet has a drive (the server) only when it is docked (and
>>> connected to a lan).
>>> And this is just exactly what I want to prevent and checked if it is
>> docked
>>> or not
>>> to perform some syncronisation with tables on the server.
>>>
>>> function checkdrive
>>> lparameters chkdrive_
>>> o = Create('Scripting.FileSystemObject')
>>> lreturnvalue = o.Drives(chkdrive_).IsReady
>>> release o
>>> return lreturnvalue
>>>
>>> Anybody a workaround
>>> to check when a drive exist (and is ready) ?
>>>
>>> thanks in advance
>>> regards
>>> christophe
>>> --
>>>
>>>
>>
>>
>
>



RE: check if drive exist by Leemi

Leemi
Mon May 09 10:41:07 CDT 2005

Hi Christophe:

Do these article help you?

http://support.microsoft.com/default.aspx?scid=KB;EN-US;125372
http://support.microsoft.com/default.aspx?scid=KB;EN-US;135818
http://support.microsoft.com/default.aspx?scid=KB;EN-US;193623

I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP9 HAS ARRIVED!! --*
Read about all the new features of VFP9 here:
http://msdn.microsoft.com/vfoxpro/

*--Purchase VFP 9.0 here:
http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
69-4500-8bf2-3f06689f4ab3&type=ovr

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retired Sept. 30th, 2003

> Hi,
>
> I have this little code to check if a drive exist yes or no,
> but it fails on a pentablet. I get an error specifying "Drives does not
> exist".
> This pentablet has a drive (the server) only when it is docked (and
> connected to a lan).
> And this is just exactly what I want to prevent and checked if it is
docked
> or not
> to perform some syncronisation with tables on the server.
>
> function checkdrive
> lparameters chkdrive_
> o = Create('Scripting.FileSystemObject')
> lreturnvalue = o.Drives(chkdrive_).IsReady
> release o
> return lreturnvalue
>
> Anybody a workaround
> to check when a drive exist (and is ready) ?
>
> thanks in advance
> regards
> christophe



Re: check if drive exist by christophe

christophe
Tue May 10 02:27:10 CDT 2005

hum, I didn't thought of that one
The root is ofcourse also a directory ...
but now you've mentioned it,
I did some testing and it is not reliable.
It's like Drivetype(), when there is a driveletter mapped to a drive over
the lan
and the Lan is disconnected, it still returns .t. !!

regards
christophe

--


"Fred Taylor" <ftaylor@mvps.org!REMOVE> schreef in bericht
news:exhLvrKVFHA.580@TK2MSFTNGP15.phx.gbl...
> So DIRECTORY("X:\") doesn't work for you? I'd think can be pretty sure if
> that one exists, the drive exists. ;)
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "christophe" <irs.znospamforme@skynet.be> wrote in message
> news:eHiHYVJVFHA.1384@TK2MSFTNGP09.phx.gbl...
>> Just for the record...
>>
>> I did some testing and came to this conclusion
>> ADir() : is the best and fasted
>> DISKSPACE(cDriveLetter) : is to slow when there is no connnection.
>> Drivetype() : is not reliable especially when there is a driveletter
>> mapped but the Lan is disconnected.
>> directory() : I don't like and did not test because I have to hardcode a
>> "somefolder".
>>
>> regards
>> christophe
>> --
>> \|||/
>> (o o)
>> ----ooO-(_)-Ooo-------------
>>
>>
>> "Carsten Bonde" <bonde AT real-inkasso DOT de> schreef in bericht
>> news:%23kFKH$HVFHA.3280@TK2MSFTNGP09.phx.gbl...
>>> Christophe,
>>>
>>> VFP has some functions looking for info on a certain media.
>>> On my system Drive F: does not exist. These functions all returns values
>>> without crashing:
>>>
>>> ? drivetype("F:")
>>> ? adir(laFiles, "F:\*.*" )
>>> ? directory( "F:\SomeFolder" )
>>>
>>>
>>> Another approach could be to catch the error inside a TRY-CATCH-ENDTRY
>>> block:
>>>
>>> function checkdrive
>>> lparameters chkdrive_
>>> o = Create('Scripting.FileSystemObject')
>>> lreturnvalue= .T.
>>> TRY
>>> lreturnvalue = o.Drives(chkdrive_).IsReady
>>> CATCH
>>> lreturnvalue= .F.
>>> ENDTRY
>>> release o
>>> return
>>>
>>> --
>>> Cheers
>>> Carsten
>>> _______________________________
>>>
>>> "christophe" <irs.znospamforme@skynet.be> schrieb im Newsbeitrag
>>> news:O3IxuJHVFHA.2420@TK2MSFTNGP12.phx.gbl...
>>>> Hi,
>>>>
>>>> I have this little code to check if a drive exist yes or no,
>>>> but it fails on a pentablet. I get an error specifying "Drives does
>>>> not
>>>> exist".
>>>> This pentablet has a drive (the server) only when it is docked (and
>>>> connected to a lan).
>>>> And this is just exactly what I want to prevent and checked if it is
>>> docked
>>>> or not
>>>> to perform some syncronisation with tables on the server.
>>>>
>>>> function checkdrive
>>>> lparameters chkdrive_
>>>> o = Create('Scripting.FileSystemObject')
>>>> lreturnvalue = o.Drives(chkdrive_).IsReady
>>>> release o
>>>> return lreturnvalue
>>>>
>>>> Anybody a workaround
>>>> to check when a drive exist (and is ready) ?
>>>>
>>>> thanks in advance
>>>> regards
>>>> christophe
>>>> --
>>>>
>>>>
>>>
>>>
>>
>>
>
>




Re: check if drive exist by christophe

christophe
Tue May 10 02:27:20 CDT 2005

Thanks Lee,

I did some testing and the solution that use Drivetype()
are not reliable.
(see reply Fred)
the same is with those API function.
so far for me, the best solution is ADir()

thanks
christophe
--
\|||/
(o o)
----ooO-(_)-Ooo-------------


"Lee Mitchell" <Leemi@online.microsoft.com> schreef in bericht
news:n0VxK2KVFHA.2476@TK2MSFTNGXA01.phx.gbl...
> Hi Christophe:
>
> Do these article help you?
>
> http://support.microsoft.com/default.aspx?scid=KB;EN-US;125372
> http://support.microsoft.com/default.aspx?scid=KB;EN-US;135818
> http://support.microsoft.com/default.aspx?scid=KB;EN-US;193623
>
> I hope this helps.
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> Sincerely,
> Microsoft FoxPro Technical Support
> Lee Mitchell
>
> *-- VFP9 HAS ARRIVED!! --*
> Read about all the new features of VFP9 here:
> http://msdn.microsoft.com/vfoxpro/
>
> *--Purchase VFP 9.0 here:
> http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
> 69-4500-8bf2-3f06689f4ab3&type=ovr
>
> Keep an eye on the product lifecycle for Visual FoxPro here:
> http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
> - VFP5 Mainstream Support retired June 30th, 2003
> - VFP6 Mainstream Support retired Sept. 30th, 2003
>
>> Hi,
>>
>> I have this little code to check if a drive exist yes or no,
>> but it fails on a pentablet. I get an error specifying "Drives does not
>> exist".
>> This pentablet has a drive (the server) only when it is docked (and
>> connected to a lan).
>> And this is just exactly what I want to prevent and checked if it is
> docked
>> or not
>> to perform some syncronisation with tables on the server.
>>
>> function checkdrive
>> lparameters chkdrive_
>> o = Create('Scripting.FileSystemObject')
>> lreturnvalue = o.Drives(chkdrive_).IsReady
>> release o
>> return lreturnvalue
>>
>> Anybody a workaround
>> to check when a drive exist (and is ready) ?
>>
>> thanks in advance
>> regards
>> christophe
>
>





Re: check if drive exist by Leonid

Leonid
Tue May 10 02:48:56 CDT 2005

No, it's not true. If you have mapped drive and connection is disconnected,
then DIRECTORY("X:\") returns .t., but CD "X:\" gives "Invalid path or drive
name" error

Leonid


"Fred Taylor" <ftaylor@mvps.org!REMOVE> wrote in message
news:exhLvrKVFHA.580@TK2MSFTNGP15.phx.gbl...
> So DIRECTORY("X:\") doesn't work for you? I'd think can be pretty sure if
> that one exists, the drive exists. ;)
>
> --
> Fred
> Microsoft Visual FoxPro MVP
>
>
> "christophe" <irs.znospamforme@skynet.be> wrote in message
> news:eHiHYVJVFHA.1384@TK2MSFTNGP09.phx.gbl...
>> Just for the record...
>>
>> I did some testing and came to this conclusion
>> ADir() : is the best and fasted
>> DISKSPACE(cDriveLetter) : is to slow when there is no connnection.
>> Drivetype() : is not reliable especially when there is a driveletter
>> mapped but the Lan is disconnected.
>> directory() : I don't like and did not test because I have to hardcode a
>> "somefolder".
>>
>> regards
>> christophe
>> --
>> \|||/
>> (o o)
>> ----ooO-(_)-Ooo-------------
>>
>>
>> "Carsten Bonde" <bonde AT real-inkasso DOT de> schreef in bericht
>> news:%23kFKH$HVFHA.3280@TK2MSFTNGP09.phx.gbl...
>>> Christophe,
>>>
>>> VFP has some functions looking for info on a certain media.
>>> On my system Drive F: does not exist. These functions all returns values
>>> without crashing:
>>>
>>> ? drivetype("F:")
>>> ? adir(laFiles, "F:\*.*" )
>>> ? directory( "F:\SomeFolder" )
>>>
>>>
>>> Another approach could be to catch the error inside a TRY-CATCH-ENDTRY
>>> block:
>>>
>>> function checkdrive
>>> lparameters chkdrive_
>>> o = Create('Scripting.FileSystemObject')
>>> lreturnvalue= .T.
>>> TRY
>>> lreturnvalue = o.Drives(chkdrive_).IsReady
>>> CATCH
>>> lreturnvalue= .F.
>>> ENDTRY
>>> release o
>>> return
>>>
>>> --
>>> Cheers
>>> Carsten
>>> _______________________________
>>>
>>> "christophe" <irs.znospamforme@skynet.be> schrieb im Newsbeitrag
>>> news:O3IxuJHVFHA.2420@TK2MSFTNGP12.phx.gbl...
>>>> Hi,
>>>>
>>>> I have this little code to check if a drive exist yes or no,
>>>> but it fails on a pentablet. I get an error specifying "Drives does
>>>> not
>>>> exist".
>>>> This pentablet has a drive (the server) only when it is docked (and
>>>> connected to a lan).
>>>> And this is just exactly what I want to prevent and checked if it is
>>> docked
>>>> or not
>>>> to perform some syncronisation with tables on the server.
>>>>
>>>> function checkdrive
>>>> lparameters chkdrive_
>>>> o = Create('Scripting.FileSystemObject')
>>>> lreturnvalue = o.Drives(chkdrive_).IsReady
>>>> release o
>>>> return lreturnvalue
>>>>
>>>> Anybody a workaround
>>>> to check when a drive exist (and is ready) ?
>>>>
>>>> thanks in advance
>>>> regards
>>>> christophe
>>>> --
>>>>
>>>>
>>>
>>>
>>
>>
>
>