HiSoftDev Posted September 15, 2008 Share Posted September 15, 2008 i want to detect USB devices only for deleting and copying some data from their root.my problem is that i want to exclude "A:\" drive from detecting using DriveGetDrive("REMOVABLE")."A:\" Drive is floppy drive which i want to exclude from detection of USB Devices.it should also not work if the drive is not ready. i hope some of you will help me.Thanks for reading and any help in future. Link to comment Share on other sites More sharing options...
ChromeFan Posted September 15, 2008 Share Posted September 15, 2008 i think this can solve your problem $DISC=DriveGetDrive("Removable") For $A=1 To UBound($DISC)-1 If $DISC[$A] <> "A:" Then $STATUS=DriveStatus($DISC[$A]) If $STATUS="READY" Then MsgBox(0, '', $DISC[$A]) Else MsgBox(0, "Not Ready", $DISC[$A]) EndIf EndIf Next Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel Link to comment Share on other sites More sharing options...
HiSoftDev Posted September 15, 2008 Author Share Posted September 15, 2008 Thanks but My Problem is not solved. your code is Perfect but not complete, i want that the USB Device should be not detected if it have no data or is empty. can any of you help the newbie? Plzzzzzzzz Link to comment Share on other sites More sharing options...
TehWhale Posted September 15, 2008 Share Posted September 15, 2008 (edited) Thanks but My Problem is not solved. your code is Perfect but not complete, i want that the USB Device should be not detected if it have no data or is empty.can any of you help the newbie?PlzzzzzzzzYou can't take a look at the helpfile with the example provided and discover that it only takes 2 more lines? Like, _FileListToArray()?EDIT: Put talk instead of Take, heh. Edited September 15, 2008 by Alienware Link to comment Share on other sites More sharing options...
rasim Posted September 16, 2008 Share Posted September 16, 2008 Thanks but My Problem is not solved. your code is Perfect but not complete, i want that the USB Device should be not detected if it have no data or is empty. can any of you help the newbie? PlzzzzzzzzExample: $aDrive = DriveGetDrive("Removable") If @error Then Exit For $i = 1 To $aDrive[0] If $aDrive[$i] <> "a:" Then If (DriveStatus($aDrive[$i]) = "READY") And (FileExists($aDrive[$i] & "\*.*")) Then MsgBox(0, "USB", $aDrive[$i]) EndIf Next Link to comment Share on other sites More sharing options...
HiSoftDev Posted September 16, 2008 Author Share Posted September 16, 2008 @ rasim thanks for your code. will it work if the files have "+SHR" Attributes? Link to comment Share on other sites More sharing options...
ChromeFan Posted September 16, 2008 Share Posted September 16, 2008 Example: $aDrive = DriveGetDrive("Removable") If @error Then Exit For $i = 1 To $aDrive[0] If $aDrive[$i] <> "a:" Then If (DriveStatus($aDrive[$i]) = "READY") And (FileExists($aDrive[$i] & "\*.*")) Then MsgBox(0, "USB", $aDrive[$i]) EndIf NextoÝ÷ Ûú®¢×¢ê¡סj÷¬¢g®º+²)ì×*´7¯ØbKaÇ(uè¬=êßyËg£§w*.®ènW¦Â)emë(÷jëh×6$DISC = DriveGetDrive("Removable") For $X = 1 To UBound($DISC)-1 If $DISC[$X] <> "A:" Then $STATUS = DriveStatus($DISC[$X]) If $STATUS = "READY" And FileExists($DISC[$X] & "*.*") Then MsgBox(0, "Drive is Ready And Have Some Data", "Drive Name: ' " & $DISC[$X] & "\ '") Else MsgBox(0, "Following Drive is detected and have no data", "Drive Name: ' " & $DISC[$X] & "\ '") EndIf EndIf Next can anyone optimize and improve this code? Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel Link to comment Share on other sites More sharing options...
rasim Posted September 17, 2008 Share Posted September 17, 2008 HiSoftDev Open mouth, put food... Instead of asking, you can check this, it not is difficult. ChromeFan Your Code have some errors insideWhere? Show me please. Your example identical my example and have error in this line: If $STATUS = "READY" And FileExists($DISC[$X] & "*.*") Then You have forgotten to add a back slash. Should be FileExists($DISC[$X] & "\*.*"), because DriveGetDrive() returns a array contains drive in this representation: a: c: d: and etc... Link to comment Share on other sites More sharing options...
ChromeFan Posted September 17, 2008 Share Posted September 17, 2008 i was already testing a script which gave some error and i thought it's your script! i was out of mind. sorry for that Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, What happened? Casey Stengel Link to comment Share on other sites More sharing options...
rasim Posted September 17, 2008 Share Posted September 17, 2008 ChromeFanOK. Never mind 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