Jump to content

Recommended Posts

Posted

hello, i tried this method, and its great, i get a problem when the a: drive since i have no diskett inside windows returns me an error here is the code

Local $I Local $aDrives = DriveGetDrive("ALL"); Get an array of connected drives. 
while 1 For $I = 0 To UBound($aDrives)-1     
Switch DriveGetType($aDrives[$I])         
Case "Removable"         
If FileExists($aDrives[$I] & "\newdoc.txt")  Then             
EndIf             
EndSwitch Next wend

i also find driveget ?im not sure if its status but this command tells if the drive is ready or not and i think it will be better instead of DriveGetType but i dont know how to make it work

Posted (edited)

Hi,

I can not test it as I don't have a floppy drive, but something like

Local $i, $aDrives = DriveGetDrive("ALL")

For $i = 1 To $aDrives[0]
    Switch DriveGetType($aDrives[$i])
        Case "Removable"
            If DriveStatus($aDrives[$i]) = "READY" And FileExists($aDrives[$i] & "\newdoc.txt") Then
                ;;; File Found
            Else
                ;;; File Not Found
            EndIf
    EndSwitch
Next

Cheers

Edited by smashly
Posted

Another example... was in the middle of it when smashly replied.

AdlibEnable("CheckDrives", 5000) ; Check every 5 seconds.

While 1
    Sleep(10)
WEnd

Func CheckDrives()
    $aDrives = DriveGetDrive("Removable")
    For $I = 0 To UBound($aDrives) - 1
        If DriveStatus($aDrives[$I]) = 'READY' Then; only check the drive for the file if the drive is ready.
            If FileExists($aDrives[$I] & "\newdoc.txt") Then
            EndIf
        EndIf
        Sleep(10)
    Next
EndFunc   ;==>CheckDrives
Posted

Hi,

I can not test it as I don't have a floppy drive, but something like

Local $i, $aDrives = DriveGetDrive("ALL")

For $i = 1 To $aDrives[0]
    Switch DriveGetType($aDrives[$i])
        Case "Removable"
            If DriveStatus($aDrives[$i]) = "READY" And FileExists($aDrives[$i] & "\newdoc.txt") Then
                ;;; File Found
            Else
                ;;; File Not Found
            EndIf
    EndSwitch
Next

Cheers

thanks this is great, and no need to use ubound great

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...