seres Posted September 19, 2009 Share Posted September 19, 2009 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 Link to comment Share on other sites More sharing options...
smashly Posted September 19, 2009 Share Posted September 19, 2009 (edited) Hi, I can not test it as I don't have a floppy drive, but something likeLocal $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 September 19, 2009 by smashly Link to comment Share on other sites More sharing options...
DW1 Posted September 19, 2009 Share Posted September 19, 2009 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 AutoIt3 Online Help Link to comment Share on other sites More sharing options...
seres Posted September 19, 2009 Author Share Posted September 19, 2009 Hi, I can not test it as I don't have a floppy drive, but something likeLocal $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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now